附录标题与目录不一致

附录标题与目录不一致

我对目录中附录标题的放置有问题。我使用带有 titletoc 选项的 appendix 包。以下代码

\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}  

结果:

在此处输入图片描述

相关内容