
I frequently get to typeset texts where -- due to a specific philological convention -- shorter parts of the words are emphasised. As far as I understand the mechanism the start/end of the \emph
-tags are considered word-boundaries, resulting in some correctly hyphenated words but far too few.
\documentclass[12pt]{article}
%\usepackage[english]{babel}
%\usepackage{polyglossia}
%\setdefaultlanguage{english}
\begin{document}
\parbox{.7cm}{
some hyphenati\emph{o}n
}
\hspace{2cm}\parbox{.7cm}{
some hyphenat\emph{i}on
}
\hspace{2cm}\parbox{.7cm}{
some h\emph{y}phenation
}
\hspace{2cm}\parbox{.7cm}{
some h\emph{y}phe\emph{n}ation
}
\end{document}
I am looking for a way to have LaTeX ignore the emphasis and consider the words as wholes when determining the hyphenations.
답변1
While \textit{...}
and \emph{...}
insert italic corrections (a type of "implicit kern", in TeX jargon, which impedes hyphenation), {\itshape ...}
does not. Hence, \itshape
does not, per se, impede hyphenation.
If you can use LuaLaTeX and are willing to use \itshape
to provide emphasis (and, in the process, accept a lack of italic correction of the in-word emphasized material), you can get these words hyphenated after all.
An MWE -- observe that all permissible hyphenation points are "found" in each instance:
% !TEX TS-program = lualatex
\documentclass[12pt]{article}
\usepackage{showhyphens} % a LuaLaTeX-only package
\hyphenation{hy-phen-a-tion} % indicate all 3 permissible hyphenation points
\setlength\parindent{0pt}
\setlength\textwidth{0.1mm}
\begin{document}
\obeylines
hyphenati{\itshape o}n
hyphenat{\itshape i}on
h{\itshape y}phenation
h{\itshape y}phe{\itshape n}ation
\end{document}