似乎 Latex 在标题本身和目录中非常长的单字(子)节标题的正确连字符方面存在问题。使用以下 MWE:
\documentclass[12pt]{scrartcl}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\usepackage[ngerman]{babel}
\usepackage[left=2.5cm,right=2.5cm,
top=2.5cm,bottom=2.5cm]
{geometry}
\usepackage{sectsty,ragged2e}
\allsectionsfont{\RaggedRight}
\begin{document}
\tableofcontents
\section{Section}
\subsection{(5\textit{R},6\textit{E},8\textit{E})-5-[(2-methoxyethoxy)methoxy]-\textit{N}-methoxy-\textit{N}-methyldeca-6,8-dienamid}
\end{document}
我最终在目录中得到了过满的水平盒子以及小节标题。
有什么办法可以避免这种混乱吗?
答案1
\iupac
在以下命令的帮助下chemmacros
:
(红线表示边缘。)
\documentclass[12pt]{scrartcl}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\usepackage[ngerman]{babel}
\usepackage[left=2.5cm,right=2.5cm,
top=2.5cm,bottom=2.5cm]
{geometry}
\usepackage{sectsty,ragged2e}
\allsectionsfont{\RaggedRight}
\usepackage{chemmacros}
\begin{document}
\tableofcontents
\section{Sectionn}
\subsection{\iupac{\cip{5R,6E,8E}-5-[(2-methoxyethoxy)methoxy]-\N-methoxy-\N-methyldeca-6,8-di|enamid}}
\end{document}
答案2
polish.sty
规则!
\documentclass[12pt]{scrartcl}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\usepackage[ngerman]{babel}
\usepackage[left=2.5cm,right=2.5cm,
top=2.5cm,bottom=2.5cm]
{geometry}
\usepackage{sectsty,ragged2e}
\usepackage{polski}
\allsectionsfont{\RaggedRight}
\begin{document}
\overfullrule5pt
\tableofcontents
\section{Section}
\subsection{(5\textit{R},6\textit{E},8\textit{E})-5-[(2-methoxyethoxy)methoxy]-\textit{N}-methoxy-\textit{N}-methyldeca-6,8-dienamid}
And the solution:
\subsection{(5\textit{R},6\textit{E},8\textit{E})\dywiz5\dywiz[(2\dywiz{}methoxyethoxy)methoxy]\dywiz\textit{N}\dywiz{}methoxy\dywiz\textit{N}\dywiz{}methyldeca\dywiz6,8\dywiz{}dienamid}
\end{document}
说实话,只要\dywiz
从中提取就足够了polish.sty
,定义为
\def\dywiz{\kern0sp\discretionary{-}{-}{-}\penalty10000\hskip0sp\relax}
。