リスト内のテキストの下括弧

リスト内のテキストの下括弧

テキストに注釈を付けるためにアンダーブレースを使用しています。しかし、箇条書きのリストにしたい場合、アンダーブレースを含むテキストの部分は箇条書きに対して不自然にインデントされます。通常の配置 (インデントなし) にする方法はありますか。例:

\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}

つまり、最初の箇条書きの下のテキストは、箇条書きに対してインデントされていません。2 番目の箇条書きの下のテキストはインデントされています。これらを揃えようとしています。

答え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

関連情報