Skip to content

Repository files navigation

Untexify-data

This is the repository storing the initial data and scripts to generate datasets of \(\LaTeX\) images of varying formats and dimensions.

Dependencies

  • ~tex2svg~[fn:1]
  • pdf2svg
  • inkscape (>1.0)

Installation

The easiest way to use this is with Nix (with flakes enabled). First, install tex2svg according to its instructions. Then, run nix develop in this directory. All other dependencies should be made available in the resulting shell.

Usage

  • convert.sh is the main executable When run, it will convert all of the lines of fragments in equations.txt into 256x256 .pngs within the ./out directory.
    1. Use the current generation’s bash (if not on NixOS, please )
      #!/run/current-system/sw/bin/bash
                
      while 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 -D flag 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.txt in the current directory as input.
      done < equations.txt
                
  • equations.txt houses the \(\LaTeX\) fragments to be generated

    Its 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 .tex document.

    You need to escape backslashes (replace \ with \\).

Footnotes

[fn:1] https://github.com/yannikschaelte/tex2svg

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages