하이퍼참조가 로드된 내용 줄 재정의

하이퍼참조가 로드된 내용 줄 재정의

아래의 latex 코드는 pdflatex 2차에서 컴파일에 실패합니다. hyperref 패키지를 제거하면 제대로 컴파일되지만, 거기에 있으면 컴파일에 실패하고 이 오류가 발생한다고 불평합니다.

(./master.out) (./master.out) (./master.toc) [1{/var/lib/texmf/fonts/map/pdftex /updmap/pdftex.map}] [2] (./ master.lot ! \contentsline의 인수에는 추가 }가 있습니다. \par l.3 \contentsline {table}{\numberline {1.1}{\ignorespaces 내 테이블의 캡션...

어떻게 해결할 수 있나요?

\documentclass[twoside,a4paper]{memoir}
\usepackage{hyperref}

\renewcommand\mempostaddchaptertotochook{%
  \addchaptertoloft{lof}%
  \addchaptertoloft{lot}%
}
\def\addchaptertoloft#1{% 
   \addtocontents{#1}{% 
     \protect\xcontentsline{chapter} 
      {\chaptername\ \thechapter\protect\nopagebreak\protect\vspace{1ex}}{}}}
\makeatletter
\def\xcontentsline#1#2#3{\@ifnextchar\contentsline 
  {\contentsline{#1}{#2}{#3}}{}} 
\makeatother


\begin{document}

\cleardoublepage
\tableofcontents
\cleardoublepage
\listoftables
\cleardoublepage

\chapter{Chapter}

\begin{table}
  \centering
  \caption{My table's caption}
    \begin{tabular}{l c c} 
        \hline
        column 1 & column 2 & column 3 \\
        \hline
        r1 & r2 & r3 \\
        r1 & r2 & r3 \\
        r1 & r2 & r3 \\
        r1 & r2 & r3 \\
        \hline
    \end{tabular}
\end{table}

\end{document}

관련 정보