我正在尝试缩进文本,如下所示。
为了获得正确的对齐效果(目前还远远不够完美),我一直在使用换行符\\
和进行反复试验\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}