如果有人能教我如何在目錄中的章節編號後面得到一個點,那就太好了。我使用 titletoc 套件。
此外,我還有兩個關於縮排的問題。我怎麼能在章節標題後的第一行得到一個?我如何(全域)定義兩個段落之間的空格(而不丟失縮排)?
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{titlesec}
\titleformat{\section}{\large\scshape}{\thesection.}{0.5em}{}
\usepackage{titletoc}
\titlecontents{section}[1.5em]{\large}{\contentslabel{1.5em}}{\hspace*{-1.5em}}{\titlerule*[1pc]{.}\contentspage}[\vspace*{0.3em}]
\begin{document}
\renewcommand\contentsname{\normalfont\large\textsc{Contents}}
\tableofcontents
\section{The first section}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,
consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,
consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
\section{The second section}
\end{document}
答案1
在這裡:您必須使用 \contentslabel 的可選參數。請注意,您不需要重新 dsefine \contentsname
。
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[indentafter]{titlesec}
\titleformat{\section}{\large\scshape}{\thesection.}{0.5em}{}
\usepackage{titletoc}
\titlecontents{section}[1.5em]{\large}{\contentslabel[\thecontentslabel.]{1.5em}}{\hspace*{-1.5em}}{\titlerule*[1pc]{.}\contentspage}[\vspace*{0.3em}]
\begin{document}
{\titleformat*{\section}{\centering\large\scshape}\tableofcontents}
\section{The first section}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,
consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,
consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
\section{The second section}
\end{document}