My LaTeX Workflow – Generating LaTeX

Published on
This post is part of my series on my LaTeX workflow. Typing formulas, diagrams and tables in LaTeX by hand can be an annoying task. So let me introduce three tools that can help with these three challenges. We will start with an explanation on how MathPix can be used to create the LaTeX code for formulas. Then we are looking at quiver, a tool for creating beautiful diagrams. And finally, the appropriately named Tables Generator is used to generate tables.

Typing formulas, diagrams and tables in LaTeX by hand can be an annoying task. So let me introduce three tools that can help with these three challenges and speed up your workflow a lot.

Symbol Detection with Mathpix

You probably know Detexify, a little website where you draw a mathematical symbol and the website tells you the LaTeX code for similar looking symbols.

The big disadvantage of Detexify is that you can only convert one symbol at once. This disadvantage (and a few others) are solved by Mathpix. Mathpix is a little program that lives in the menu bar and lets you take screenshots of formulas that are then converted into LaTeX. Mathpix can also convert tables, chemical formulas and handwritten content and entire PDFs. While Mathpix is a paid product, you get 10 conversions per month for free (20 if you sign up with your university email address).

To use Mathpix, activate the screen capture mode and draw a rectangle around the formula you wish to convert:

Upon releasing the mouse Mathpix will copy the following code to your clipboard

f(x)=\frac{1}{\sigma \sqrt{2 \pi}} e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^{2}}

which renders as

f(x)=1σ2πe12(xμσ)2f(x)=\frac{1}{\sigma \sqrt{2 \pi}} e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^{2}}

The quality of the conversion is generally really good. Of course, it is not always flawless, but that can't be expected. To me, it happens more often that MathPix can parse something I didn't expect it to than the other way round. Nonetheless, always check the results for correctness.

There are also MathPix-apps for phones and tablets. This mean, you can take a picture of a formula on a blackboard with your phone and import it as LaTeX in some document on your laptop.

Commutative Diagrams with quiver

While commutative diagrams are a great means to explain mathematical ideas, coding them using tikz-cd or xy-pic is a daunting task. Meet quiver. quiver is a website that lets you create commutative diagrams. To create a node click in cell and type the formula. Clicking and tracking between the nodes creates the arrows. quiver lets you also create higher-order diagrams, i.e., diagrams that contain arrows between arrows.

Clicking on the button labelled LaTeX generates the LaTeX code of the diagram:

% https://q.uiver.app/?q=WzAsNSxbMSwyLCJBIl0sWzIsMSwiQiJdLFsyLDIsIkMiXSxbMSwxLCJBIFxcdGltZXNfQyBCIl0sWzAsMCwiWCJdLFswLDIsImYiLDJdLFsxLDIsImciXSxbMywwLCJcXHBpXzEiLDJdLFszLDEsIlxccGlfMiJdLFs0LDAsImEiLDIseyJjdXJ2ZSI6M31dLFs0LDEsImIiLDAseyJjdXJ2ZSI6LTN9XSxbNCwzLCJcXGxhbmdsZSBhLCBiIFxccmFuZ2xlIiwxLHsic3R5bGUiOnsiYm9keSI6eyJuYW1lIjoiZGFzaGVkIn19fV0sWzMsMiwiIiwxLHsic3R5bGUiOnsibmFtZSI6ImNvcm5lciJ9fV1d
\begin{tikzcd}
	X \\
	& {A \times_C B} & B \\
	& A & C
	\arrow["f"', from=3-2, to=3-3]
	\arrow["g", from=2-3, to=3-3]
	\arrow["{\pi_1}"', from=2-2, to=3-2]
	\arrow["{\pi_2}", from=2-2, to=2-3]
	\arrow["a"', curve={height=18pt}, from=1-1, to=3-2]
	\arrow["b", curve={height=-18pt}, from=1-1, to=2-3]
	\arrow["{\langle a, b \rangle}"{description}, dashed, from=1-1, to=2-2]
	\arrow["\lrcorner"{anchor=center, pos=0.125}, draw=none, from=2-2, to=3-3]
\end{tikzcd}

Leave the commented first line in your code. It is a link to the diagram and can be used to alter the diagram later. Some features of quiver require that you include the quiver.sty file in your document. Here is an explanation for a convenient way to do this. The packages tikz and tikz-cd have to always be included.

Another nice feature of quiver is that you can embed the diagrams directly in websites by clicking the Embed code -button. Here is how this looks like:

Table Generation with Tables Generator

Finally, if you have to create LaTeX tables the Tables Generator is a helpful tool. Make sure to activate the booktabs-mode in the top right.

You can even import preexisting LaTeX code of a table or CSV data by using the File menu on the top left. Finally, you can also convert the table to HTML, Text, MarkDown or MediaWiki should the need arise.

Conclusion

This wraps up the blog post on the tools I use for generating LaTeX. I hope it contains a tool or more that you consider to use. You should also have a look at the other posts in my LaTeX workflow series, that cover everything from my spell checking setup to my literature management. Do you have any other tools that might fit in my LaTeX workflow? Please tell me on Twitter! I will update the article and add new ones as my workflow evolves. So come back regularly or subscribe to my RSS feed.