
論文を書いている間、私は以下の小さな例のように、hyperref
およびパッケージを使用します。appendix
テスト.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}
エクストラ.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
バグレポート
これはパッケージ appendix のバグです。babel
言語オプション付きでロードされた場合にこのバグが発生しますdutch
。パッケージ管理者へのバグレポートから:
次のドキュメントは 2 回目の実行で壊れます。
\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
後にのみ、"chapter" (counter chapter から) になります。これは 、より一意の宛先名を取得するためです。これを言語依存にする必要はありません。次のように使用するだけです。\appendix
chapter
appendix
\def\Hy@chapapp{appendix}
または
\def\Hy@chapapp{\Hy@appendixstring}
また、その他の発生も\@resets@ppsub
修正する必要があります。
回避策/解決策
パッケージ のバグ修正とは独立した回避策もありますappendix
。bookmark
の後にパッケージ をロードするだけです。この回避策はブックマークに対してより堅牢なアルゴリズムを備えており、エンコード ( )を使用してファイル 内のhyperref
破損に対処します。また、ブックマークはより早く更新されます。B"ylage
.aux
hex
base16
\documentclass{book}
\usepackage[dutch]{babel}
\usepackage{hyperref}
\usepackage{bookmark}
\usepackage[titletoc]{appendix}
また、hyperref
v6.83b では、宛先名の省略形 (\hypercurrent および \contentsline 内の宛先名) が無効になります。
ブックマーク内の「IJ」と「ij」
これらの文字、つまり大文字/小文字の i と j の合字は、PDFDocEncoding では使用できません。ただし、Unicode ブックマーク、つまり
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}
ご挨拶
サンダー