5

My first exposure to LaTeX was back in 2014 from this tutorial and I settled with the pdfTeX engine because it was the only thing I knew and I was a total novice.
Lately, I started reading Tobias Oetiker's The Not So Short Introduction To LaTeX from CTAN and realized that I have been unaware of the existence of so many things such as the polyglossia package as well as XeTeX and LuaTeX.

I am very curious about these two new engines and started browsing this site to know more. From my understanding, these two support natively UTF-8 encodings but I usually typeset documents in English and in Malagasy. Thus, ASCII characters are more than enough for my everyday use. Apart from the everyday use, I also plan to use LaTeX to typeset my thesis (in English) for my final year.

All that context being said, I am curious to know if there should be a reason for me to start using either of these two engines or wether pdfTeX is amply sufficient for my indented use and if I should just stick with it.

12
  • 2
    An old post, but relevant: tex.stackexchange.com/q/70
    – Thérèse
    Commented Jun 8, 2020 at 20:00
  • 6
    for xetex it's just about the fonts really, whether you want to use the same system fonts as you would use in a browser or word processor etc. For luatex there is that plus whether you want to use the embedded Lua scripting. No one can tell you the answer to either really. Commented Jun 8, 2020 at 20:30
  • 2
    If you are merely writing documents in only the English language and there are only very few or no accented characters at all and you are happy with the default font, then there is no real reason to use LuaTeX or XeTeX. Commented Jun 8, 2020 at 22:38
  • 2
    For your goals (default font, english) switch to xelatex/lualatex could mean in practice avoid some errors due to copy & paste some utf8 characters even if you see only plain text, i.e, in theory, this simple document: \documentclass{article}\begin{document}a​b\end{document} should compile with pdflatex, but in practice will produce a nice fatal error because the text is not "ab", but "a+<U+200B>+b". But on the other hand, switch mean also be prepared for some minor non-equivalences (e.g: some features of microtype package).
    – Fran
    Commented Jun 9, 2020 at 3:13
  • 1
    Your follow-up question about U+200B has been asked several times over the years, but it’s never gotten an answer I liked. So, I finally wrote my own.
    – Davislor
    Commented Jun 11, 2020 at 9:47

3 Answers 3

7

Some of the advantages include:

  • Being able to use unicode-math and copy, paste and search for math symbols
  • Not being limited to sixteen math alphabets
  • Not having to juggle 8-bit, or even 7-bit, text encodings
  • Being able to type symbols into your source code and have them work without a lot of set-up to declare them active
  • You can use any font on your machine without a complicated conversion to Type 1 format
  • Certain LaTeX3 interfaces only function properly if the engine supports Unicode natively
  • Even in English, you will often use non-ASCII characters, such as opening and curling quotes, dashes, ligatures and the occasional accent. You could theoretically make these copyable and searchable in PDFLaTeX with the mmap or cmap package. But I never see anyone do that, and I’ve frequently seen papers with typos like “di cult” because someone used a font with no ffi ligature.
  • You can use the extensions of the engines, such as XDV output (useful for document conversion) and Lua scripting.

A major application of this is accessibility. If a reader can identify a symbol, it can pronounce it for a visually-impaired user, as well as being able to convert it to another format.

12
  • I think the fact the Unicode doesn't support super- and subscripts severely limits the usefulness of “being able to copy, paste and search for math symbols”. Also, there is no 7-bit TeX engine in use in the wild anymore, at least to my knowledge. Commented Jun 8, 2020 at 22:34
  • @HenriMenke But there are still many documents using OT1/OMS. You can use realscripts or something like that to get many Unicode superscripts, but a major application of being readable as Unicode is accessibility. If a reader can recognize a symbol, it can pronounce it for a visually-impaired user.
    – Davislor
    Commented Jun 8, 2020 at 22:50
  • Unicode only supports very few “inferiors” and “superiors” (most fonts only have numbers), so complex super- and subscripts, like G_{\mathbb{R}} will be mapped in the same way as G \mathbb{R}. Commented Jun 8, 2020 at 22:59
  • @HenriMenke This is true. For many purposes, that’s still beneficial. A PDF-to-speech app would pronounce that something like “O-Reals,” which a visually-impaired student could probably interpret in context.
    – Davislor
    Commented Jun 9, 2020 at 0:56
  • @Davislor -- "G-Reals" sounds like a very good idea. Do you know of any application(s) where the work has been done to make this a reality? Commented Jun 9, 2020 at 20:02
2

To answer to how get rid the U+200B character using pdflatex:

The 'ZERO WIDTH SPACE' (U+200B) as the name suggest, is a space without space, but you can note that the character is there because you need press the cursor key twice to pass to the next/previous character.

This causes problems because pdflatex does not know what to do with that, unlike xelatex and lualatex.

To clean it you can use any text tool able to and search and replace this character in all the docuemnt. Only as example, Texworks or Gummi in Linux allow type the character with:

Ctrl+Shift+u200BEnter

Then, you can copy and paste in the search tool and replace with nothing some other character to see where it was. If you have problem with this, other solution is tell to pdflatex what to do. Consider this example:

\documentclass{article}
\usepackage{xcolor}
\DeclareUnicodeCharacter{200B}{ \colorbox{yellow}{\sffamily\bfseries u+200B}
\typeout{}\typeout{WARNING: Bad character U+200B in the line \the\inputlineno}\typeout{}}
\begin{document}
a​b

cd

e​f

asasa
\end{document}

This will show these warnings in the log file:

WARNING: Bad character U+200B in the line 6

WARNING: Bad character U+200B in the line 10

And the PDF will show also where they are:

mwe

But probably is better leave it as it really is, and forget it:

\DeclareUnicodeCharacter{200B}{\hspace{0pt}} 
0

This is an already closed topic, but I want to add a practical example. Several years ago, I wanted to use LaTeX to write a CV through modercv class. But added some hck to improve the machine readibility of the documents by those Applicant Tracking Systems softwares, that strip all your formatting, and keeps the text. The ligatures from LaTeX sometimes kills this conversion. And I was using some icons on my CV that were also creating issues. Switching from pdflatex to lualatex solved many of these issues. Most of the stuff is documented on this old post How to improve machine-readability of a CV created in LaTeX with moderncv?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .