
ドキュメントに付録があり、本文でその名前で参照したいとします。\section*
付録を目次に表示したくないので、ここでは星印の付いたコマンドを使用します。ただし、\nameref
"付録" という単語があるべき場所には単に空白が挿入されます。
コメントのおかげで、問題は実際にはtitlesec
パッケージにあることがわかりました。セクションをAppendix
TOC で番号なしの項目として表示したいのですが、同時に、\nameref
上で説明したように参照を行いたいのです。そこで、例を編集して次のようにしました。
\documentclass[11pt, oneside, a4paper]{article}
\usepackage{titlesec}
\titleformat{\section}{\normalfont\LARGE\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}{\normalfont\Large\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\normalfont\large\bfseries}{\thesubsubsection}{1em}{}
\titleformat{\paragraph}[runin]{\normalfont\large\bfseries}{\theparagraph}{1em}{}
\usepackage[hidelinks]{hyperref}
\usepackage{nameref}
\newcommand{\sectionbreak}{\clearpage}
\begin{document}
\tableofcontents % added this line
\section{Section 1}
\label{sec:section_1}
All that can be seen in the \nameref{sec:appendix}.
\section*{Appendix}
\label{sec:appendix}
\addcontentsline{toc}{section}{Appendix} % added this line
Here comes the appendix.
\end{document}
答え1
この質問は、を使用した同じ競合に対する回答を検索していたときに表示されtitlesec
、ラベル付けが必要だったため、数年後に Ulrike Fisher がフォーラムで公開した回避策を共有したいと思います。したがって、この質問はその回答に相互リンクされ、すべての人の利益になります。hyperref
\section*{}
Ulrike は、ラベルを必要とするスター付きセクション (およびその他) を拡張するために使用できる新しいコマンドを定義しました。彼女の回答は、こちらでご覧いただけます:titlesec と latexbangla が原因で、番号なしのセクションでは nameref が機能しません。
/'titlesec
との組み合わせが機能しない理由は、Heiko Oberdiek がこの質問で説明しています。hyperref
nameref
hyperref と titlesec との競合。