babel, hyperref 및 부록 패키지 간의 충돌

babel, hyperref 및 부록 패키지 간의 충돌

논문을 작성하는 동안 아래의 작은 예와 같이 hyperref및 패키지를 사용합니다.appendix

test.tex

\documentclass{book}
\usepackage{hyperref}
\usepackage[titletoc]{appendix}

\begin{document}

\tableofcontents

\chapter{First chapter}
\section{Chapter section}
\chapter{Second chapter}

\begin{appendices}
\input{extra}
\end{appendices}

\end{document}

extra.tex

\chapter{First appendix}
\section{Appendix section}

이 예에서는 오류가 발생하지 않습니다. 최종 결과는 모든 장(부록의 장 포함)에 대한 클릭 가능한 링크가 있고 내가 원하는 방식으로 형식이 지정된 콘텐츠 테이블입니다.

컴파일(pdfLaTeX)하는 동안 다음 파일이 생성됩니다.

테스트.아웃

\BOOKMARK [0][-]{chapter.1}{First chapter}{}% 1
\BOOKMARK [1][-]{section.1.1}{Chapter section}{chapter.1}% 2
\BOOKMARK [0][-]{chapter.2}{Second chapter}{}% 3
\BOOKMARK [0][-]{Appendix.1.A}{Appendix First appendix}{}% 4
\BOOKMARK [1][-]{section.1.A.1}{Appendix section}{Appendix.1.A}% 5

물론 내 논문은 훨씬 더 큽니다(더 많은 장과 더 많은 부록). 구조는 비슷하지만 논문을 편집하면 수많은 알 수 없는 오류가 발생합니다(이해할 수 없음을 의미). 아래에 몇 가지를 나열했습니다. 패키지 에 주석을 달면 hyperref컴파일이 가능하지만 PDF 문서의 링크와 책갈피도 비활성화됩니다.

! Missing \endcsname inserted.
<to be read again> 
                   \penalty 
l.46 ...@skip {}lage.1.D}{B\377lage Afkortingen}{}
                                                  % 46
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.

! Missing number, treated as zero.
<to be read again> 
                   {
l.46 ...@skip {}lage.1.D}{B\377lage Afkortingen}{}
                                                  % 46
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Extra \endcsname.
\check@bm@number ...0\else \csname B_#1\endcsname 
                                                  \fi 
l.46 ...@skip {}lage.1.D}{B\377lage Afkortingen}{}
                                                  % 46
I'm ignoring this, since I wasn't doing a \csname.

)
! Missing $ inserted.
<inserted text> 
                $
l.154 \begin{document}

내 논문의 .out 파일은 부록 북마크에 도달할 때까지 괜찮아 보입니다.

...
\BOOKMARK [1][-]{section.5.4}{Optimalisatie}{chapter.5}% 32
\BOOKMARK [0][-]{chapter.6}{Conclusie}{}% 33
\BOOKMARK [0][-]{chapter*.28}{Bibliografie}{}% 34
\BOOKMARK [0][-]{B\penalty \@M \hskip \z@skip i\kern -0.02em j\penalty \@M \hskip \z@skip {}lage.1.A}{B\377lage Stopwoordlijsten}{}% 35
\BOOKMARK [1][-]{section.1.A.1}{Nederlandse stopwoorden}{B\penalty \@M \hskip \z@skip i\kern -0.02em j\penalty \@M \hskip \z@skip {}lage.1.A}% 36
\BOOKMARK [1][-]{section.1.A.2}{Engelse stopwoorden}{B\penalty \@M \hskip \z@skip i\kern -0.02em j\penalty \@M \hskip \z@skip {}lage.1.A}% 37
 ...

나는 믿는다이 게시물내 문제와 관련이 있지만 그 내용을 이해할 수 없습니다(저는 아직 LaTeX를 처음 접합니다). 내 논문의 링크와 북마크를 활성화하는 데 도움을 줄 수 있는 사람이 있나요?

인사말,

샌더

편집하다

babel예제에 패키지를 추가하면 문제가 재현됩니다.

\usepackage[dutch]{babel}

답변1

버그 신고

패키지 부록의 버그입니다. babel언어 옵션이 로드 되면 버그가 발생합니다 dutch. 내 버그 보고서에서 패키지 관리자에게:

다음 문서는 두 번째 실행에서 중단됩니다.

