0

My subsection title continues in the 2nd line with an indent in the beginning. I want it to be aligned with the first line of the subsection title. Any suggestions?

Solution should not contain \usepackage{tocloft} since this interferes with previous settings

\documentclass[11pt,a4paper,doc,donotrepeattitle]{apa6}
\begin{document}

 \renewcommand*\contentsname{Table of Contents}
 \tableofcontents

 \section{Title}
 \subsection{Long title that spans over two lines}

\end{document}

2 Answers 2

1

According to ToC: How to no-indent the second line of large entries? :

\documentclass[11pt,a4paper,doc]{article}

\usepackage{tocloft}
\renewcommand*\contentsname{Table of Contents}
\setlength{\cftsubsecnumwidth}{0pt}
\renewcommand{\cftsubsecaftersnumb}{\hspace{1.5em}}

\begin{document}

 \tableofcontents

 \section{Title}
 \subsection{Long title that spans over two lines Long title that spans over two lines}

\end{document}
4
  • This works, however I do not want the title of the TOC to be left aligned, which happens if using this command. Is there any other possibility to change it only for the content of toc and not the title?
    – Peter
    Aug 14, 2018 at 13:39
  • Can't you use this trick : tex.stackexchange.com/questions/142445/… ?
    – tobiasBora
    Aug 14, 2018 at 13:59
  • since titles are already centered, because of the apa6 document class, i am searching for a solution which does not interfere with my previous settings. Thanks though for the suggestion!
    – Peter
    Aug 14, 2018 at 14:16
  • Ok, sorry I don't know the apa6 document class, and I don't manage to compile your MWE on my distribution because I get an error ERROR: Undefined control sequence. <argument> \@shorttitle ... Sorry
    – tobiasBora
    Aug 14, 2018 at 17:22
0
\makeatletter
 \renewcommand*\l@section[2]{%
   \ifnum \c@tocdepth >\z@
   \addpenalty\@secpenalty
   \addvspace{1.0em \@plus\p@}%
   \setlength\@tempdima{0em}%
   \begingroup
    \parindent \z@ \rightskip \@pnumwidth
    \parfillskip -\@pnumwidth
    \leavevmode \bfseries
    \advance\leftskip\@tempdima
     \hskip -\leftskip
     #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
     \endgroup
    \fi}
   \renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{0em}}
   \renewcommand*\l@subsubsection{\@dottedtocline{3}{3.8em}{0em}}
   \makeatother

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .