![使用 titletoc 在目录条目内悬挂缩进?](https://linux22.com/image/324170/%E4%BD%BF%E7%94%A8%20titletoc%20%E5%9C%A8%E7%9B%AE%E5%BD%95%E6%9D%A1%E7%9B%AE%E5%86%85%E6%82%AC%E6%8C%82%E7%BC%A9%E8%BF%9B%EF%BC%9F.png)
有没有办法用 titletoc 为每个目录条目的第二行和后续行添加水平空间,无论条目的标题是否换行到第二行(如下面第一部分所示)或标题是否有手动换行符(如第二部分所示)?在此示例中,空格位于“QUAE”和“EX”之前。
\documentclass[12pt]{article}
\usepackage{titletoc}
\begin{document}
\tableofcontents
\section{CONTEXTUS ORATIONIS ALIQUOT ALCUINI OPERUM QUAE EXIMIA SELECTA SUNT}
Some text
\section{SUPPLEMENTUM B:\\ EX ALCUINI EPISTULA AD CAROLUM MAGNUM}
Some text
\end{document}
答案1
也许您已经想到了命令above-code
的一部分?例如,\titlecontents
您可以使用。\hangindent1em
\documentclass[12pt]{article}
\usepackage{titletoc}
% According to the manual, this approximates the settings for \section
% in the book class ... except for the "\hangindent1em"
\titlecontents{section}
[3.8em] % ie, 1.5em (chapter) + 2.3em
{\hangindent1em}
{\contentslabel{2.3em}}
{\hspace*{-2.3em}}
{\titlerule*[1pc]{.}\contentspage}
\begin{document}
\tableofcontents
\section{CONTEXTUS ORATIONIS ALIQUOT ALCUINI OPERUM QUAE EXIMIA SELECTA SUNT}
Some text
\section{SUPPLEMENTUM B:\\ EX ALCUINI EPISTULA AD CAROLUM MAGNUM}
Some text
\setcounter{secnumdepth}{0}
\section{SUPPLEMENTUM B:\\ EX BEZOS DOCUMENTO AD LECTOREM CANDIDUM ET BENEVOLUM}
Some text
\end{document}