我试图阻止包含下划线的单词被连字符连接。
我努力了:
\hyphenation{Word\textunderscore With\textunderscore Underscore}
\begin{document}
\end{document}
Improper \hyphenation will be flushed.
\PD1-cmd ...\TextSymbolUnavailable #1}\fi \global
\expandafter \let \csname ...
l.50 \hyphenation{Word\textunderscore
With\textunderscore Underscore}
和
\usepackage{underscore}
\hyphenation{Word_With_Underscore}
\begin{document}
\end{document}
Improper \hyphenation will be flushed. l.50 \hyphenation{Word_
With_Underscore}
答案1
包的underscore
作用正好相反,它尝试允许在下划线之前和之后使用连字符。\BreakableUnderscore
可以通过修改原始定义来重新定义该宏:
\documentclass{article}
\usepackage{underscore}
\makeatletter
% Redefine to an unbreakable underscore
\renewcommand*{\BreakableUnderscore}{%
\leavevmode
\null % prevent hyphenation before the underscore
% \nobreak
% \hskip\z@skip
\ifx\f@family\ttdefault
\string_%
\else
\textunderscore
\fi
% \usc@dischyph\nobreak\hskip\z@skip
}
\makeatother
\begin{document}
\parbox{0pt}{%
\hspace{0pt}document_document
}
\end{document}