Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What should be step 1: it's 2017, you want XeLaTeX or LuaTeX, both capable of native unicode handling, using fonts by name, etc. Traditional LaTeX (and I use "traditional" with scorn as we've had XeLaTeX for almost 15 years now), relying on the ancient pdftex engine, might be "easier to google" (let alone remember), but is also not an acceptable thing to recommend to people if all they want to do is control their typesetting.

It's like talking about how hard it is to work with browsers and then telling people the best way to set up IE8, instead of using a modern browser.

Of course it's still you in the typesetting driving seat, it's never going to be as easy as Word, but I'm writing a novella in XeLaTeX right now, not even maths papers, and it's almost child's play to make it do what I want with minimal effort. My entire "complicated setup" is five lines plus one line that's me being completely unreasonable, with XeTeX going "sure, be that way":

  \documentclass[11pt, oneside]{book}
  \usepackage{tocloft}
  \usepackage{fancyhdr}
  \pagestyle{plain}
  \usepackage[b5paper, bindingoffset=0mm, inner=23mm, outer=23mm, top=21mm, bottom=24mm]{geometry}
  \input{quotation-rules.tex}
And that's it, the rest of the document is basically just a giant text file of paragraph after paragraph of normal text, using normal as-per-unicode accented letters saved in UTF8. The doc's certainly interspersed with \part{} and \chapter{} markers because that's how a story works, but there is nothing I couldn't explain to my mom in there: I'm writing a "book" with a table of content, a reasonable looking page header but otherwise plain styling, with some explicit page dimensions (which is no different from using Word for a specific page size).

(the only unreasonable demand being that "\input" line, which imports a set of rules for using "Palatino Linotype" as main font, but then pulling the punctuation glyphs from "Sylfaen". So stuff like full stops, apostrophes, commas, double quotes, etc. And even for something seemingly as complex as that, is just a few more lines using modern XeLaTeX)



Besides native UTF support and fonts what advantages do the XeLaTeX and LuaTeX ecosystems offer over LaTeX?

You mention writing a novella as your use case, but I don't think that's a particularly difficult task for a typesetting engine. If you found typesetting a textbook with "rich" margins, annotations, and figures significantnly easier I would be more inclined to learn about alternatives.

With LaTeX I can transform my research papers to comply with a publisher's template in a few lines of code. Sure there are some annoyances such as compile compile bibtex compile, but the ecosystem is mature enough that most of these are well handled.


They still support the LaTeX command set, except they're native Unicode and native OpenType support. That's kind of where the full stop should be satisfactory. If you need to typeset anything, having the LaTeX commands _and_ normal text typesetting for arbitrary languages is literally why base LaTeX with pdftex is now effectively irrelevant.

If you need amsmaths or APA citation, you still get those. Except now you get them without insane commands just to type Paul Erdös' name, or citing Лев Семёнович Вы́готский.


I guess I live in a small world because I have no idea how to type an umlaut on a US Qwerty keyboard but I can easily type Paul Er\"{o}s.


The irony is that it's Erd\H{o}s


Have you tried the setxkbmap -layout us -variant altgr-intl keyboard variant? See https://www.google.com/amp/s/zuttobenkyou.wordpress.com/2011...


Option-u o


It's Erdős, not Erdös btw.


I was kind of hoping someone would point that out.


You're welcome.


Greek characters require a few manipulations (loading babel and using \textgreek{}), but for accents you literally just need to add two lines to your preamble:

     \usepackage[utf8]{inputenc}
     \usepackage[T1]{fontenc}


Or you use XeLaTeX and you don't do those things. You just write Greek and say you want to use whatever normal font you like best for typesetting English and Greek at the same time. Because the "inputenc" package shouldn't be necessary in 2017. For more than obvious reasons, _everything_ is now utf8 encoded, including ascii files. Unless you live in a CJK country. Then you might have a reason to still use BIG5 or JIS... although that reason is slowly eroding in favour of UTF8 too.


For the use case where your journal/publisher has a desired LaTeX template, it's probably more pain than it's worth.

