Learning to type math, in LaTeX!

Learning to type math, in LaTeX!

Or rather \LaTeX the typesetting program, (not typing in rubber, that would be a different type of “fun”)

Last semester I decided to take a combined linear algebra, real analysis, and vector calculus class online (Math E-23A at Harvard Extension School). This was a very challenging course for a number of reasons, including the fact that I took single variable calculus something like 35 years ago! I managed to live to tell the tale (and even passed the class with a decent grade!) but it was an incredible amount of work! Someday I hope to take the “data science” version of the next class in the sequence (Math E-23c) which covers integration and statistics, but I decided that I needed to take a bit more time to review (and catch up on missed sleep) before continuing on.

One thing that has changed is the requirement to type math assignments. I suppose it is not a hard requirement, in that one could scan and submit handwritten work, but neatly typed homework solutions were strongly suggested, The \LaTeX source code for the assignments were provided to use as a template and the provided notes were also produced in \LaTeX.

So, what does it look like? To get something like this:

\nabla_{\vec{u}} \mathbf{f} (\mathbf{a}) = \lim_{h \to 0} \frac{\mathbf{f}((\mathbf{a}) + h \vec{\mathbf{v}}) - \mathbf{f}(\mathbf{a})}{h}

Requires writing code like this:

\[
\nabla_{\vec{u}} \func{f}(\point{a}) &= \lim_{h \to 0} \frac{\func{f}(\point{a} + h\vec{v}) - \func{f}(\point{a})}{h}
\]

(note: while WordPress does allow embedded \LaTeX code, it does not support all of the packages or custom macros that are required to render the above with a simple cut and paste)

This is what a matrix looks like:

A = \begin{bmatrix} 3 & 4 & -4 \\ 1 & 3 & -1 \\ 3 & 6 & -4 \end{bmatrix}

A = 
\begin{bmatrix}
3 & 4 & -4 \\ 1 & 3 & -1 \\ 3 & 6 & -4
\end{bmatrix}

And you can write statements like:

The closure,

\bar{B}= \left(\begin{pmatrix} x \\ y \end{pmatrix} \in \mathbb{R}^2 \big|.x^2 + y^2 \leq 1 \right)

is the unit disc that includes the origin.

The closure, $\closure{B}= \left(\begin{pmatrix} x \\ y \end{pmatrix} \in \mathbb{R}^2 \suchthat x^2 + y^2 \leq 1 \right)$ is the unit disc that includes the origin.

(Again, note that WordPress does not have all of the LaTeX macros and packages to make this look good!)

There are a number of free distributions of both the base package \TeX and the \LaTeX macro package for different platforms, and each of these provides an entry into a fairly robust ecosystem. In fact, really it is as much of a software development environment as much as a document preparation system (and in fact, TeX and LaTeX are both Turing complete).

When I first encountered TeX, I was in high school and my father was working in product documentation at Texas Instruments. As such he worked with technical writers and editors who were familiar with various commercial typesetting systems in use in the early 1980s. TeX stood out not only as the leading (or really only) mathematically focused typesetting system, but also because it was both free and well documented by its author, Stanford computer science and math professor Donald Knuth. It is all the more remarkable that this system was developed in the 1970s before innovations like inexpensive printers and vector font technology (like TrueType or OpenFont) were available. In fact, Knuth also had to write another program, Metafont, and then use it to generate the original “computer modern fonts” that came with the system. Even more remarkable is that not that much has changed. New packages and macros have been added, as have new engines that can support new font technologies and formats like PDF. New language integration has been added to spin-off projects like LuaTeX that allow extensions to be more easily created. And there are even online editing and compilation systems like Overleaf that provide a complete web-based environment to edit and write technical documents.

I have a local instance of TeXShop installed on my Mac, but I actually prefer using Overleaf most of the time. Overleaf also has builtin support for knitr which allows embedded R scripts to execute inside a LaTeX document. (I will post more about R some other time). Speaking of R, I also use Rmarkdown to create R documents with embedded LaTeX, and supposedly there is some way to embed Rmarkdown (and LaTeX with it) into WordPress, but that is an exploration for another day.

There is also a very complex (and very complete) graphics package called TikZ that can be used to create all kinds of graphs and network drawings, like this one.

\begin{tikzpicture}
    \node[main node] (1) {$1$};
    \node[main node] (2) [right = 5cm of 1]     {$2$};
    \node[main node] (3) [below right = 2cm and 1cm of 1]  {$3$};
    \node[main node] (5) [right = 2cm of 3] {$5$};
    \node[main node] (4) [below = 4 cm of 1] {$4$};
   \node[main node] (6) [below = 4 cm of 2] {$6$};
   \draw[<->](1) -- (2);
   \draw[->](1) -- (3);
   \draw[->](1) -- (4);
   \draw[->](2) -- (3);
   \draw[->](4) -- (3);
   \draw[->](5) -- (3);
   \draw[->](6) -- (3);
   \draw[->](6) -- (5);
\end{tikzpicture}

The output is certainly more legible than my handwriting, and typing one’s math homework has many of the advantages of using a word processor for writing papers and essays (spell check, editing, version control, backups, etc.), but it sure did take a lot of extra time (I estimate 5 hours a week for me!)

Share:FacebookX
3 comments
  • Wrote my thesis in LaTex in 1993. Three years ago I had to write a lengthy text about BGP. As I hated (and still hate) Word, and also neither LibreOffice nor Apple Pages were up to the job (I wanted a good table of contents, an index and bibliography notes) I went back to LaTex. 95 pages later I did not regret that decision.

    Btw – for drawings I used Apple Keynote, exported to PDF included into LaTex.

    • I would very much like to read your BGP text! Is it available online?

      I also first learned LaTeX in high school in the 80’s, not as a school requirement, but it did lead to a part-time job at a technical typesetting house (back when those existed). One of my main tasks was reading data off of a nine-track tape drive, doing text processing in SNOBOL 4, and then producing output for typesetting tables either in TeX or for financial documents, our old CDC cyber based phototypesetting system.

      Later on, at the first university I attended (https://www.nmt.edu/), I took a practicum class in LaTeX that was primarily designed to support thesis writing (that was probably in 1988 or so). After transferring to the University of Dallas, I ended up writing my thesis in Word (yuck!).

      In the 1990’s, before Word had support for many classical (and other languages that used non Latin character sets, or rather, in the pre-Unicode days, non-ASCII), and before multilingual support in XeTex or LuaTeX, I helped others use LaTeX with Greek using betacode (https://en.wikipedia.org/wiki/Beta_Code) encoding. I knew a professor at the University of Virginia who wrote a package to typeset Tibetan and Sanskrit in LaTeX using the Extended Wylie encoding (https://www.thlib.org/reference/transliteration/#!essay=/thl/ewts).

      I suppose now that the babel package is available, along with unicode fonts, and alternate keyboard entry methods, some of the older tools are now obsolete. At least for supported languages, I still think babel lacks support for Egyptian hieroglyphs, and the author of the old HieroTex package is now spending time on Jsesh instead.

      My own use of TeX/LaTeX was limited from 1992 until last year. I was surprised that knowledge of LaTeX was basically assumed, and that it was strongly recommended for weekly homework assignments.

Follow @matrodina

Connection error. Connection fail between instagram and your server. Please try again

Instagram

Connection error. Connection fail between instagram and your server. Please try again

Please note

This is a widgetized sidebar area and you can place any widget here, as you would with the classic WordPress sidebar.