请看下面我的目录图。您可以看到小节 1.1.1 和小节 1.1.2 存在对齐问题。小节 1.1.1 的相应页码超出了右侧文本限制,并且小节 1.1.2 的右侧文本也超出了页面限制。
我必须提到,\iupac{TEXT-HERE}
这里使用了 IPAC 命名法(也用于 1.1.1 和 1.1.2 的子小节标题),以支持正确的连字符。以下是可用于重建此问题的最小代码示例。
% Preview source code
%% LyX 2.3.6 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,english]{article}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=3cm,rmargin=2.5cm}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage{setspace}
\onehalfspacing
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
% --------- use tocloft package to format listings --------
\usepackage{tocloft}
\renewcommand{\@cftmaketoctitle}{} % remove automatically generated toc heading
% ---------------------------------------------------------
\usepackage{chemmacros} % e.g. to support hyphenation for chemical names
\makeatother
\usepackage{babel}
\begin{document}
\section*{Table of Contents}
\addcontentsline{toc}{section}{Table of Contents}
\tableofcontents{}
\section{Section 1}
\subsection{Subsection 1}
\subsubsection{\iupac{0,0'-((0-Loremipsumdol)Loremipsu)lor(0-(lore-lorem)-0-loremipsumdo)}
(00)}
\subsubsection{\iupac{0,0-Lo-lore-lorem-0-loremip-00-(0-loremipsumdol)-0,00-loremips-00L-loremmm[a,a][0,0,0]loremipsumloremi 0-lorem}
(00)}
\subsection{Subsection 2}
\subsubsection{Subsubsection}
\end{document}
我该怎么做,才能使 1.1.1 和 1.1.2 符合我的目录中的文本限制?
答案1
你可以将目录标题设置为参差不齐
我仅添加了一行来添加填充胶,如标记
% Preview source code
%% LyX 2.3.6 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,english]{article}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=3cm,rmargin=2.5cm}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage{setspace}
\onehalfspacing
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
% --------- use tocloft package to format listings --------
\usepackage{tocloft}
\renewcommand{\@cftmaketoctitle}{} % remove automatically generated toc heading
% ---------------------------------------------------------
\usepackage{chemmacros} % e.g. to support hyphenation for chemical names
\edef\@tocrmarg{\@tocrmarg plus 2 cm}%<<<<<<<<<<<<<<<<<<<<<<
\makeatother
\usepackage{babel}
\begin{document}
\section*{Table of Contents}
\addcontentsline{toc}{section}{Table of Contents}
\tableofcontents{}
\section{Section 1}
\subsection{Subsection 1}
\subsubsection{\iupac{0,0'-((0-Loremipsumdol)Loremipsu)lor(0-(lore-lorem)-0-loremipsumdo)}
(00)}
\subsubsection{\iupac{0,0-Lo-lore-lorem-0-loremip-00-(0-loremipsumdol)-0,00-loremips-00L-loremmm[a,a][0,0,0]loremipsumloremi 0-lorem}
(00)}
\subsection{Subsection 2}
\subsubsection{Subsubsection}
\end{document}