Скобки с текстом внутри списка

Скобки с текстом внутри списка

Я использую uderbraces для аннотирования текста. Когда я хочу получить подробный список, фрагменты текста, включающие нижние скобки, неловко отступают относительно маркера. Есть ли способ сделать его нормально выровненным (без отступа). Пример:

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

Связанный контент