This is the repository storing the initial data and scripts to generate datasets of \(\LaTeX\) images of varying formats and dimensions.
- ~tex2svg~[fn:1]
pdf2svginkscape(>1.0)
tex2svg according to its instructions. Then, run nix develop in this directory. All other dependencies should be made available in the resulting shell.
convert.shis the main executable When run, it will convert all of the lines of fragments inequations.txtinto 256x256 .pngs within the./outdirectory.- Use the current generation’s
bash(if not on NixOS, please )#!/run/current-system/sw/bin/bashwhile read line do
- First, we convert the lines of tex to .svg files (so that scaling becomes as easy as changing a variable)
tex2svg $line ./out/$line.svg
- Then, we use inkscape to convert .svg -> .png. The
-Dflag crops the final image to the bounding box of the fragment.inkscape -D -w 256 -h 256 ./out/$line.svg -o ./out/$line.png
- Removing the intermediate .svg.
rm ./out/$line.svg - We take
equations.txtin the current directory as input.done < equations.txt
- Use the current generation’s
equations.txthouses the \(\LaTeX\) fragments to be generatedIts format dictates that each fragment occupies one line. There needs to be inline (
$) or block ($$) markers surrounding parts of fragments where it would be necessary in a normal.texdocument.You need to escape backslashes (replace
\with\\).