我想将目录中的章节编号(后面跟着一个点)对齐,如图所示。有什么帮助吗?谢谢……
\documentclass[9pt,a4paper, portrait]{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{amsmath}
\usepackage{wrapfig}
\usepackage{enumitem}
\usepackage{enumerate}
\usepackage{geometry}
\usepackage{wrapfig}
\geometry{left=2.5cm,right=2.5cm,top=3cm,bottom=2cm}
\usepackage{verbatim}
\usepackage{caption}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\graphicspath{images/}
\usepackage{tasks}
\usepackage{eurosym}
\usepackage{lipsum}
\usepackage{secdot}
\sectiondot{subsection}
\sectiondot{subsubsection}
\usepackage{multicol}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\usepackage{enumitem}
\renewcommand{\baselinestretch}{1.2}
\rfoot{\thepage}
\begin{document}
\decimalpoint
\renewcommand{\contentsname}{ÍNDICE}
\tableofcontents
\thispagestyle{empty}
\numberwithin{equation}{section}
\pagebreak{}
\setcounter{page}{1}
\setlength{\parskip}{1.5mm}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\end{document}
答案1
titletoc
您可以通过包裹(附带)获得它titlesec
。
无关:基本 LaTeX 类除了 之外没有其他字体大小选项10,11 or 12pt
。对于 9pt,您应该使用包extarticle
中的 类extsizes
。此外,不要加载 nothenumerate
和enumitem
,因为它们都处理列表参数。最后,最好使用文档类加载 babel 语言选项,以便所有依赖语言的包都得到通知。
\documentclass[9pt, a4paper, spanish]{extarticle}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{amsmath}
\usepackage{wrapfig}
\usepackage{enumitem}
\usepackage{geometry}
\usepackage{wrapfig}
\geometry{hmargin=2.5cm,top=3cm,bottom=2cm, showframe}
\usepackage{verbatim}
\usepackage{caption}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\graphicspath{images/}
\usepackage{tasks}
\usepackage{eurosym}
\usepackage{lipsum}
\usepackage{secdot}
\sectiondot{subsection}
\sectiondot{subsubsection}
\usepackage{multicol}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\usepackage{enumitem}
\renewcommand{\baselinestretch}{1.2}
\rfoot{\thepage}
\usepackage{titletoc}
\titlecontents{section} [1.33em]
{\medskip\mdseries}
{\contentslabel[\hfill\thecontentslabel.]{1.33em}\quad}
{}
{\hfill\thecontentspage}
\begin{document}
\decimalpoint
\renewcommand{\contentsname}{ÍNDICE}
\tableofcontents
\thispagestyle{empty}
\numberwithin{equation}{section}
\pagebreak{}
\setcounter{page}{1}
\setlength{\parskip}{1.5mm}
\section{Test1}
\lipsum
\section{Test1}
\lipsum
\section{Test1}
\lipsum
\section{Test1}
\lipsum
\section{Test1}
\lipsum
\section{Test1}
\lipsum
\section{Test1}
\lipsum
\section{Test1}
\lipsum
\section{Test1}
\lipsum
\section{Test1}
\lipsum
\section{Test1}
\lipsum
\section{Test1}
\section{Test1}
\lipsum
\section{Test1}
\lipsum
\section{Test1}
\end{document}
答案2
tocloft
设置框内的 ToC 条目编号,您可以操作其中的每个组件 -\cftXpresnum
已设置前设置ectional s
bernum
时。以下是设置条目的伪代码视图:\cftXaftersnum
after
在上面的伪代码中,X
代表分段单元:
sec
为了\section
,subsec
为了\subsection
,- ETC。
\documentclass{article}
\usepackage{tocloft}
\renewcommand{\cftsecpresnum}{\hfill}% Right-align
\renewcommand{\cftsecaftersnum}[1]{}% Remove \hfil after number
\renewcommand{\cftsecaftersnumb}{\hspace{1em}}% Space between number and section title
\makeatletter
\settowidth{\@tempdima}{\bfseries\large\hspace{1em}}
\addtolength{\cftsubsecindent}{\@tempdima}% Ensure horizontal alignment of \subsection
\makeatother
\begin{document}
\tableofcontents
\section{Test1}
\subsection{Test2}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\section{Test1}
\end{document}