![任意位置连字符](https://linux22.com/image/321690/%E4%BB%BB%E6%84%8F%E4%BD%8D%E7%BD%AE%E8%BF%9E%E5%AD%97%E7%AC%A6.png)
是否有一种(简单的)方法允许在任何单词的任何位置使用连字符?
答案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}