About

  •  CV

Teaching (OTIS)

Olympiad

  •  Problems
  •  ELMO
  •  USEMO
  •  For beginners

Hobbies

  •  Puzzle hunts

Twitch Videos

  •  Discord

Links

  •  Mentors

Publications

  •  EGMO book
  •  Napkin (v1.5)
  •  Course notes

Contact

  •  FAQ's
  •  Rec letters

Buy Me a Coffee at ko-fi.com

LaTeX FAQ's

Return to FAQ Index.

These are FAQ’s about LaTeX.

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-2. What about online LaTeX editors like Overleaf?#

I think it’s better long-term to install LaTeX on your computer. This speeds up compilation and lets you use your favorite choice of editor and viewer, rather than the one specified on Overleaf. In addition, using Overleaf can cause version issues, especially with Asymptote.

I mostly use Overleaf in cases where I need to collaborate on a simple document and my collaborators do not know how to use Git or Dropbox.

L-3. Your documents are pretty, can I use your formatting?#

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-4. How do I use a custom style file like evan.sty?#

Check Google. Or see here in Wikibooks.

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.

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.

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-15. How did you integrate your problem database with LaTeX?#

I wrote my own database software in Python.

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.

L-17. How can I look up a symbol?#

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-19. What do you use for slideshows (e.g. on Twitch stream)?#

Beamer.

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.

Last modified: Fri Jun 11 17:23:30 2021. View source.