Is there a way to export an enumerated list to individual image files?
April 25, 2020 7:22 PM   Subscribe

Is there a simple way to export individual questions from an enumerated list in a LaTeX document to separate images?

I tutor mathematics at a local university. I have a LaTeX document I've created containing a list of practice problems taken from old exams. I want to create a video where I work through solutions to the problems. In order to do this, I want only one of the problems to be displayed on the screen at a time. I've found a simple way to do this, but it involves each of the problems being a separate image file. The format of the images doesn't really matter. So, my question is - is there a simple way to take a LaTeX file containing an enumerated list and export each of the list items to individual image files? In other words, I'd like file 1.jpg to contain the rendered text for the first question, 2.jpg to contain the rendered text for the second question, and so on.
posted by NoneOfTheAbove to Computers & Internet (5 answers total)
 
Is it something like this?

\begin{enumerate}
	\item One
	\item Two
	\item Three
\end{enumerate}
I'd write a bit of Perl that contained any sort of pre/post-matter setup needed for the document to work. Then write a bit to start at the \begin and go to the \end and gather lines based on matching the \item that leads each. For those gathered items I'd generate a 1.tex, 2.tex, etc. that has the pre/post-matter wrapping the text of each \item. Then do the .tex to image however you normally do. If your document isn't a total mess, it's easy enough to do.
posted by zengargoyle at 7:52 PM on April 25, 2020


You might try inserting the following command in your preamble:
\renewcommand{\theenumi}{\newpage \Alph{enumi}} 
Assuming this doesn't break things badly (I don't know for sure whether this will work), it would insert a pagebreak before each item in your list. This would then give you a PDF with one problem per page. If you need this as a list of separate JPGs, there are several suggestions on how to convert a multipage PDF into JPGs here.
posted by Johnny Assay at 8:34 PM on April 25, 2020


If you’re not committed to your current idea/solution, another quick way might be to change your documentclass to landscape, do a find and replace to replace \item with \newpage\item, recompile—this should now get you a pdf where each problem is on one page. Now you can import the multipage pdf into something like Explain EDU as separate slides, and then make a video with one slide per problem. (This works really well if you’ve got an iPad and a Apple pen or stylus. This is basically how I’ve been making it through the last month of emergency distance teaching.)
posted by leahwrenn at 9:31 PM on April 25, 2020


The package you want is called Beamer for taking your LaTeX source and putting it into presentation format.
posted by k3ninho at 12:05 AM on April 26, 2020 [3 favorites]


You might also work with LaTeX in Jupyter Notebooks -- and evaluate some Julia/Python/R to graph functions you display with matplotlib.
posted by k3ninho at 1:01 AM on April 26, 2020


« Older Guidance for art for a tattoo design   |   Animal Crossing New Horizons Save Data Newer »
This thread is closed to new comments.