For works that have to handle multiple scripts, and for works wherein you are in control of your own typography, it's more logical and practical to work with XeLaTeX/LuaLaTeX. If you wish to use OpenType or TrueType fonts there's little debate.

If you want to go the whole nine yards regarding Unicode, there's recently been some development regarding Unicode math, with the first impetus being Microsoft and its Cambria Math to support mathematical typesetting in Word. Unicode math refers to fonts implementing mathematical symbols as Unicode glyphs, as well as some font-side logic regarding how the font renders math, afaik.


Not really? XeLaTeX is "the LaTeX API (because it's an API built to be run by a TeX engine. LaTeX is built on TeX the same way jQuery is built on JavaScript) run using XeTeX" (the natively-unicode-aware TeX engine).

So if your publisher has a LaTeX template, that's pretty much guaranteed to work just fine when you \usepackage it in XeLaTeX context. Needless to say, except it really does need to be said, that also means full Unicode Maths support (through \setmathfont{A normal font name} without needing TeX metrics nonsense because it's 2017) for any OpenType font with maths support (Cambria Math, XITS Math, etc. etc.)


I was thinking that if you draft a document in XeLaTeX/LuaLaTeX, including a template, then if you don't bother to really learn how font handling with XeTeX/LuaTeX works, you might end up with some fontspec or polyglossia line in your code, etc., and there might be problems with a template that does things oldstyle.

Another point is that some packages haven't been updated for Unicode, algorithms2e being one popular package that's still Latin-1, IIRC.

Then if your code will be compiled from source by someone using pdfLaTeX, your Unicode characters will cause problems.

Hence why I say that it's probably more pain than it's worth, since there are still things you need to understand to avoid incompatibility. I think a more proper analogy would be C and C++, since while XeTeX/LuaTeX is mostly LaTeX compatible, 1) you risk running into sinister incompatibilities and 2) typical XeTeX/LuaTeX code is different from, and incompatible with typical LaTeX code.


I've spent time on LuaTeX, and I'd really like to understand changing the font.

For example I can list them with: mtxrun --script font --list --all

But when I try to use "gonormal" ( \definefontfamily [myfam] [tf] [gornormal] ) I get: "The requested font 'gonormal' has no files for the 'tf' alternative, Latin Modern is used instead."


\usepackage{fontspec} and you're done. \setmainfont{Palatino Linotype} to just use that, \newfontfamily\secondary{Times New Roman} now you can just stick in {\fontspec{\secondary} blah blah blah} for bits you need styled in a different font for a few words/sentences/paragraphs/however much you need.

And if you need the automatic TeX style replacements (like turning `` into opening quotes - personally, I hate that, I'm writing text, not programming - then you can pass in TeX mapping instructions in [...] blocks, covered by the fontspec manual: \setmainfont[Ligatures=TeX]{Font By Name} and \newfontfamily\whateveryoucallit{Font by Name}[Ligatures=TeX])


Writing prose is easy no matter what tool you're using. Now try to typeset a matrix that has annotations for its rows and columns. Say something like

       m n
     [ A B ] m
 X = [ C D ] n
     [ E F ] n
Achieving this in LaTeX deserves a dissertation in and of itself.


    \documentclass{article}
    \usepackage{blkarray}
    \usepackage{amsmath}
    \begin{document}

    \[ X = \begin{blockarray}{rrr}
    m & n \\
    \begin{block}{[rr]r}
    A & B & m \\
    C & D & n \\
    E & F & n \\
    \end{block}
    \end{blockarray} \]
    \end{document}


Sweet! For some reason I remember having bad interactions between blkarray and other packages, but I can't reproduce anymore...


Or you can use TeXmacs [1], enter such arrays in WYSIWYG and export to LaTeX.

[1] http://texmacs.org/tmweb/home/screenshots.en.html


The result doesn't prove how arduous the process to find that out can be. Latex stackexchange is a rich recourse though, and your help is certainly welcome. I'd still call it LaTe-X :P




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: