Skip to main content

A Snappy TeX Workflow for Reports

Using GPT-3 or similar LLM we can quickly create error-free KaTeX
Created on February 8|Last edited on April 28

Introduction

When reading through a new piece of research that is shown on PapersWithCode I'll create a Report to use as I read through the research paper. Oftentimes, I'm performing a literature review of several papers in a DL subfield and so, to organize the most-salient features of the papers, or to jot down some facts that help in creating a mental model of the research space I'll make use of a Report. While Reports are great for pure text data, images, and dynamic charts if you're training a model, if you're like me writing LaTeX\LaTeX from scratch or 'translating' your on-paper scribbles to TeX\TeX isn't always the most expedient workflow! A time-saving workflow for adding TeX\TeX to your Reports is outlined below. So read on if you'd like a fast, streamlined workflow for getting complex mathematical equations – snippets from papers, into your Weights & Biases Reports in short order!

Fast LaTeX\LaTeX (KaTeX,actually!)\KaTeX, actually!) in a Report

A quick workflow for rendering LaTeX\LaTeX inside your Report from a handwritten math equation or from a snippet of text that you've found on the web is to do the following steps.
  1. Grab an image of the text that you want to render using LaTeX\LaTeX:
  • you can write the math on a piece of paper and snap a photo of it
  • you can copy-paste or upload in a PNG or JPG image that you've found on the web
  • you can upload an entire PDF that has some LaTeX\LaTeX-typeset text in it somewhere
2. Go to https://snip.mathpix.com/ ; you'll need to create an account first there if you don't already have one. There's a Chrome browser extension, you can use the snip.mathpix.com website, or you can even use their CLI to render your math text as LaTeX\LaTeX.
MathPix Snip section
The picture of the term-document matrix is transformed into LaTeX markup language, below
Click on the copy icon next to the 'flavor' of typeset text that you would like; MathPix copies the markup text to your clipboard.
3. Because your Report actually wants KaTeX\KaTeX-formatted TeX\TeX instead, head on over to one of the following tools and ask it to convert your chunk of LaTeX\LaTeX in KaTeX\KaTeX.

ChatGPT creates the same output as GPT-3, however, it then decides to typeset the markup snippet in the browser, resulting in the following:
A pretty matrix, but of no help if we want to paste the TeX markup into our Report
  • YouChat: I wouldn't recommend this tool as of February 2023 as the inline rendering breaks the formatting of TeX snippets by removing slashes and backslashes.
Andrea
Andrea •  
YouChat: I wouldn't recommend this tool as of February 2023 as the inline rendering breaks the formatting of TeX snippets by removing slashes and backslashes. 2023-02-08: Ticket filed with You.com outlining the issue with the slashes and backslashes being 'eaten' when the YouChat agent 'is typing'.
Reply