继续我的这个问题(使用 titlesec 增加章节标题的边距),我想以类似的方式配置我的目录,主要是用稍大的字体替换章节标题的粗体字体,并删除虚线。MWE:
\documentclass{article}
\usepackage{titletoc}
\titlecontents{section}
[0pt]
{}
{\Large\thecontentslabel\enspace}
{}
{\hfill\contentspage}
[]
\begin{document}
\tableofcontents
\section{This is another long long long long long long section name}
\end{document}
目标是进入 ToC:
1. This is another long long long long
long long section name
代替:
1. This is another long long long long long long sec-
tion name
因此没有连字符和指定的长度。这是为了防止我的文档中出现类似情况。包文档对我来说不是很清楚。该命令\contentsmargin{2.5cm}
确实以我需要的方式操作右边距,但它也导致一些页码放错位置。
答案1
更新无需连字符,只需调整左右“边距”即可获得较窄的章节标题。
\documentclass{article}
\usepackage{titletoc}
\titlecontents{section}%
[0mm]%
{\Large\raggedright}% no hyphenation
{\contentspush{\makebox[75mm][l]{\thecontentslabel.} \hspace{-45mm}}}% use the makebox width and the \hspace to set the title
{}%
{\contentsmargin{25mm}\hfill\contentspage}%
[\vspace{3ex}]
\begin{document}
\tableofcontents
\newpage
\section{As any dedicated reader can clearly see, the Ideal of
practical reason is a representation of the things
in themselves.}
\section{IntroductionIntroduction IntroductionIntroductionI}
\end{document}
尝试一下这个代码。
\documentclass{article}
\usepackage{titletoc}
\titlecontents{section}% <section-type>
[2.3em]% align left
{\Large}% <above-code> Larger font <<<<<<<<<<<
{\hspace*{-1.5em}\makebox[1.5em][l]{\thecontentslabel.}}% <numbered-entry-format>
{}% <numberless-entry-format>
{\hfill\contentspage}% <filler+ page-format>
[\vspace{2ex}]
\begin{document}
\tableofcontents
\newpage
\section{As any dedicated reader can clearly see, the Ideal of
practical reason is a representation of the things
in themselves.}
\section{IntroductionIntroduction IntroductionIntroductionI}
\end{document}