
큰 문서에 메인 \tableofcontents
과 여러개를 설정하려고 합니다 . \localtableofcontents
이 문서는 서론, 여러 부분, 결론 및 참고문헌으로 구성됩니다.
목차는 다음과 같습니다.
- 서론, 결론, 참고문헌은 본론의 장으로 설정되어야 한다
\tableofcontents
. 후자의 두 개는 번호가 매겨지지 않아야 합니다. \localtableofcontents
각 부품의 첫 페이지에는 문제의 부품이 표시됩니다.
나는 패키지를 활용하여 이것을 달성하려고 노력했습니다 {etoc}
. 다음 MWE는 원하는 대로 기본 목차를 생성합니다.
\documentclass{report}
\usepackage{titlesec}
\usepackage{etoc}
% to be able to show localtoc on part-page
\titleclass{\part}{top}
\titleformat{\part}[display]{\normalfont\huge\filcenter\bfseries}{\partname\ \thepart}{0pt}{}
\begin{document}
\tableofcontents
\chapter{Introduction}
\part{A Part}
\etocsettocstyle{}{}
\etocsetnexttocdepth{section}
\localtableofcontents
\chapter{A Chapter}
\section{A section}
\part{Another Part}
\etocsetnexttocdepth{section}
\localtableofcontents
\chapter{Another Chapter}
\section{Another Section}
% (1) change local toc's depth
%\etocsettocdepth{part}
%\etocignoretoctocdepth
% (2) limit scope of last local toc
%\etocsetnexttocdepth{part}
%\invisiblelocaltableofcontents
\chapter*{Conclusion}
% to add unnumbered conclusion to toc:
\addcontentsline{toc}{chapter}{Conclusion}
\bibliographystyle{plainnat}
% to add unnumbered bibliography to toc:
\addcontentsline{toc}{chapter}{\bibname}
\bibliography{\jobname}
\end{document}
그러나 마지막에서 결론과 참고문헌을 제외하지는 못한다 \localtableofcontents
.
내 생각은 다음 중 하나였습니다.
\etocsettocdepth
\localtableofcontents
결론 직전에 더 이상 장을 포함하지 않는 마지막 부분\localtableofcontents
더 이상 결론에 도달하지 않도록 마지막 범위를 제한합니다 .
내 시도는 위의 MWE에서 주석 처리되었습니다. 하지만 어쨌든 효과가 없는 것 같으니 처형하는 것이 나을 수도 있습니다...
마지막에서 결론과 참고문헌을 제외하려면 어떻게 해야 합니까 \localtableofcontents
?
답변1
이와 같은 경우 etoc
명령이 있습니다 \etocsetlocaltop
. 약간 이상한 구문이 있습니다. 파일 part
에 구분 기호를 삽입하려면 toc
다음과 같이 작성하세요.
\etocsetlocaltop.toc{part}
toc
이는 마치 새로운 것이 시작된 것처럼 동작하는 마커를 추가합니다 part
. 자세한 내용은 48장을 참고하세요.etoc 문서.
따라서 전체 문서는 다음과 같습니다.
\documentclass{report}
\usepackage{titlesec}
\usepackage{etoc}
% to be able to show localtoc on part-page
\titleclass{\part}{top}
\titleformat{\part}[display]{\normalfont\huge\filcenter\bfseries}{\partname\ \thepart}{0pt}{}
\begin{document}
\tableofcontents
\chapter{Introduction}
\part{A Part}
\etocsettocstyle{}{}
\etocsetnexttocdepth{section}
\localtableofcontents
\chapter{A Chapter}
\section{A section}
\part{Another Part}
\etocsetnexttocdepth{section}
\localtableofcontents
\chapter{Another Chapter}
\section{Another Section}
% limit scope of last local toc
\etocsetlocaltop.toc{part}
\chapter*{Conclusion}
% to add unnumbered conclusion to toc:
\addcontentsline{toc}{chapter}{Conclusion}
\bibliographystyle{plainnat}
% to add unnumbered bibliography to toc:
\addcontentsline{toc}{chapter}{\bibname}
\bibliography{\jobname}
\end{document}