![TOC에 정렬되지 않은 부록 제목](https://rvso.com/image/330716/TOC%EC%97%90%20%EC%A0%95%EB%A0%AC%EB%90%98%EC%A7%80%20%EC%95%8A%EC%9D%80%20%EB%B6%80%EB%A1%9D%20%EC%A0%9C%EB%AA%A9.png)
TOC의 부록 제목 배치에 문제가 있습니다. 나는 titletoc 옵션과 함께 부록 패키지를 사용합니다. 다음 코드
\documentclass{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[title,titletoc]{appendix}
\begin{document}
\tableofcontents
\chapter{some chapter}
\begin{subappendices}
\section{Short title}
\section{This is a very long title that reaches the right end of the separable}
\section{Long title}
\end{subappendices}
\chapter{some other chapter}
\begin{subappendices}
\section{short title in only 1 line}
\section{much longer title that will be displayed over two lines rather than just 1}
\section{short title in only 1 line}
\end{subappendices}
\end{document}
다음 TOC를 생성합니다.
보시다시피 1.A, 1.B 및 1.C는 정렬되지 않았습니다(아마도 "separable"이라는 단어가 너무 길기 때문일 수 있습니다. 2.B가 정렬되지 않은 두 번째 블록에서도 비슷한 일이 발생합니다.
제목을 변경하는 것 외에 이 문제를 어떻게 해결할 수 있나요?
답변1
여기에 패키지가 없는 제안이 있습니다 appendix
.
섹션 명령 은 다음과 같이 선언 \section
됩니다 .scrreprt
\DeclareSectionCommand[%
style=section,%
level=1,%
indent=\z@,%
beforeskip=-3.5ex \@plus -1ex \@minus -.2ex,%
afterskip=2.3ex \@plus.2ex,%
tocstyle=section,%
tocindent=1.5em,%
tocnumwidth=2.3em%
]{section}
\section
와 동일한 레벨에서 다른 섹션 명령을 사용하여 새 섹션 명령을 선언할 수 있습니다 tocnumwidth
.
\documentclass[numbers=noenddot]{scrreprt}
\usepackage[utf8]{inputenc}
\DeclareNewSectionCommand[
style=section,
level=1,
indent=0pt,
beforeskip=-3.5ex plus -1ex minus -.2ex,
afterskip=2.3ex plus .2ex,
tocindent=1.5em,
tocnumwidth=7em,
counterwithin=chapter,
font=\usekomafont{section},
]{subappendix}
\makeatletter
\AtBeginDocument{\let\toclevel@subappendix\toclevel@section}
\makeatother
\renewcommand\thesubappendix{\thechapter.\Alph{subappendix}}
\renewcommand\subappendixformat{\appendixname~\thesubappendix\autodot\quad}
\renewcommand\addsubappendixtocentry[2]{%
\addtocentrydefault{subappendix}{\appendixname~#1}{#2}%
}
\newenvironment{subappendices}{\let\section\subappendix}{}
\begin{document}
\tableofcontents
\chapter{some chapter}
\begin{subappendices}
\section{Short title}
\section{This is a very long title that reaches the right end of the separable}
\section{Long title}
\end{subappendices}
\chapter{some other chapter}
\begin{subappendices}
\section{short title in only 1 line}
\section{much longer title that will be displayed over two lines rather than just 1}
\section{short title in only 1 line}
\end{subappendices}
\chapter{some other chapter}
\subappendix{short title in only 1 line}
\subappendix{much longer title that will be displayed over two lines rather than just 1}
\subappendix{short title in only 1 line}
\end{document}
결과: