![在 Beamer 中縮排文本](https://rvso.com/image/286367/%E5%9C%A8%20Beamer%20%E4%B8%AD%E7%B8%AE%E6%8E%92%E6%96%87%E6%9C%AC.png)
我正在嘗試縮進文本,如下所示。
為了獲得正確的對齊方式(現在還遠非完美),我一直在使用換行符\\
和\hspace{3.1cm}
.有沒有合法的方法可以得到上圖的結果?
作為一個最小的工作範例,我有
\documentclass[12pt,mathserif]{beamer}
\usetheme{Berkeley}
\usecolortheme{dove}
\useinnertheme{default}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{itemize items}[default]
\setbeamertemplate{enumerate items}[default]
\beamertemplatenavigationsymbolsempty
\setbeamerfont{footline}{size=\fontsize{9}{11}\selectfont}
\setbeamertemplate{footline}[page number]
\begin{document}
\frame{\frametitle{Detecting MWEs in Typed Text}
\begin{itemize}
\item $\mathbf{Assumption \;1}$: MWEs have unique prosodic\\
\hspace{3.1cm}characteristics
\item $\mathbf{Assumption \;2}$: KD is the reflection of prosody in\\
\hspace{3.1cm}typing
\item $\mathbf{Conclusion}$: \hspace{0.5cm}MWEs should be uniquely\\
\hspace{3.1cm}characterized in typing
\end{itemize}
}
\end{document}
答案1
使用以下方法時,這種對齊很容易tabular
:
\documentclass{beamer}% http://ctan.org/pkg/beamer
\begin{document}
\begin{frame}
\begin{tabular}{@{\textbullet~}l@{\ }p{2in}}
\bfseries Assumption 1: & MWEs have unique prosodic characteristics \\
\bfseries Assumption 2: & KD is the reflection of prosody in typing \\
\bfseries Conclusion: & MWEs should be uniquely characterized in typing
\end{tabular}
\end{frame}
\end{document}
如果您不想測量右側的列寬(目前固定為2in
),那麼您可以使用tabularx
反而。也,array
可用於幫助將第一列格式化為\bfseries
自動格式化第一列。這是一個結合了兩者的例子和右傾第二列:
\documentclass{beamer}% http://ctan.org/pkg/beamer
\usepackage{array,tabularx}% http://ctan.org/pkg/{array,tabularx}
\begin{document}
\begin{frame}
\begin{tabularx}{\linewidth}{@{\textbullet~}>{\bfseries}l@{\ }>{\raggedright\arraybackslash}X@{}}
Assumption 1: & MWEs have unique prosodic characteristics \\
Assumption 2: & KD is the reflection of prosody in typing \\
Conclusion: & MWEs should be uniquely characterized in typing
\end{tabularx}
\end{frame}
\end{document}
答案2
您可以使用中所述的方法https://tex.stackexchange.com/a/163733/586,改變環境description
。
\documentclass[12pt,mathserif]{beamer}
\usetheme{Berkeley}
\usecolortheme{dove}
\useinnertheme{default}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{itemize items}[default]
\setbeamertemplate{enumerate items}[default]
\beamertemplatenavigationsymbolsempty
\setbeamerfont{footline}{size=\fontsize{9}{11}\selectfont}
\setbeamertemplate{footline}[page number]
% new additions
\defbeamertemplate{description item}{align left}{$\blacktriangleright$ \bfseries\insertdescriptionitem\hfill}
\setbeamertemplate{description item}[align left]
\begin{document}
\frame{\frametitle{Detecting MWEs in Typed Text}
\begin{description}[Assumption 2:]
\item [Assumption 1:] MWEs have unique prosodic
characteristics
\item [Assumption 2:] KD is the reflection of prosody in
typing
\item [Conclusion:] MWEs should be uniquely
characterized in typing
\end{description}
}
\end{document}
答案3
可能有更好的方法,但這是一種使用堆疊的方法。我使用是\bullet
因為我不知道右指三角形符號的名稱。另外,由於某種原因,我必須將堆疊行尾 (EOL) 符號從預設值更改\\
為其他符號(在本例中)\#
。 stacktabbedgap 設定列之間的間隙。
\documentclass{beamer}
\usepackage{tabstackengine}
\newcommand\pparbox[2]{\protect\parbox[t]{#1}{#2\strut}}
\setstacktabbedgap{1ex}
\setstackEOL{\#}
\begin{document}
\begin{frame}
\tabbedShortstack[l]{
\bfseries $\bullet$ Assumption 1: & \pparbox{2in}{%
MWEs have unique prosodic characteristics}\#
\bfseries $\bullet$ Assumption 2: & \pparbox{2in}{%
KD is the reflection of prosody in typing}\#
\bfseries $\bullet$ Conclusion: & \pparbox{2in}{%
MWEs should be uniquely characterized in typing}
}
\end{frame}
\end{document}
如果您打算經常使用該技術,則可以將大部分語法放入巨集中:
\documentclass{beamer}
\usepackage{tabstackengine}
\newcommand\pparbox[2]{\protect\parbox[t]{#1}{#2\strut}}
\def\secondcolwidth{2in}%DEFAULT
\newcommand\firstcol[1]{\bfseries$\bullet$ #1:}
\newcommand\secondcol[1]{\pparbox{\secondcolwidth}{#1}}
\setstacktabbedgap{1ex}
\setstackEOL{\#}
\begin{document}
\begin{frame}
\def\secondcolwidth{2in}
\tabbedShortstack[l]{
\firstcol{Assumption 1} & \secondcol{MWEs have unique prosodic characteristics}\#
\firstcol{Assumption 2} & \secondcol{KD is the reflection of prosody in typing}\#
\firstcol{Conclusion} & \secondcol{MWEs should be uniquely characterized in typing}
}
\end{frame}
\end{document}