LaTeX FAQ's

Before anything else, I need to define some terms. You can think of LaTeX workflow as having three components:

1. A text editor that you type your content into, like gedit, Sublime, Vim, or Emacs.
2. A LaTeX compiler (aka LaTeX distribution) that converts the source into a PDF. See question L-10 for recommendations.
3. A PDF viewer, the same one you use for normally viewing PDF’s. See question L-12 for recommendations.

What you need to know right now is that these three components are disjoint. Some text editors may let you invoke a compiler directly, and others may be designed specifically for LaTeX editing, but it is a mistake to confuse the editor with the compiler. Any text editor will work with any compiler will work with any PDF viewer.

L-1. I don’t know anything. Where do I start?#

Read Wikibooks, it’s really comprehensive. Also, this tutorial is good too.

L-2a. What about online suites like Overleaf?#

I think it’s better long-term to install LaTeX on your computer. I realize that people want something that “just works” with no additional effort. But for frequent usage, there are downsides:

• You do not have much control over the editor or viewer.
• You do not have control over package versions, or custom packages (besides manually making a copy of a package each time you need it).
• It’s slower, because you need to do repeated round-trips to an external server for compilation and viewing.
• If you use Asymptote, any errors are silently discarded.

More bluntly, just install LaTeX, you only have to do it once.

Overleaf certainly has its uses; most notably, its strength is collaboration. For example, some of my colleagues do not know how to use Git or Dropbox, so its easier for me to throw an Overleaf at them in that case (and then use the underlying Git myself). Or, sometimes I am stuck on some library computer, making it impossible to install my own software.

But I think it’s not good for learning though, see the next question.

L-2b. How do I get X to work on Overleaf?#

First install LaTeX properly, then if it still doesn’t work write to me again. (Usually this fixes the issue because it forces the asker to actually do their homework. 😉)

Yes, it’s contained in the style file evan.sty. Attribution is required in source versions only, and not mandated in PDF output (though still appreciated). Check the license that appears.

You should either copy-paste the 600-ish lines of code into a text file, or else click “Raw” and save the file.

L-5. How do I get the colored boxes and section headers with evan.sty?#

Pass the sexy option to the package (see source code for more detailed breakdown of options). Colored sections will then happen automatically if you are using scrartcl (rather than article or report). For the theorem environments in colored boxes, use the provided theorem environments. See examples in FAQ L-9.

L-6. What package did you use to typeset your CV?#

I use moderncv. You can download the TeX source of my CV (with slight modifications for presentability; not updated).

L-7. How do you get the LaTeX to auto-compile?#

Use latexmk with the -pvc flag, and a PDF viewer that does not “lock” the PDF file from being written (Adobe reader does not work).

To fit latexmk into the framework we described, it is a “wrapper script” that calls the compiler for you.

L-8. What do you use to typeset geometry diagrams?#

I use Asymptote. It integrates well with LaTeX, but the setup takes some work. Read installation instructions for Asymptote, separate from LaTeX.

Once you have Asymptote installed, to integrate it with LaTeX, the workflow is three steps.

1. Run PDFLaTeX on, say, example.tex. This creates example-N.asy for the N’th diagram.
2. You need to then run the Asymptote binary on example-N.asy to generate example-N.pdf.
3. The diagram example-N.pdf then gets incorporated when you run PDFLaTeX again.

In principle, you can run this three-step process by hand each time you change the diagrams of your figure. This is annoying though, so if you use latexmk you can automate this process by putting the provided subroutine into the latexmkrc configuration file. See the LaTeX usage page for instructions on how to do this.

If you use a web-based compiler like Overleaf, then things may not work so well since you do not have control over the compilation process. As mentioned in L-2, my recommended solution is to not use web-based compilers.

L-9. Can I see some example source code?#

Yes, go to Olympiad page and to download TeX source. (The geometry handouts will have diagrams.) You can also look at Napkin source code.

L-10. Which LaTeX distribution do you recommend?#

MikTeX, MacTeX, and TeX Live for Windows, Mac, Linux, respectively.

L-11. Which text editor do you use?#

I use Vim with LaTeX Suite. But that is a pretty advanced setup, so if you are a beginner, it may be overwhelming to learn Vim and LaTeX at the same time.

Note that a text editor does not need to be specific to LaTeX, any source code editor will work.

L-12. Which PDF viewer do you use?#

Zathura. Evince and Skim are also good.

L-13. How did you get randomized hint order in your geometry textbook?#

It’s a bit of a hack, but here is demo code corresponding to the version used in my geometry book. Dennis Chen wrote a more sophisticated version as a sty package on his Github. If you have TeX Live 2021, you can just run tlmgr install scrambledenvs. Otherwise, follow the installation instructions at this Github gist.

L-14. How do you live-TeX your notes so quickly?#

The main contributing factors are:

• My typing speed is quite high, at around 650 characters per minute.
• Vim (see L-11) is fast.
• Several additional custom keyboard shortcuts specifically for TeX, see the vim folder in my dotfiles.
• I have conceal enabled in Vim, so I can read my source code more easily.
• I use latexmk to auto-compile (L-8).

I have been using Vim and LaTeX since I was a teenager, so I am quite proficient with both.

L-16. What’s the best way to learn new things in LaTeX?#

Two things:

• Read the source code of other people;
• Search on Google and tex.SE.

Use Detexify.

L-18. How can I have space between my paragraphs?#

You can use \setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}. You can also add \setlength{\parindent}{0pt} to suppress indents.

But don’t do this, it looks terrible. Indents are a better way of separating paragraphs.

L-20. How do you get LaTeX on Wordpress blog?#

I use this Python2 script. Not that elegant but works.

L-21. My code doesn’t work / I want to do X, what should I do?#

Prepare a minimal working example and ask on tex.SE.

L_22. Why do you anti-recommend dfrac or displaystyle?#

If your expression is so complicated that it isn’t legible without using \dfrac or \displaystyle, then it should probably be displayed.

Updated Sat 15 Jan 2022, 15:59:47 UTC by 14b3f62bdc89