任意位置连字符

任意位置连字符

是否有一种(简单的)方法允许在任何单词的任何位置使用连字符?

答案1

xelatex很容易做到。

\documentclass[a4paper]{article}
\usepackage{geometry}
\usepackage{kantlipsum}
\usepackage{multicol}
\begin{document}\thispagestyle{empty}
% "texdoc xetex" for Xe(La)TeX reference manual
\XeTeXinterchartokenstate 1
\XeTeXinterchartoks 0 0 = {\-}
\begin{multicols}{5}
  \kant[42]
\end{multicols}

\end{document}

到处都是连字符

相比之下,不使用的输出为\XeTeXinterchartoks

标准连字

也许你甚至不想要-'s。那么可以使用以下命令:

\documentclass[a4paper]{article}
\usepackage{geometry}
\usepackage{kantlipsum}
\usepackage{multicol}
\begin{document}\thispagestyle{empty}
% "texdoc xetex" for Xe(La)TeX reference manual
{% temporarily enable hyphenation everywhere at no cost
\XeTeXinterchartokenstate 1
\XeTeXinterchartoks 0 0 = {\discretionary{}{}{}}
\exhyphenpenalty 0
\begin{multicols}{5}
  \kant[42]
\end{multicols}
}

% back to normal
\end{document}

没有连字符

或者您可能更喜欢-坚持正确的边距:

\documentclass[a4paper]{article}
\usepackage{geometry}
\usepackage{kantlipsum}
\usepackage{multicol}
\begin{document}\thispagestyle{empty}
% "texdoc xetex" for Xe(La)TeX reference manual
{% temporarily enable breaking everywhere
\XeTeXinterchartokenstate 1
\XeTeXinterchartoks 0 0 = {\discretionary{\rlap{-}}{}{}}
\exhyphenpenalty 0
\hyphenpenalty   0
\begin{multicols}{5}
  \kant[42]
\end{multicols}
}

% back to normal
\end{document}

边缘带有连字符

相关内容