TUGboat, Volume 35 (2014), No. 3.

Book review: Let’s Learn LaTeX,
by S. Parthasarathy

S. Parthasarathy, Let’s Learn LaTeX, http://www.freewebs.com/profpartha/teachlatex.htm, 2014. 24 pp., free ebook. Version 201408e.

This is a free ebook licensed under the Creative Commons Attribution-ShareAlike 4.0 Unported license. The preface starts with a tribute to Richard Stallman and brief information about FOSS (free and open source software—the acronym could do with an expansion in the book). The preface then states that the purpose of the book is to encourage hacking as a method of learning LaTeX. The book, rather than being a reference text containing instructions and definitions, provides a list of example documents that the reader can try out and modify as a learning tool.

The idea of learning by hacking example code is a useful concept, and one that I often employ when investigating a new programming language. However, I’m concerned that the sample documents provided with this book use obsolete code and deprecated practices. Some illustrations follow below.

Most of the sample documents use the obsolete LaTeX 2.09 font commands, such as \bf. These are deprecated in LaTeXe and should be avoided [5]. There are also some instances where a font changing declaration, such as \Huge, is followed by an unnecessary group, which may confuse the reader into thinking the command requires an argument. For example, on line 50 of certif0.tex there are two sets of redundant braces in

{\bf{\Huge{‘‘\LaTeX\ hands-on’’}}}

since neither \bf nor \Huge have an argument. Only the outermost set of braces scope the effects of the declarations.

Many of the sample documents load the epsfig package [7]. The original epsfig style that was provided with LaTeX 2.09 is now obsolete and should not be used. Current TeX distributions provide a newer epsfig package that is just a wrapper package that loads the graphicx package [2]. The recommended practice is to use graphicx directly and not specify the image file extensions [4]. Incidentally, there is also no longer any need to specify the dvips package option, which occurs in many of the sample documents. The only time a driver option is needed is in the cases where it can’t be determined, such as dvipdfm [10]. Omitting the driver and the file extensions helps to make the document more portable.

Curiously, some of the documents, such as the file spacing.tex load both epsfig and graphicx, which is redundant. There are other instances of unnecessary repetition where there are multiple attempts to load the same package. For example, in the file torture1.tex not only are both epsfig and graphicx loaded on line 5, but there is also an attempt to load epsfig on line 11 and graphicx on line 13. Similarly, there are two attempts to load amssymb (on lines 4 and 10), amsmath (on lines 4 and 8) and amsfonts (on lines 4 and 9). Removing this duplication would provide a more streamlined example.

On the subject of images, the image files aren’t actually provided with the sample documents for copyright and licensing issues, so I think it would be useful if the author could mention the use of the demo option provided by the graphicx package, which would enable the documents to be compiled without error. Alternatively, perhaps mention the image files provided with the mwe package [9].

There is prolific use of \\ within paragraphs in the sample documents, which is generally best avoided [1]. I think using paragraph breaks instead of \\ would be more appropriate in most of these cases, and blank lines would additionally help readability of the code.

More surprising is the use of \\ immediately before paragraph breaks. The LaTeX user guide [6, p. 213] warns against this as it produces underfull \hbox warnings and extra vertical space. (If vertical spacing is required between paragraphs, there are more appropriate methods of achieving this [3].)

I was somewhat bemused by the line

%\documentstyle[epsfig, picinpar, 12pt]{article}

in the file latexography.tex. Even though the line is commented, \documentstyle should not appear in any modern LaTeX tutorial, except where it is being pointed out as obsolete. There’s a danger here that new curious users may uncomment the line and try it out.

I was interested to see that the sample document kuralengtam3a.tex loads the fontspec package [8], which is a X E LaTeX and LuaLaTeX package. It’s not often that a LaTeX tutorial uses a different engine. I think this is a good idea, but it would help if the author pointed out to the reader in a comment at the start of the file that X E LaTeX or LuaLaTeX is required, otherwise users eager to compile the sample document before reading it may not realise they need a different engine.

This sample document requires the Arial font. As a GNU/Linux user, I don’t have any commercial fonts installed, and it wasn’t immediately obvious at what point the document was switching to Arial, but the command-line invocation of grep Arial * tracked it down to eight of the accompanying files. After I had replaced all instances of Arial with Liberation Sans in those files, I was able to get the document to compile without error. Windows users won’t have this problem, but I was puzzled by the author’s choice of Arial rather than a free font given the book’s FOSS ethos.

If the author updates the sample documents so that the redundancy, obsolescence and deprecated practices are removed, this book could be a useful tool in learning LaTeX and introducing the reader to X ELaTeX.

References

[1]   David Carlisle. Answer to: When to use \par and when \\. TeX – LaTeX Stack Exchange, 2012. URL: http://tex.stackexchange.com/a/82666 (version: 2012-11-14).

[2]   David Carlisle. The graphicx package, April 2014. Available from CTAN, macros/ latex/required/graphics (version: 1.0g, 2014-04-25).

[3]   TeX FAQ. Zero paragraph indent. URL: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=parskip_ (version: 3.28, 2014-06-10).

[4]   TeX FAQ. Portable imported graphics, 2014. URL: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=graph-pspdf_ (version: 3.28, 2014-06-10).

[5]   TeX FAQ. What’s wrong with \bf, \it, etc.?, June 2014. URL: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=2letterfontcmd_ (version: 3.28, 2014-06-10).

[6]   Leslie Lamport. LaTeX: A document preparation system. Addison-Wesley, 1994.

[7]   Sebastian Rahtz and David Carlisle. The epsfig package, February 1999. Available from CTAN, macros/latex/required/ graphics (version: 1.7a, 1999-02-16).

[8]   Will Robertson and Khaled Hosny. The fontspec package: Font selection for X E LaTeX and LuaLaTeX, June 2014. Available from CTAN, macros/ latex/contrib/fontspec (version: 2.4a, 2014-06-21).

[9]   Martin Scharrer. The mwe package,
May 2012. Available from CTAN, macros/latex/contrib/mwe (version: 0.3, 2012-05-15).

[10]   Joseph Wright. Answer to: Driver specification for hyperref and graphicx. TeX – LaTeX Stack Exchange, 2010. URL: http://tex.stackexchange.com/a/6949 (version: 2010-12-12).

Nicola L. C. Talbot
School of Computing Sciences
University of East Anglia
Norwich Research Park
Norwich
NR4 7TJ
United Kingdom
N.Talbot (at) uea dot ac dot uk
http://theoval.cmp.uea.ac.uk/~nlct/


$Date: 2014/09/28 18:04:35 $
TUG home page; contact webmaster; (via DuckDuckGo)