
\section{...}
各ドキュメントの前に改ページが必要です。このスレッドによると:各セクションで新しいページを開始する次のコマンドを追加する必要があります:
\newcommand{\sectionbreak}{\clearpage} % page break before section
toc
ただし、 with を使用すると問題が発生しますhyperref
。 からtoc
各セクションへのハイパーリンクは、実際のページ位置の 1 ページ前に設定されます。次の例をご覧ください。
toc
ハイパーリンクをクリックするとセクション1(これは2ページ)、私は残りますページ1。toc
ハイパーリンクをクリックすると第2節(これは3ページ)、私は運ばれる2ページ。
テストの準備ができたコードは次のとおりです。
\documentclass[12pt,a4paper]{scrartcl} % A4 paper and 12pt font size
\usepackage{hyperref} % Hyperlinks
\usepackage{titlesec} % customizing sections
\newcommand{\sectionbreak}{\clearpage} % page break before section
\begin{document}
\tableofcontents
\section{Section 1}
Text
\subsection{Subsection 1.1}
Text
\subsection{Subsection 1.2}
Text
\section{Section 2}
Text
\subsection{Subsection 2.1}
Text
\subsection{Subsection 2.2}
Text
Text
\end{document}
間違ったリンクを修正するか、ハイパーリンクtoc
と互換性のあるセクションの前にページ区切りを挿入する他の方法が必要ですtoc
。
答え1
両方hyperref
そしてtitlesec
重要な操作、関連しているドキュメントの要素。そのため、読み込み順序は常に考慮する必要があります。この場合、読み込み順序は次のようになります。
\usepackage{titlesec}
...
\usepackage{hyperref}
暗黙的に示唆されているようにどのパッケージを前ではなく後にロードする必要がありますかhyperref
?しかし、memoir
.log
読み込みについて次のことを記載しますtitlesec
。
Class scrartcl Warning: Usage of package `titlesec' together
(scrartcl) with a KOMA-Script class is not recommended.
(scrartcl) I'd suggest to use the package only
(scrartcl) if you really need it, because it breaks several
(scrartcl) KOMA-Script features, i.e., option `headings' and
(scrartcl) the extended optional argument of the section
(scrartcl) commands .
(scrartcl) Nevertheless, using requested
(scrartcl) package `titlesec' on input line 4.
パッケージはドキュメント クラスによって課される特定の「制限」を拡張することを目的としていますが、memoir
独自の機能を提供する柔軟なクラス ( など) も検討する必要があります。