2017-11-27 1 views
0

부록 섹션 번호가 잘못되었습니다. 전체 프로젝트의 위치는 다음과 같습니다. https://github.com/JerryOpenix/Debugging-With-GDBpdflatex : 부록 섹션 번호가 잘못되었습니다.

MWE는 다음과 같습니다. 부록 B의 섹션 번호가 잘못되었습니다.

부록 B의 섹션 번호를 수동으로 0으로 설정하지 마십시오.

\documentclass[12pt,twoside,a4paper,openright]{book} 

\usepackage[subpreambles=false]{standalone} 
\usepackage[toc, page]{appendix} 

\begin{document} 

\pagenumbering{arabic} 

\appendix 

\renewcommand{\thechapter}{A\alph{chapter}} 
\chapter*{Appendix A Installing GDB} 
\addcontentsline{toc}{chapter}{Installing GDB} 

\section*{tools to build gdb} 
\#TODO 

\setcounter{section}{0} 

\section{call configuration script} 
\#TODO 

\renewcommand{\thechapter}{B\alph{chapter}} 
\chapter*{Appendix B GDB protocol} 
\addcontentsline{toc}{chapter}{GDB protocol} 

\section{Overview} 
\#TODO 

\cleardoublepage 
\end{document}` 

답변

1

예제 코드는 다소 인위적입니다 (GitHub에서 전체 프로젝트를 컴파일하지는 않을 것입니다). 여기 무슨 일이 일어나고 있는지 요령이 있습니다 :

모든 부록 장을 나타 내기 위해 \chapter*을 사용하고 있습니다. 별표 표시된 \chapter은 장 제목에 카운터를 설정하지 않음을 나타냅니다. 또한 chapter 카운터가 단계적으로 증가하지 않음을 의미합니다. chapter 카운터를 밟지 않은 결과로 하위 수준 섹션 단위에 카운터가 재설정되지 않습니다. 그래서 두 번째 부록의 첫 번째 절은 첫 번째 부록의 첫 번째 절에서 계속됩니다.

\let\oldappendix\appendix% Store \appendix in \oldappendix 
\renewcommand{\appendix}{% Update \appendix to... 
    \oldappendix   % ...call the traditional \appendix 
    \let\oldchapter\chapter% Store \chapter in \oldchapter 
    \renewcommand{\chapter}{% Update \chapter to... 
    \setcounter{section}{0}% ...reset the section counter and... 
    \oldchapter% ...call the traditional \chapter macro 
    }% 
} 

위의 코드는 항상 무엇을 할 \appendix를 업데이트합니다뿐만 아니라 \chapter에 업데이트를 추가

당신은 당신의 프리앰블에 다음을 추가하려고 시도 할 수 있습니다. 이 업데이트는 \chapter*을 사용할 경우 section 카운터를 재설정합니다. \chapter을 사용하더라도 문제가되지 않습니다.

관련 문제