Hyperref가 있는 TOC에서 \MakeTextUppercase를 허용하도록 Memoir 매뉴얼의 수정 사항을 적용하는 방법

Hyperref가 있는 TOC에서 \MakeTextUppercase를 허용하도록 Memoir 매뉴얼의 수정 사항을 적용하는 방법

memoir클래스와 패키지 사이에 알려진 충돌이 있습니다 hyperref. 매크로가 hyperref포함된 목차 제목을 처리할 수 없습니다 \MakeTextUppercase.

매뉴얼 memoir( texdoc memoir)에는 문제를 해결하기 위한 약간의 코드가 제공되어 있지만 제대로 작동하도록 할 수는 없습니다.

설명서의 해결 방법을 잘못 사용하고 있는 건가요, 아니면 다른 해결 방법이 필요한가요?

\documentclass{memoir}

\renewcommand*{\cftpartfont}{\MakeTextUppercase}

% From Memoir manual p. 158
\makeatletter
\settocpreprocessor{part}{%
    \let\tempf@rtoc\f@rtoc%
    \def\f@rtoc{%
        \texorpdfstring{\MakeTextUppercase{\tempf@rtoc}}{\tempf@rtoc}}%
}
\makeatother

\usepackage{hyperref}

\begin{document}

\tableofcontents*

\part{A Whale}
\chapter{A Tale}
\section{A Sail}
\subsection{A Beachball}

\part{A Poodle}
\chapter{A Noodle}
\section{A Doodle}

\end{document}

이 MWE를 컴파일하면 다음 오류가 발생합니다.

! Argument of \contentsline has an extra }.
<inserted text> 
                \par 
l.2 \contentsline
                  {chapter}{\chapternumberline {1}A Tale}{5}

다른 솔루션이 제안되었습니다:

그러나 이상적으로는 수업 매뉴얼에 있는 해결책이 올바른 것입니다.

답변1

memoir의 매뉴얼을 오해하고 계신 것 같습니다 .

hyperref로드할 때 ToC의 부품에 대문자 글꼴을 설정할 수 없다고 나와 있습니다 .

\renewcommand*{\cftpartfont}{\MakeTextUppercase}

\settocpreprocessor대신 다음과 같은 방법으로 사용할 수 있다고 나와 있습니다 .

\makeatletter
\settocpreprocessor{part}{%
    \let\tempf@rtoc\f@rtoc%
    \def\f@rtoc{%
        \texorpdfstring{\MakeTextUppercase{\tempf@rtoc}}{\tempf@rtoc}}%
}
\makeatother

따라서 MWE에서 문제가 되는 행을 제거하기만 하면 원하는 결과를 얻을 수 있습니다.

\documentclass{memoir}

%\renewcommand*{\cftpartfont}{\MakeTextUppercase}

% From Memoir manual p. 158
\makeatletter
\settocpreprocessor{part}{%
    \let\tempf@rtoc\f@rtoc%
    \def\f@rtoc{%
        \texorpdfstring{\MakeTextUppercase{\tempf@rtoc}}{\tempf@rtoc}}%
}
\makeatother

\usepackage{hyperref}

\begin{document}

\tableofcontents*

\part{A Whale}
\chapter{A Tale}
\section{A Sail}
\subsection{A Beachball}

\part{A Poodle}
\chapter{A Noodle}
\section{A Doodle}

\end{document} 

여기에 이미지 설명을 입력하세요

관련 정보