24

Is there any pros and cons for using of Unicode (and vice versa) in LaTeX equations?

Consider two examples:

\lim_{h→0}∫_{x_0}^{x_0 + h}\frac{f(t)}{h} = f(x_0)

x_0 ⇔ ∀ 𝜀 > 0, ∃ 𝛿 > 0,(|x-x_0| < 𝛿 ⇒ |f(x)-f(x_0)| < 𝜀)

And without Unicode:

\lim\limits_{h \to 0}\int\limits_{x_0}^{x_0+h}\frac{f(t)}{h}=f(x_0)

x_0 \Leftrightarrow \forall\epsilon > 0, \exists\delta>0,(|x-x_0|<\delta \Rightarrow |f(x)-f(x_0)|<\epsilon)

With latest XeLaTeX the result is the same, so!, what's better?

  • 2
    See some discussion here Is there a way to use unicode-math in a more limited fashion and also some of the discussion in this recent chat session: Why use LaTeX instead of Word. – Alan Munn Dec 16 '12 at 20:35
  • 6
    Probably ε (U+03B5, GREEK SMALL LETTER EPSILON) should really be 𝜀 (U+1D700, MATHEMATICAL ITALIC SMALL EPSILON). – egreg Dec 16 '12 at 20:40
  • 3
    I'm pretty sure this would raise portability issues beside the obnoxiousness of a (virtual) unicode keyboard... something Word tries hard to emulate with the effect of giving me the creeps... – Count Zero Dec 16 '12 at 20:41
  • Sorry for the question, but how do you input unicode characters fast? Do you look for it in a table? This is not fast, I think. If not, which is the usual method used? – Manuel Dec 17 '12 at 14:03
  • 1
    @Manuel: I'm using XCompose in Linux with this config. – m0nhawk Dec 17 '12 at 15:28
28

The pros and cons are pretty much the same as they ever were. Old timers like myself have a built in familiarity with ascii based markup, but I suspect that this will seem increasingly anachronistic as we move further in to the 21st century. Web based tools (and as Count Zero noted) Word processing systems and increasingly command line shells of common operating systems have a natural Unicode handling, and I suspect newer users will find it harder to accept restricting to an ascii character set.

There was a time that the general feeling was that people should use \"{o} or \'e markup "for portability and ease of editing tools" rather than use ö or é but now I suspect that more or less anyone writing non English documents uses [latin1] or [utf8] with inputenc or uses xelatex or luatex and native Unicode input.

Despite the above, there are some advantages to using markup over direct character input, other than just familiarity for people who grew up using punched cards. One example that it is much easier to check that various document norms and conventions are upheld. For example if you want a particular arrow style it's probably easier (by eye) to spot (say) \longrightarrow than to recognise the multitude of different Unicode arrows. Also it depends on your tools, but for most of the tools I have it is still quicker and easier to type \longrightarrow than . But note that editing tools can completely lose the distinction, allowing you to type \longrightarrow but entering which is one reason why I suspect, as noted above that Unicode in files will become the norm.

  • 6
    I would like to add an additional comment on using ö and ä instead of \"{o} and \"{a}: Non-QUERTY keyboards, having to accommodate all the accented characters that they do, have important TeX characters like {} and \ in comparatively inconvenient places, usually requiring the use of the AltGR key and the like. This can't be helped, really, but I'd rather not use three hard-to-reach keys when one (easy to reach, at that) will suffice. I agree about characters not found on your keyboard, though, such as arrows etc. – Ingmar Mar 26 '13 at 10:09
  • 1
    “…newer users will find it harder to accept restricting to an ascii character set.” Or, you know, just non-ascii language users, regardless of how new they are, which is like ~95% of the worlds population ;-) – morbusg Mar 26 '13 at 10:42
  • @morbusg, true. But I write Unicode text, not math. – vonbrand Mar 26 '13 at 16:59
1

I’ll focus on Greek in this answer because many of the issues this question raises apply more to Greek than any other alphabet: a lot of math symbols and other scripts are derived directly from Greek letters.

If you look at an example of a Greek mathematical text, the original source is not going to write “ΚΥΡΤΗ ΓΕWΜΕΤΡΙΚΗ ΑΝΑΛΥΣΗ” as \textKappa\textUpsilon\textRho\textTau\textEta .... The source in UTF-8 would be human-readable. It’d be ridiculous to tell the authors, that’s fine, and we have to be able to display Greek letters to read your document anyway, but it’s taboo to type any Greek letter between dollar signs. Probably the only people in the world who’d even take that as up for debate are monolingual English-speakers.

As egreg correctly points out in his comment, “ε (U+03B5, GREEK SMALL LETTER EPSILON) should really be 𝜀 (U+1D700, MATHEMATICAL ITALIC SMALL EPSILON).” But of course that’s exactly the same as how x (U+0078 LATIN SMALL LETTER X) should really be 𝑥 (U+1D465, MATHEMATICAL ITALIC SMALL X). And when I test, unicode-math is smart enough to handle it the same way: ε in math mode becomes 𝜀, \symbfup{ε} becomes 𝛆 (U+1D6C6 MATHEMATICAL BOLD SMALL EPSILON), and so on. There’s even an option to replace these with MATHEMATICAL EPSILON SYMBOL instead.

One good reason to prefer macros to direct Unicode input is to avoid mixing up symbols that look the same, such as Latin A and Greek Α. There are no distinct Greek letters Α, Β, Η, Μ, Ν, Ο, Ρ or so on in the legacy OML encoding, so traditionally these were identical to their Latin lookalikes. You wouldn’t define two identical symbols in the same context with separate meanings! Today, though, it’s possible that different symbols might look different on the screen but the same in the editor, and it’s now possible to copy from and search a PDF that uses a Unicode math font.

(By the way, I just found out that copying and pasting from the official PDF code charts at unicode.org gives you mojibake.)

And, of course, some symbol that works in my editor might not display in yours. Especially some obscure mathematical symbol from the supplementary plane.

One could, on the other hand, argue that if two symbols are so similar that I’m likely to get them mixed up in the editor, a reader who doesn’t already know what I meant might have the same problem. So it might be easier to see right away that ϵ∊ is a problem than that \epsilon\in is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.