LaTeX notes

This post presents my notes on using LaTeX and samples of my notes in LaTeX.

Ruby text annotation #

For my notes typeset in LaTeX there is a heavy use of ruby text annotation achieved with \underset and \overset originally intended for mathematical expressions in LaTeX. An example of text annotated with \underset that is a speech from movie V for Vendetta (2005) is made for fun.

SVG graphics from LaTeX expressions #

LaTeX expressions are prepared with the convenience of GUI document processor LyX that includes a mathematical expression editor. For presentation on this blog, rendered LaTeX expressions are saved in Scalable Vector Graphics (SVG) format, which is compatible with browsers currently used by over 99% of internet users.

Embedding rendered LaTeX expressions as graphics in SVG format avoids introducing dependency to JavaScript libraries for rendering of LaTeX mathematical expressions, such as MathJax, KaTeX or jqMath. This keeps the website free of JavaScript scripts.

• This approach is suitable for presenting LaTeX output in Git repository project README pages where JavaScript is not allowed to prevent XSS attacks.
• This approach was also chosen by Wikipedia when it switched the format of delivery of rendered LaTeX mathematical expressions from a raster graphics format to SVG format.

Automation for the workflow of LyX to pdflatex to pdfcrop --margins 10 to pdf2svg to svgcleaner --multipass enables exporting of a rendered LyX document that is cropped with margins to losslessly optimized SVG files by simply selecting File -> Export -> More Formats & Options... -> SVG.

To introduce support for exporting to SVG file that is built on the support for exporting to PDF file in LyX, Converter Definitions in Preferences -> File Handling -> Converters are customized with reference to customization documentation as follows.

• PDF (pdflatex) -> PDF (cropped) is updated to include parameters specifying the margin such that it becomes pdfcrop --margins 10 $$i$$o.
• PDF (cropped) -> SVG is added to run pdf2svgclean $$i$$r, where pdf2svgclean is my script that wraps pdf2svg and svgcleaner to produce a separate SVG file for each page in a PDF file. It is convenient to have related diagrams, which are separated by formatting Page Break in a LyX document, rendered to separate SVG files. My script pdf2svgclean in full is as follows.
#!/usr/bin/env bashpdf2svg $1$1.tmp.%d.svg allfor f in $(ls -1$1.tmp.*.svg); do	svgcleaner --multipass $f$2$(basename${f/.pdf.tmp/})	rm \$fdone

In addition, enable Show in export menu for Format SVG in Preferences -> File Handling -> File Formats to reduce the number of clicks needed to export an LyX document to SVG.

Other customizations in LyX #

Examples of my other customizations in LyX accumulated over the years include:

Examples of study notes typeset in LaTeX using editor LyX #

All of my electronic study notes since 2014 have been prepared using LyX as I read textbooks, lecture slides and internet resources and also work on exercises and past examination papers.

Most of my notes are packed in a condensed layout such that they work as cheat-sheets for examination although the philosophy of making a cheat-sheet is to learn a topic by taking notes for it. Most notes are structured hierarchically with multiple levels of bullet points. A non-exhaustive selection of my notes is as follows.

Computer Graphics (2019) course notes in PDF format ↓

Some notes are structured in points implicitly without the bullet symbols. Some notes include diagrams drawn with LaTeX symbols. An example is as follows.

Software Engineering (2018) course notes in PDF format ↓

Some notes include annotated code snippets and tables for reference. An example is my own study notes for Linux terminal tools with a philosophy similar to that of tldr examples for man pages.

• Examples of commands are annotated with \underbrace, which is similar to \underset but with a brace symbol placed between base text and ruby text.

• The document includes raw LaTeX commands inserts in an LyX document, which is built on a philosophy similar to raw HTML tags in a Markdown document. This is used for inserting multicols commands for putting text into multiple columns for the Makefile section in the following example.

Programming Technologies and Tools (2017) course notes in PDF format ↓

Other notes are a collection of worked problems in mathematics and computer science with emphasis on proofs and the use of algorithms demonstrated.

Data Structures and Algorithms (2018) worked problems in PDF format ↓

Resources on LyX and LaTeX #

More detailed LyX resources may be found in:

General LaTeX resources include:

Other notes #

For bibliography management in my LaTeX report writing work flow, cross-platform GUI application Zotero with Better BibTeX extension, which handles automatic exporting to BibTeX format, have better browser integration and better automatic PDF meta-data filling than Mac application BibDesk for BibTeX management.

My résumé or curriculum vitae is made LaTeX with moderncv document class in banking style with bullet points for entries.

An interesting further reading is the story of Donald Knuth, the creator of TeX typesetting system.

Changelog

• Jan 2021 Updated paragraphs on export menu instructions and use cases of SVG.
• Jan 2021 Updated graphic with sans serif font.
• Dec 2020 Added paragraph on résumé.
• Nov 2020 Added more details to paragraphs.
• Nov 2020 Added paragraphs on ruby text usage.
• Nov 2020 Re-organize some links in bullet points.