I want to write LaTeX where the main body of text is in Hebrew. The example here works fine. In fact, this is the only way I managed writing in Hebrew so far.
If I want the source code to present nicely in my editor (emacs 27), I need to use bidirectional unicode characters (such as LEFT-TO-RIGHT ISOLATE (u+2066)), which gives the error:
ERROR: Package ucs Error: Unknown Unicode character 8294 = U+2066
In order to deal with this, I thought about using newunicodechar to replace the bidirectional unicode with nothing when compiling the document.
The problem is that newunicodechar only works with \usepackage[utf8]{inputenc} and not with \usepackage[utf8x]{inputenc}, and Hebrew only works with \usepackage[utf8x]{inputenc} and not with \usepackage[utf8]{inputenc}.
How can I write in Hebrew and still have the special unicode characters in my file?
(I am using latexmk version 4.67.)
utf8xreally apart from some legacy compatibiliy uses, and no reason to explicily load inputnc at all as uf8 is the default – David Carlisle Mar 27 '22 at 11:31\DeclareUnicodeCharacter{2066}{}without needing any package. – David Carlisle Mar 27 '22 at 11:32\usepackage[utf8x]{inputenc}, I getERROR: Package inputenc Error: Keyboard character used is undefined, and if I replace it with\usepackage[utf8]{inputenc}, the Hebrew text simply does not render. – Erran Mar 27 '22 at 11:35\usepackage[utf8]{inputenc}will do nothing unless you have very old latex as it is the default. – David Carlisle Mar 27 '22 at 11:39\DeclareUnicodeCharacter{2066}{}(actually\DeclareUnicodeCharacter{8294}{}worked for ignoring the character. – Erran Mar 27 '22 at 11:42texdoc babelhas this example which works with lualatex)\documentclass{article} \usepackage[swedish, bidi=default]{babel} \babelprovide[import]{hebrew} \babelfont{rm}{FreeSerif} \begin{document} Svenska \foreignlanguage{hebrew}{ } ִעבְ ִריתsvenska. \end{document}– David Carlisle Mar 27 '22 at 11:45DeclareUnicodeCharacterpart is what I was looking for. More generally there is still a lot I don't understand regarding usage of hebrew in latex, but I thing going over the links in this thread should help me to start understanding it. – Erran Mar 27 '22 at 12:14