
LaTeX Tooling Guide - norswap
http://norswap.com/latex-tooling/
======
TheRealPomax
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)

~~~
maksimum
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.

~~~
TheRealPomax
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 Лев
Семёнович Вы́готский.

~~~
timtadh
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.

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

------
Zeebrommer
Latex still is the least bad option for technical writing. I never get used to
Word's figure captioning, numbering and referencing, and although the equation
editor is vastly improved, multiline alignment is still tricky. And version
control of documents of course! I hate those report_v23_JohnReview.docx
systems.

Also, +1 for TexStudio!

------
mncharity
There are also pandoc[1]-based markdown extensions which can create both latex
and html. Today I was looking at an R Markdown[2] derivative, bookdown[3]. And
was amused by Tufte style[4].

[1] [http://pandoc.org/](http://pandoc.org/) [2]
[http://rmarkdown.rstudio.com/](http://rmarkdown.rstudio.com/) [3]
[https://bookdown.org/yihui/bookdown/](https://bookdown.org/yihui/bookdown/)
[4] [http://rstudio.github.io/tufte/](http://rstudio.github.io/tufte/)

------
philip1209
We used ShareLatex.com for engineering projects in college, and it eliminated
the complexity of having to install LaTeX on everybody's computers. It also
allowed us to export the source for safekeeping [1]. I would use it again in
the future.

[1] e.g. on Github:
[https://github.com/philipithomas/SchedulingPaper](https://github.com/philipithomas/SchedulingPaper)

~~~
clishem
It's free software as well!
[https://github.com/sharelatex/sharelatex](https://github.com/sharelatex/sharelatex)
(AGPL)

------
seanlane
Looking through here, haven't seen anyone using Pandoc, so I'll through that
in the mix. Offers the ability to write simple LaTeX intertwined with
Markdown. I've been using it for everything from letters to homework
assignments, seems to get the job done for most scenarios. Probably wouldn't
use it for an extensive paper though. But it's nice to be able to start typing
in Markdown, call `pandoc -o output.pdf source.md` and just have something
nice to send out without a ton of setup.

~~~
pvorb
I've written both my bachelor's and master's thesis using Pandoc and Markdown
with occasional LaTeX markup.

------
sehugg
1\. Install TeX Live and TeXstudio

2\. Start writing your master main.tex file

3\. Search a bunch of StackExchange forums, edit main.tex appropriately

4\. Now you have to edit /usr/share/texmf/tex4ht so your epub converter
renders images properly

5\. Finish your book. You will never touch that main.tex again, you will use
it for everything from now on and take it to the grave

~~~
TheRealPomax
While making sure to tell TeXstudio to use XeLaTeX or LuaTeX, and never the
LaTeX/pdftex (unless you live in such a small world you never need a single
non-ascii English character of course. Then stick with pure LaTeX)

~~~
projectorlochsa
\usepackage[utf8]{inputenc}

\usepackage[LANG_OF_CHOICE]{babel}

solves that problem.

there's plenty of font packages available for pdflatex.

I use newtxmath and newtxtext and libertine math and text all the time.

~~~
TheRealPomax
No it doesn't: you just told me to "choose a language". It's 2017, why would I
choose a language when I can just use all the languages with XeLaTeX, using:

    
    
       \usepackage{fontspec}
       \setmainfont{Noto Sans}
    

and that solves that problem. I can write whatever I want, and stick in lang-
specific context switches using \usepackage{ucharclasses} (for making sure
macros are inserted for transitions to/from specific unicode blocks) only once
I absolutely need them, and no earlier.

~~~
projectorlochsa
You haven't really explained why it doesn't.

Choosing a language allows you to automatically translate a bunch of strings
used by various packages.

For examples Chapter, Section, TOC and everything that is autogenerated will
be translated to a language. It has nothing to do with utf8.

You can remove babel and Chinese, German, Swedish can work in the same file
regardless.

\usepackage{noto}

What's hard about that?

------
girzel
Emacs and Auctex and you're done! (Provided you already use Emacs...)

~~~
gkya
If you're using Emacs already, just use Org-mode to write your documents and
C-c Ce l p, i.e. export to pdf through latex. I use a combination of Org-mode
and xelatex, and it works like a charm. Just set up `org-latex-classes' to
your templates if necessary, then:

    
    
      ;; See: https://lists.gnu.org/archive/html/emacs-orgmode/2014-05/msg00198.html
      (let
       ((xelatex "xelatex -shell-escape -interaction nonstopmode -output-directory %o %f")
        (biber "biber -u -U %b"))
       (setf org-latex-pdf-process
             (list xelatex xelatex biber xelatex)))
    

and go.

~~~
torrent-of-ions
org-mode is wonderful and exporting is a great feature. But it's more about
using LaTeX as a convenient way to get a typeset PDF. But I've never
successfully completed a "real" paper or book using just org-mode. I always
end up adding a ton of manual hacks and at that point I might as well skip
org-mode entirely.

------
IngoBlechschmid
I wrote sshlatex to speed up compilation. It does what you think it does, it
runs LaTeX on a remote server and streams the resulting PDF document. The
LaTeX header gets precompiled, shaving a couple of hundreds of milliseconds.
It's therefore also useful when used only locally.

[https://github.com/iblech/sshlatex](https://github.com/iblech/sshlatex)

------
refrigerator
Can vouch for ShareLatex - used it to write my Masters dissertation (Maths)
and use it to maintain my CV. Lots of handy templates for everything and no
need to faff around with infrastructure.

~~~
jsilence
Yes, it has a lot of nice features, but the monthly subscription price is
simply way to high for me.

------
baldfat
As the unoffical Racket Evangelist has anyone looked at Scribble?

> Scribble is a collection of tools for creating prose documents—papers,
> books, library documentation, etc.—in HTML or PDF (via Latex) form. More
> generally, Scribble helps you write programs that are rich in textual
> content, whether the content is prose to be typeset or any other form of
> text to be generated programmatically.

[https://docs.racket-lang.org/scribble/](https://docs.racket-
lang.org/scribble/)

------
sevensor
I've always been confused when people talk about tooling for their programming
languages. It made me fell like, maybe, I was doing it wrong by using a
console-based text editor along with whatever compiler / interpreter is
appropriate. This article finally made it clear to me that "tooling" means "a
Rube Goldberg device I cooked up instead of learning how my programming
language works." LaTeX is a lot easier if you understand what it's doing for
you.

------
KKKKkkkk1
I use LyX. It's interactive and visual, it generates clean and correct LaTeX,
and it builds it for you, so you don't need to muck around with error-message
parsers and makefiles.

~~~
gmac
Me too. It's also extremely flexible, at the cost of not in fact always
generating correct LaTeX and sometimes needing a whole lot of debugging.

I use LyX because, although I'm a programmer and perfectly capable of
littering my text with braces, somehow that completely ruins my writing flow.
I need the text I'm writing to look clean and a bit formatted (big text for
headings, italics and suchlike) -- and not like code -- to get anything
meaningful down on paper.

------
stephenll
On iOS and OSX, TexPad.com apps work very well. Not affiliated but prefer
TexPad over all other editors. Even works with git clients on iOS.

------
Kinnard
I wonder what the author would replace LaTex with . . . ?

~~~
norswap
Something better :)

Honestly, nothing is 100% convincing, but if I could pick anything, I'd use
HMTL with some templating magic (for generating references).

It still leaves the issue of positioning floats and page breaks, which is
really non-trivial, even if you already had a "spatial model" of what the
generated HTML would look like (I know of no such library, but do tell if you
know of it).

TBH, floating figures is a non-issue for the web, where you can just position
them in the flow. It's only in print that this is an issue. I'd be fine to put
figures on separate pages, but that might be a waste of paper.

------
drej
Step 1: touch report.tex Step 2: latexmk -pvc -pdf report.tex Step 3: ??? Step
4: PROFIT

------
graycat
What the OP describes is really long, drawn out, complicated mud wrestling.

I've been a good TeX user from the beginning of TeX and love TeX.

For the problem the OP addresses with LaTeX, there is a much easier solution:
And the candidates are ..., and may I have the envelope, please? [drum roll].
And the winner is ["rip"]: Just use just TeX, that is, D. Knuth's TeX with his
standard macro collection Plain. If get into trouble, then just get and read
his book, _The TeXBook_ \-- as software documentation, it is exemplary.

I'm guessing that a TeX file sent to people who accept LaTeX will work fine.
That was the case the time I published in the Elsevier journal _Information
Sciences_.

Want some cross reference macros? Okay, I put my TeX macro source code for
cross references at

[https://news.ycombinator.com/item?id=13630570](https://news.ycombinator.com/item?id=13630570)

in two parts in two posts where the above URL is for the first part and the
second part is close in the same HN thread.

The OP goes on and on about what text editor to use for typing in documents in
TeX. No problemo! I just use my favorite general purpose text editor KEdit
with a few macros specific to TeX.

With the TeX distribution I have is the spell checker ASpell. I use it for
nearly all my spell checking, in blog posts, e-mail, sure, TeX, source code
documentation, own notes on random subjects, etc. ASpell was written by a
bright, hard working person -- it's darned nice software, one of my favorite
tools. I use ASpell just for English, but IIRC it also can work with French,
German, etc.

TeX is fixed and unchanging, rock solidly standard, essentially totally bug
free, beautifully designed and documented -- what's not to like?

LaTeX? Just to start, need at least two books, each about twice the size of
Knuth's one book, and IMHO nowhere nearly as well written (likely the case
since next to nothing in software or computer science is written as well as
Knuth's book). For more, of course there is the TeX source code documentation
in Knuth's _literate programming_ which I've long regarded as just exemplary
software development -- that is, IMHO the most important part of software is
the documentation, clear enough to make the actual programming language
statements obvious because otherwise when the code is written "only the
programmer and God understand it and six months later, only God".

TeX was good enough for Knuth's book and, then, his series _The Art of
Computer Programming_ and, thus, should be up to the needs of a journal.

Or, in short, just use TeX, with your favorite editor (hopefully a good one
that lets you write some macros), write some TeX macros, use ASpell, and
otherwise avoid the mud wrestling and relax!

~~~
massysett
TeX is essentially a programming language for typesetting. I sigh when I think
of learning a new language for such a narrow purpose. You make this sound easy
but I have Knuth's book and have seen enough of it to know this isn't easy. If
it were, no one would have been motivated to write or use LaTeX in the first
place.

~~~
graycat
> TeX is essentially a programming language for typesetting. I sigh when I
> think of learning a new language for such a narrow purpose.

Yup, and "sigh" is a mild version.

I don't remember saying that TeX was "easy".

Actually, for just text, TeX can be quite easy, as easy as, say, HTML, old
WordStar, Word, the old Runoff programs, etc. That is, just need to know a few
tags.

The difficult parts are doing more, lots more, especially typesetting some
mathematics with some tricky notation. It's fair to say that, just due to
mathematics and its notation, fundamentally there is no "royal road" to
typesetting all of mathematics -- much of it, yes, all of it, no.

I confess I spent a lot of time in Knuth's book. At one point I wrote a
verbatim macro and like it better than what Knuth has -- verbatim is tricky
because need to cancel temporarily a lot of what is in TeX. I wrote the macro
so that I could document with the source code TeX macros in TeX documents. At
the time, that seemed important -- I no longer believe it is.

Also I wanted to use TeX as the formatting language for my old daisy wheel
printer, say, instead of old PC WordStar or some such. At the time, that
seemed important. Nope, it wasn't.

But for business cards? Yup, TeX has been nice. Can get some sheets to run
through a black and white laser printer. The TeX is cute, say, have the TeX
for one business card and, then, use more TeX tricks to position the results
for one card on all the cards on one sheet. Then bend the sheets and get a
stack of cards -- they look good enough (somehow the edges are clean enough).

But I've got the macro; writing it is a good TeX exercise.

Maybe have to look at TeX in about the right way. Or, from a movie, "I'll love
it when it works." with the response "It will work when you love it." Or, love
it for what it is good for; don't hate it for what it's not good for. TeX is
not good for everything.

What is TeX good for? Sure, Knuth's books in his series _The Art of Computer
Programming_ (TACP) and, okay, also papers in, say, the American Mathematical
Society (AMS) journals.

Or, TeX is to do on a computer what typesetters used to do by hand for math
text, many physics and engineering texts, TACP, and the AMS. So, right, TeX is
not the ultimate way to put any and all marks in color, etc. on paper or a
screen now and in the future. For the future, really, TeX was to _computerize_
the old work of math typesetting, not create a new future in formatting or
putting wildly conceived marketing materials on billboards, handbills, TV, or
computer screens. E.g., I don't see an easy way in TeX to wrap multicolored,
stretched text around a sphere and have it rotating with sparks flying off --
maybe Knuth could use TeX for that! I see no way to do ray tracing graphics in
TeX. TeX doesn't replace everything from Adobe or HTML5 or be the sole tool of
all graphic artists, movie makers, etc.

But if you want to be able to type math, and I do, then TeX is just fantastic
-- beautiful results and, for such good results, by far the easiest approach.

If look at Knuth's book and insist on just an introductory tutorial for an
hour or so and just f'get about the rest, then you should do okay at first. As
you want more, say, ordered lists, unordered lists, simple lists (I have some
simple macros for each of those three, with the logic for some nesting), good
control over page breaks, exact control on space after periods, positioning of
figures, using TeX to put math annotation on a figure (basically have TeX
print on top of the figure -- actually easy enough once see how it works),
some fancy foils format, essentially automatic tables of contents, cross
references, a nice way to do references (I have a good enough way but don't
use BibTeX), getting good with font magnification, handling hyphenation in
detail yourself, tricky tables (they are not so easy in HTML, either -- about
the only easy way to do tables is with just flat ASCII and assuming a
monospaced font!), then look some things up in _The TexBook_.

I believe you will find that the simple stuff can still be simple. And for the
math, say, at the level of freshman calculus, that's actually quite natural
and easy also.

IMHO, LaTeX is more difficult. Maybe LaTeX makes it easier to have some book
format with title page, frontispiece, preface, table of contents, fronts
matter, body, parts, chapters, sections, subsections, back matter, tricky
running headers and footers, references, colophon, etc., but, gee, Knuth wrote
his book in TeX and not everyone is trying to write the Encyclopedia
Britannica.

If something seems really challenging in TeX, then maybe don't really need to
do that. Or get some help from the KISS princple -- Keep it Simple Sam.

E.g., for KISS, consider HN: How can post pictures? Can't do that. How can
include TeX math? Nope, not there. How about bold face? Can't do that either.
How about ordered lists nicely indented? Not there. Still HN is darned useful.

------
Animats
Needing all that "tooling" for a word processor is embarrassing.

~~~
TheRealPomax
That's literally the difference: this isn't word processing, it's typesetting.
If you want word processing, use a word processor, and trust it to make the
right choices for you. However, if you've spent any amount of time actually
trying to get those images placed correctly, or those page dimensions perfect,
word processors fall short and your only other option is a TeX engine, or
typesetting applications like InDesign. Of those two, one category is free,
and the other costs $50 a month these days.

Certainly this is the case when you need to typeset maths, but even when you
want proper typesetting control over something as "simple" as mixing English
and vertically typeset Japanese, Word and friends are insanely ill-equipped to
do what you need them to do, whereas a modern TeX system like LuaTeX or
XeLaTeX will actually let you define what you need and then get out of your
way from that moment on.

~~~
FireBeyond
> and the other costs $50 a month these days

I appreciate your point, but it's actually $19/mo for InDesign.

~~~
TheRealPomax
The point stands, with that revision, which can't be worked in due to
hackernews not letting you edit your comment indefinitely.

------
nlp7
I love the feature of Latex where you remove one brace from your code and then
it breaks entirely with the very helpful memory overflow error. Great
compiler.