\documentclass{book}
\usepackage[dutch]{babel}
\usepackage{hyperref}
\usepackage[titletoc]{appendix}

\begin{document}   

\tableofcontents

\chapter{First chapter}
\section{Chapter section}
\chapter{Second chapter}

\begin{appendices}
\chapter{First appendix}
\section{Appendix section}
\end{appendices}

\end{document}  

.out 파일에는 다음이 포함됩니다.

\BOOKMARK [0][-]{B\penalty \@M \hskip \z@skip i\kern -0.02em j\penalty \@M
\hskip \z@skip {}lage.1.A}{B\377lage First appendix}{}% 4

언어 종속 문자열로 인해 대상 이름에 사용되는 카운터 이름이 손상되었습니다 B"ylage. 그 이유는:

\newcommand{\@resets@pp}{\par
  \@ppsavesec
  \stepcounter{@pps}
  \setcounter{section}{0}%
  \if@chapter@pp
    \setcounter{chapter}{0}%
    \renewcommand\@chapapp{\appendixname}%
    \renewcommand\thechapter{\@Alph\c@chapter}%
  \else
    \setcounter{subsection}{0}%
    \renewcommand\thesection{\@Alph\c@section}%
  \fi
  \if@pphyper
    \if@chapter@pp
      \renewcommand{\theHchapter}{\theH@pps.\Alph{chapter}}%
    \else
      \renewcommand{\theHsection}{\theH@pps.\Alph{section}}%
    \fi
    \def\Hy@chapapp{\appendixname}%
  \fi
  \restoreapp
}

\Hy@chapapp다음과 같이 재정의되며 \appendixname이는 속기 확장으로 인해 네덜란드어의 경우 중단되는 언어 종속적입니다. 그러나 대상 이름에 사용되는 것은 일반적으로 더 나은 고유한 대상 이름을 얻기 위해 이름이 변경된 \Hy@chapapp후에만 "장"(카운터 장에서)입니다 . 이 언어를 종속되게 만들 필요는 없습니다. 그냥 사용:\appendixchapterappendix

\def\Hy@chapapp{appendix}

또는

\def\Hy@chapapp{\Hy@appendixstring}

또한 다른 발생도 \@resets@ppsub수정해야 합니다.

해결 방법/솔루션

패키지의 버그 수정과 별개인 해결 방법도 있습니다 appendix. . bookmark다음에 패키지를로드하십시오 hyperref. 북마크에 대한 훨씬 더 강력한 알고리즘을 가지고 있으며 인코딩( ) 을 사용하여 파일 B"ylage의 깨진 부분을 처리합니다 . 또한 북마크가 이전에 업데이트되었습니다..auxhexbase16

\documentclass{book}
\usepackage[dutch]{babel}
\usepackage{hyperref}
\usepackage{bookmark}
\usepackage[titletoc]{appendix}

또한 hyperrefv6.83b는 대상 이름(\hypercurrent 및 \contentsline의 대상 이름)에서 약어를 비활성화합니다.

북마크의 'IJ' 및 'ij'

대문자/소문자 i 및 j의 합자인 이러한 문자는 PDFDocEncoding에서 사용할 수 없습니다. 하지만 유니코드 북마크를 통해 액세스할 수 있습니다. 즉, hyperref옵션 pdfencoding=auto또는 unicode.

hyperref의 인코딩 에서 "ÿ"로 대체된 것은 PD1버그이며 v6.83b에서 수정될 예정입니다.

그런데, 북마크에 대한 매크로 재정의는 다음 위치에 넣어 북마크(PDF 문자열)로 제한할 수 있습니다 \pdfstringdefDisableCommands.

\pdfstringdefDisableCommands{%
  \renewcommand*{\appendixname}{Bookmark-Appendix}%
} 

답변2

모든 의견을 종합한 완전한 솔루션입니다.

\documentclass{book}
\usepackage[dutch]{babel}
\usepackage[titletoc]{appendix}
\usepackage{hyperref}
\usepackage{bookmark} % handles the encoding in the .out file

\addto\captionsdutch{\renewcommand{\appendixname}{Bijlage}} % changes 'Bÿlage' to 'Bijlage' for the bookmarks

\begin{document}

\tableofcontents

\chapter{First chapter}
\section{Chapter section}
\chapter{Second chapter}

\begin{appendices}
\input{extra}
\end{appendices}

\end{document}

인사말,

샌더

관련 정보