How to practice LaTeX?

As several people have said, the only way is to write and typeset documents in LaTeX. Calculating the first 30 primes might make you a better programmer, but it is doubtful if it will make you a better LaTeX user, since it is of dubious utility to solve a problem for which LaTeX is not the right solution. If you're not sure what to write:

  • Do your homework, if you have any, in LaTeX.
  • Make notes and do scratch work in LaTeX rather than on paper. You will get quick at this fast, and will start to think of macros that are useful for you in particular.
  • An extension of this is to write a guide to whatever you're studying in LaTeX. This is a good learning discipline, as you will be checking the depth of your understanding if you have to explain to an imagined reader. Post it online and you might get feedback too.
  • Rather than recreate coursework assignments as one answer suggested, do something more useful. Find papers from the pre-LaTeX era and transcribe them. This makes them more accessible than dead-tree or bitmap scan formats (easier to access and share, easier to annotate/fix typos). Anything pre-1900 and quite a lot of early 20th century should be out of copyright (but check if you want to share your work and care about the legality) and can be shared online. There is a lot of golden-age mathematics that could be interesting to read included in this.
  • If you know (especially) French, German or Russian, you could also translate old papers into English. If not you could translate classics into your own language. Post them somewhere searchable and it will inevitably be useful to someone.
  • Write a book or an article on any subject in LaTeX or TeX. Even without math formulae there are hundreds of typeseting concerns that you might have to figure out.
  • Write a tool to generate LaTeX documents automatically from various forms of data. Eg 'turn your WordPress blog into a book', 'add an Excel table to your LaTeX document'. If useful and polished, you can make it into a package. Even if not, you will learn loads about document structure and edge cases.
  • Less hardcore: take your blog (or someone else's blog, or your fifty favorite StackExchange questions and answers, or a Project Gutenberg book, or whatever source documents) and turn it into a book manually, by copy-pasting and converting all the entries and creating the ToC, intro, appendix yourself.
  • Learn literate programming and combine that algorithm to calculate the first 30 primes in your favorite language with an explanation of why it works in LaTeX. Or make literate whatever programming project you're working on already. It's a good way of writing programming tutorials.

I personally found that after I knew the basics, just using LaTeX for writing assignments and papers, then using it to create presentations, then my CV, ...

My natural curiosity as a programmer (as well as my tendency to procrastinate) led me to try and create shortcuts for the things I used most. This led to reading package documentation. Others already created packages to do the things I wanted. CTAN contains loads of interesting stuff, usually with good documentation.

Eventually I had a feeling for what was possible. And when a package I needed didn't exist, I wrote my own. All of this happened rather naturally over the course of a few years.

Of course, at all times there was this website, with its great community, to answer my questions. Also, I eventually read the TeXbook by Knuth. He's an excellent author.

In short: Learn by doing. It's not original, but there you have it.


I tried to restrain myself from posting an answer, but here it is.

When I read the title of the question, "How to practice LaTeX?", something came to my mind: Pokémon. I know it might sound strange, but I'll try to explain this reasoning.

I played Pokémon as a kid. It was not amongst my favourite games at all, but the mechanics were quite interesting. And there was one particular trainer phrase that triggered my memory, something along these lines:

You are a trainer too, aren't you? Let's practice!

Wait a minute, now. You don't practice a battle. That's the basic foundation of the game. I think the same applies to LaTeX:

You don't practice LaTeX. You for realsies LaTeX.

Using LaTeX is much like playing Pokémon - we need to gain experience from "battles", that is, problems we can solve by using our skills. :)

Of course, we always begin our journey with a starter Pokémon:

  • The grass Pokémon Using LaTeX for documents: The reference here is the grass-type Pokémon known as Bulbasaur. This "starter" is perfect for beginners. When we learn the basics of LaTeX, we can create beautiful documents in a blink of an eye! No trickery is needed at this stage, things "just work". We will be able to tackle most of our tasks by simply using our LaTeX knowledge. We have great resources, like Frank's The LaTeX Companion, Stefan's LaTeX Beginner's Guide, and Marc's LaTeX and Friends. Let's see an example:

    \documentclass{article}
    
    \begin{document}
    Hello world!
    \end{document}
    

    We have our first document, yay! What else can we do with it? Let's add more packages and have more fun! When in doubt, let's browse the documentation, it's our PokéDeX.

  • The water Pokémon Using LaTeX for automating tasks: Now, we might opt for a more challenging partner, in a reference to the water-type Pokémon known as Squirtle. In this stage, we can use LaTeX for more than just a beautiful document, how about automating some tasks? Print a sentence 10 times, check if we are in an odd page, or even plotting our own data!

    \documentclass{article}
    
    \usepackage{ifthen,changepage}
    \usepackage{pgfplots}
    
    \begin{document}
    
     \foreach \i in {1,...,10} { 
        I like ducks (\i)\par
    }
    
    \bigskip
    
    \checkoddpage
    We are in an \ifthenelse{\boolean{oddpage}}{odd}{even} page!
    
    \bigskip
    
    \begin{tikzpicture}
    \begin{axis}[
    xlabel=$x$,
    ylabel={$f(x) = x^2 - x +4$}
    ]
    \addplot {x^2 - x +4};
    \end{axis}
    \end{tikzpicture}
    \end{document}
    

    And we have our result:

    Output

    Cool, isn't it? :)

  • The fire Pokémon Using LaTeX as a programming language: The last starter, as its counterpart Charmander, is the most difficult Pokémon for beginners to use. Not because it's difficult per se, but it might require some skills we are not familiar with just yet. Patience is a virtue here, and we can see the benefits of this choice later on, when we will be able to solve complex problems. Thanks to the great effort of the LaTeX3 team, we now have the amazing expl3 which helps us to unleash the power of our inner lions. Just to quote Bruno's message in the chatroom today:

    Just implemented an interpreter for a subset of Forth using LaTeX3 this weekend :-). Eventually, I'm hoping to implement PostScript too.

    It's worth the effort to learn it. :)


I'd say it would be great for all of us to have these three starter Pokémons in our team. Of course, it's a matter of personal taste, it depends on how everyone sees LaTeX. :) In the game, our Pokémons evolve with time, battle after battle. In LaTeX, we only will write better code with time, attempt after attempt.

Of course, we hope someday to reach the status of TeXperts and own our Mewtwo's, like egreg and David. :)

Mewtwo