섹션 및 항목 하이퍼링크 앞의 페이지 나누기 문제

섹션 및 항목 하이퍼링크 앞의 페이지 나누기 문제

\section{...}각 문서 앞에 페이지 나누기가 필요합니다 . 이 스레드에 따르면:각 섹션으로 새 페이지 시작다음 명령을 추가해야 합니다.

\newcommand{\sectionbreak}{\clearpage} % page break before section

toc하지만 with를 사용하는 데 문제가 있습니다 hyperref. 각 섹션의 하이퍼링크는 toc실제 페이지 위치보다 한 페이지 먼저 설정됩니다. 다음 예에서는:

  • 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자체 기능을 제공하는 유연한 클래스(예: )를 고려해야 합니다.

관련 정보