为什么 \lefthyphenmin 有时会逃离其包含的组?

为什么 \lefthyphenmin 有时会逃离其包含的组?

在下面的例子中,subsequently前两种情况以及第四种情况中都使用连字符,但第三种情况中没有使用连字符。

\documentclass{article}

\usepackage{fontspec}
\begin{document}

\begin{itemize}
\item \texttt{Lorem ipsum dolor sit amet, consectetur adipiscing} elit subsequently.
\item \texttt{\lefthyphenmin=62 Lorem ipsum dolor sit amet, consectetur adipiscing} elit subsequently.
\item {\ttfamily\lefthyphenmin=62 Lorem ipsum dolor sit amet, consectetur adipiscing} elit subsequently.
\item {\ttfamily Lorem ipsum dolor sit amet, consectetur adipiscing} elit subsequently.
\end{itemize}
\end{document}

第三行有什么不同?\showthe\lefthyphenmin第三行中的使用表明它在分组后已正确恢复为 2 \ttfamily,因此一定是其他东西;但是什么呢?

答案1

不同之处在于设置是水平还是垂直模式,即在段落之前还是段落内,比较下面的第 3 和第 4 个版本。我稍微调整了示例,以便可以使用 pdftex 或 xetex。

在此处输入图片描述

\documentclass{article}
\advance\textwidth-15pt
%\usepackage{fontspec}
\begin{document}

\begin{itemize}
\item \texttt{Lorem ipsum dolor sit amet, consectetur adipiscing} elit subsequently.
\item \texttt{\lefthyphenmin=62 Lorem ipsum dolor sit amet, consectetur adipiscing} elit subsequently.
\item {\ttfamily\lefthyphenmin=62 Lorem ipsum dolor sit amet, consectetur adipiscing} elit subsequently.
\item \leavevmode{\ttfamily\lefthyphenmin=62 Lorem ipsum dolor sit amet, consectetur adipiscing} elit subsequently.
\item {\ttfamily Lorem ipsum dolor sit amet, consectetur adipiscing} elit subsequently.
\end{itemize}
\end{document}

相关内容