
我正在使用大括號來註釋文字。然而,當我想要一個逐項列表時,涉及下括號的文字位元與項目符號點一起尷尬地縮排。有沒有辦法讓它正常對齊(非縮排)。例子:
\documentclass[pdf]{beamer}
\usepackage{xcolor}
\usepackage{amsmath}
\makeatletter
\newcommand{\redub}{}
\def\redub#1{%
\@ifnextchar_%
{\@redub{#1}}
{\@latex@warning{Missing argument for \string\redub}\@redub{#1}_{}}%
}
\def\@redub#1_#2{%
\colorlet{currentcolor}{.}%
\color{red}%
\underbrace{\color{currentcolor}#1}_{\color{red}#2}%
\color{currentcolor}%
}
\makeatother
\begin{document}
\begin{frame}
\begin{itemize}
\item SAMPLE
\item
\[
\redub{\text{sample}}_{\mathclap{\text{sample}}}}{\text{sample}}
\]
\end{itemize}
\end{frame}
\end{document}
因此,第一個項目符號點下方的文字不會相對於該項目符號點縮排。第二個項目符號下的文字是縮排的。我正在努力讓它們保持一致。
答案1
如果你不需要展示等式,將其置於內嵌數學模式:
\documentclass{beamer}% http://ctan.org/pkg/beamer
\usepackage{xcolor,mathtools}% http://ctan.org/pkg/{xcolor,mathtools}
\makeatletter
\newcommand{\redub}{}
\def\redub#1{%
\@ifnextchar_%
{\@redub{#1}}
{\@latex@warning{Missing argument for \string\redub}\@redub{#1}_{}}%
}
\def\@redub#1_#2{%
\colorlet{currentcolor}{.}%
\color{red}%
\underbrace{\color{currentcolor}#1}_{\color{red}#2}%
\color{currentcolor}%
}
\makeatother
\begin{document}
\begin{frame}
\begin{itemize}
\item SAMPLE
\item $\redub{\text{sample}}_{\mathclap{\text{sample}}}{\text{sample}}$
\end{itemize}
\end{frame}
\end{document}
請注意,您需要mathtools
為了使用\mathclap
-amsmath
單獨是不夠的,但是會被載入mathtools
。