\allowbreak는 \index에서 작동하지 않습니다.

\allowbreak는 \index에서 작동하지 않습니다.

\allowbreak항목 에 포함시키고 싶지만 \index작동시킬 수 없습니다. .idx 파일에서 가 변경되어 생성된 인덱스가 손상 됩니다 \allowbreak.\penalty \z@

이 문제를 어떻게 해결할 수 있나요?

답변1

아마도 \index다른 명령에 대한 인수를 호출하고 있을 것입니다. 다음은 에뮬레이션입니다.

\documentclass{article}
\usepackage{makeidx}
\makeindex

\begin{document}

a\index{abcdef@abc\allowbreak def}

% now do the call in the argument of a command
\textbf{g\index{ghijkl@ghi\allowbreak jkl}}

% now use the proper input
\textbf{m\index{mnopqr@mno\protect\allowbreak pqr}}

\printindex

\end{document}

그러면 다음 .idx파일이 생성됩니다.

\indexentry{abcdef@abc\allowbreak def}{1}
\indexentry{ghijkl@ghi\penalty \z@ jkl}{1}
\indexentry{mnopqr@mno\allowbreak pqr}{1}

\allowbreak다음 \penalty \z@과 같은 문제가 있으면 동일한 문제가 발생합니다.

\newcommand{\indexword}[1]{#1\index{#1}}

그리고 할

\indexword{abc\allowbreak def}

\protect\allowbreak이 경우에도 를 사용 하면 됩니다. 그러나 색인 항목을 정렬하면 \allowbreak아마도 잘못된 결과가 나올 수 있습니다.

관련 정보