목록 내부에 텍스트가 있는 밑괄호

목록 내부에 텍스트가 있는 밑괄호

텍스트에 주석을 달기 위해 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.

관련 정보