+++ date = "2021-07-30T17:12:40+00:00" publishdate = "2023-12-29T07:08:55+00:00" title = "Typesetting in LaTeX" slug = "typesetting-in-latex" author = "Thedro" tags = ["latex"] type = "posts" summary = "LaTeX is a free typesetting system that allows you to create articles, books, white papers and other technical documents with speed." draft = "" syntax = "1" toc = "" updated = "2021-07-31" +++ {{< image source="/images/typesetting-in-latex.png" title="A LaTeX document." >}} A LaTeX document. {{< /image >}} [LaTeX](https://www.latex-project.org/) pronounced (`/la:tech/`), is a free typesetting system that allows you to efficiently create articles, books, white papers and other technical documents. Most scientific documents and white papers are built using this typesetting system. `LaTeX` is the opposite of a {{< sidenote mark="`WYSIWYG`" set="left" >}} Microsoft Word, LibreOffice Writer, and other similar programs. {{< /sidenote >}} [(What You See Is What You Get)](https://en.wikipedia.org/wiki/WYSIWYG) editor. The key difference is that format is _separated_ from content. Documents are pre--formatted to a specification that the content follows. `LaTeX` is a markup language similar to [`HTML`](https://en.wikipedia.org/wiki/HTML) (Hyper Text Markup Language). The separation of format and content allows for the automation of many parts of a typical document. The table of contents, bibliography, page numbers, footnotes, and references are all auto generated. The document, for lack of better term, is "alive" --- a living document that is programmable. Typesetting isn't a very useful skill in general, at least in my experience, because most people prefer `WYSIWYG` editors, but it's useful in large groups if only to eliminate arguments over formatting, positioning, and other {{< sidenote mark="minor" set="right" >}} The art of the trivial argument is sometimes called [bike--shedding.](https://en.wikipedia.org/wiki/Law_of_triviality) {{< /sidenote >}} details. Let's take a look at my preferred typesetting programs and workflow. ## Typesetting Workflow My preferred workflow for typesetting is a combination of the programs [TexWorks](http://www.tug.org/texworks/) and [ViM.](https://www.vim.org/) The `LaTeX` editor `texworks` acts as a heads up display and gives a general overview of what's going on. The magnifying glass, jump to source, and jump to `PDF` (Portable Document Format) are pretty much the killer features of `texworks`. Honestly it's the only reason `texworks` is in my toolkit. {{< video poster="/images/typesetting-in-latex-workflow.png" source="/videos/typesetting-in-latex-workflow.mp4" options="loop muted" width="1600" >}} LaTeX Workflow {{< /video >}} The editing action happens in `vim` while `texworks` polls and updates its graphical display for both the `tex` source file and `pdf`, even when external programs are mutating them. Editing can happen really fast as it's only necessary to keep the current line number inside my head when inter-operating between each program. If the sense of position is lost, then the line number becomes a guide, and a jump from `tex` to `pdf` or from `pdf` to `tex` puts me back into the flow. The desktop windows are [tiled](https://en.wikipedia.org/wiki/Tiling_window_manager) to maximize use of the viewport and the recompilation commands below are executed on every manual save in `vim`. ```shell #!/bin/sh -eu if ! { pdflatex -halt-on-error "$1" \ || xelatex -halt-on-error "$1"; } then cat fi ``` ## Conclusion That's all there is to my typesetting work flow. Programs in general tend to be either frustrating or slow, but `texworks` and `vim` happen to be one of those nice and rare experiences. [Gummi](https://gummi.app/) is also another interesting `LaTeX` editor that is used mainly for quick edits.