Los títulos de los apéndices no están alineados en el TOC

Los títulos de los apéndices no están alineados en el TOC

Tengo un problema con la ubicación de los títulos del Apéndice en el TOC. Utilizo el paquete del apéndice con la opción titletoc. El siguiente código

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

produce el siguiente TOC:

ingrese la descripción de la imagen aquí

Como puede ver, 1.A, 1.B y 1.C no están alineados (posiblemente debido a la palabra "separable" que es demasiado larga. Suceden cosas similares con el segundo bloque, donde 2.B no está alineado.

¿Cómo puedo solucionar este problema además de cambiar los títulos?

Respuesta1

Aquí hay una sugerencia sin paquete appendix.

El comando de sección \sectionestá scrreprtdeclarado como

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

Puede declarar un nuevo comando de sección en el mismo nivel \sectionpero con un archivo 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}  

Resultado:

ingrese la descripción de la imagen aquí

información relacionada