액센트 패키지를 사용할 때: 표 캡션의 언더액센트 그리스 기호가 오류를 발생시킵니다.

액센트 패키지를 사용할 때: 표 캡션의 언더액센트 그리스 기호가 오류를 발생시킵니다.

나는 수학 기호 아래에 막대를 배치하기 위해 Accents 패키지를 사용하고 있습니다. 이는 방정식과 일반 텍스트(분명히 여전히 수학 환경 $...$)에서 사용할 때 매우 잘 작동합니다. 그러나 현재 캡션이 포함된 테이블을 만들고 있는데 컴파일하고 싶지 않습니다. 나는 \underbar를 사용하고 싶지 않습니다.


MWE

\documentclass{article}

\usepackage{accents}
\newcommand{\ubar}[1]{\underaccent{\bar}{#1}}

\begin{document}

\begin{table}
\begin{tabular}{c}
a
\end{tabular}
\caption{$\ubar{\pi}$}
\end{table}

\end{document}

첫 번째오류WinEdt 8.0 및 MiKTeX 2.9에서 PDFTeXify를 사용할 때(실제로 100개의 오류가 발생함)

! Undefined control sequence.
\underaccent #1#2->\begingroup \def \cc@a
                                           {#2}\cc@palette \cc@underaccent {#...
1.12 \caption{$\ubar{\pi}$}

The control sequence at the end of the top line 
of your error message was never \def'ed. If you have 
misspelled it (e.g. `\hobx'), type `I' and the correct 
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

답변1

패키지 accents는 강력하지 않은 명령을 정의합니다. 예를 들어 우리는 다음을 찾습니다.

\newcommand\underaccent[2]{%
  \begingroup
    \def\cc@a{#2}% Stores the nucleous...
    \cc@palette\cc@underaccent{#1}% ...and the accent is passed
    #2%
  \endgroup}

\caption이와 같은 명령은 "이동 인수"( , \chapter\section유사한 명령에 대한 인수) 에서 발견되지 않습니다 . 측면 \ubar에서 정의하면 동일한 취약성을 공유하게 됩니다.\underaccent\ubar

패키지가 정말 해야 할 일

\DeclareRobustCommand\underaccent[2]{%
  \begingroup
    \def\cc@a{#2}% Stores the nucleous...
    \cc@palette\cc@underaccent{#1}% ...and the accent is passed
    #2%
  \endgroup}

그러면 문제가 사라질 것입니다.

다양한 수정 사항이 있습니다. 첫 번째는 \protect이동 인수에 나타날 때 명령 앞에 놓는 것입니다.

\caption{$\protect\ubar{\pi}$}

더 나은 수정은 다음을 보호하는 것입니다.당신의명령

\DeclareRobustCommand{\ubar}[1]{\underaccent{\bar}{#1}}

사용하는 대신 \newcommand.

더 나은 수정은 다음의 결함을 해결하는 것입니다 accents.

\documentclass{article}
\usepackage{fixltx2e}

\usepackage{accents}

\MakeRobust{\underaccent} % make \underaccent not fragile in moving arguments

\newcommand{\ubar}[1]{\underaccent{\bar}{#1}}

\begin{document}
\begin{figure}
\caption{$\ubar{\pi}$}
\end{figure}
\end{document}

대신 fixltx2e다음을 사용할 수 있습니다 etoolbox.

\usepackage{etoolbox}

\usepackage{accents}
\robustify{\underaccent}

(다른 방식으로) 똑같이 할 것입니다.

관련 정보