I'm working with a document in English and Hebrew (using polyglossia
), and am trying to add hyphenation in Hebrew wherever a hyphen might be. Based on other questions/answers on this site, I have tried to use hyphenat
to replace all my hyphens in Hebrew that I would like to be hyphenatable with \hyp{}
, but it refuses to hyphenate. See the minimal example below. Manually adding hyphenation rules for individual words is impractical, as I will will have thousands of words to input. Is there a way of forcing LaTeX to allow hyphenation even on the Hebrew side whenever it sees \hyp{}
(or even better, an arbitrary character, for example the Hebrew version of the hyphen, U+05BE ־)?
\documentclass[10pt]{book}
\usepackage{polyglossia,hyphenat}
\setdefaultlanguage{english}
\setotherlanguages{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Arial Unicode MS}
\newcommand{\h}[1]{\RL{\texthebrew{#1}\hfil}}
\newcommand{\hangparagentry}{\hangindent-0.5em \hangafter1 \leftskip 0.8em \parindent -0.5em}
\DeclareDocumentCommand{\entry}{ m o m }{\noindent\hangparagentry{\hspace{-.5em}\textbf{#1}\hspace{0.5cm}\hfill \h{#3\IfNoValueF{#2}{ \textenglish{\scriptsize{#2}}}}}\par}
\begin{document}
\flushright
\entry{earthquake meter earthquake meter earthquake meter}{דער ע֜רד\hyp{}צי֜טערניש\hyp{}מע֜סטער, \hyp{}ס}
\end{document}
\-
should work\newcommand\hyp{\discretionary{<maqqaf>}{}{}}
(where<maqqaf>
is code to produce the glyph; sorry, but I know nothing about Hebrew or Yiddish). Leave a space after\hyp
, not{}
.hyphenat
. Also\hfill
in the definition of\entry
is responsible for missing hyphenation: this picture shows what I get when I change it to a simple space