ltximg(1)
π NAME π
okay so bestie, this is ltximg β it's from the General Commands Manual (that's section 1, the commands section, iykyk) and it does exactly one iconic thing: it turns LaTeX environments into image files and standalone files. that's the whole vibe. π
β¨ SYNOPSIS β¨
ltximg [<options>] [--] <filename>.<tex|ltx>
π¦ DESCRIPTION π¦
so ltximg automates the process of extracting and converting environments from a LaTeX file into image formats and standalone files, and it does that using ghostscript and poppler-utils. no cap.
it generates one file with only the extracted environments, and another file with all the extracted environments converted to \includegraphics. two files, two moods, both slay.
and by default, the extracted environments are, in this exact order:
previewpspicturetikzpicturepgfpicturepsgraphpostscriptPSTexample
periodt. that's the starter pack. πΈ
π OPTIONS π
first, the ground rules, because the way that these options work is very specific and we respect it:
- options that accept a value need either a blank space or
=between the option and the value. pick your fighter. - multiple short options can be bundled together β and if the last option in that bundle takes a comma separated list, you need
--at the end. yes really. - relative or absolute paths for directories and files is not supported. like, at all. don't try it, bestie. π
and if you run it with no[<options>]at all? the extracted environments get converted to./imagesdirectory, usingpdflatexand the preview package for the process. easy default, no thoughts needed. π«Ά
β General script options β
-h,--helpβ show the command line help and dip out. exit stage left. πͺ-v,--versionβ show the current version and dip out.-V,--verboseβ verbose printing information. it will tell you things. lots of things. π¬-l,--logβ write a.logfile with debug information.-t,--tifβ create.tiffiles usingghostscript.-b,--bmpβ create.bmpfiles usingghostscript.-j,--jpgβ create.jpgfiles usingghostscript.-p,--pngβ create.pngfiles usingghostscript.-e,--epsβ create.epsfiles usingpdftops.-s,--svgβ create.svgfiles usingpdftocairo.-P,--ppmβ create.ppmfiles usingpdftoppm.-g,--grayβ gray scale for images, usingghostscript.-f,--forceβ capture\pssetand\tikzsetto extract. forceful. πͺ-n,--noprewβ create images files without the preview package.-rinteger,--runs=integer β set the number of times the compiler will run on the input file for environment extraction. default:1.-dinteger,--dpi=integer β dots per inch resolution for images. default:150.-minteger,--margins=integer β set margins in bp forpdfcrop. default:0.-ofilename,--output=filename β create output file.--imgdir=dirname β set the name of the directory to save images and files in. default:images.--prefix=string β set the prefix appended to each generated file. default:fig.--myverb=macroname β add\macronameto the verbatim inline search. default:myverb.--clean=doc|pst|tkz|all|off β removes specific block text in the output file. default:doc.--zipβ compress the generated files in.zipformat.--tarβ compress the generated files in.tar.gzformat.--srcenvβ create files with only the code of environments.--subenvβ create standalone files for environments. main character energy fr fr. π--shellβ enable\write18{SHELL COMMAND}.
okay real talk about that last one:--shellturns on\write18{SHELL COMMAND}, which means shell commands can actually run. be normal about it. π
--latexβ usinglatex>dvips>ps2pdffor compiler input andpdflatexfor compiler output.--dvipsβ usinglatex>dvips>ps2pdffor compiler input andlatex>dvips>ps2pdffor compiler output.--dviluaβ usingdvilualatex>dvips>ps2pdffor compiler input andlualatexfor compiler output.--dvipdfβ usinglatex>dvipdfmxfor compiler input andlatex>dvipdfmxfor compiler output.--xetexβ usingxelatexfor compiler input and output.--luatexβ usinglualatexfor compiler input and output.--araraβ useararafor compiler input and output.--latexmkβ usinglatexmkfor compiler output file.--norunβ run the script, but don't create images files.--nopdfβ don't create a.pdfimage files.--nocropβ don't runpdfcrop.--extrenv=env1,env2,... β add new environments to extract.--skipenv=env1,env2,... β skip some of the default environments to extract.--verbenv=env1,env2,... β add new verbatim environments.--writenv=env1,env2,... β add new verbatim write environments.--deltenv=env1,env2,... β delete environments in the output file.
π EXAMPLE π
ltximg --latex -e -p --subenv -o test-out.ltx test-in.ltx
and here's what that actually gives you, step by step: it creates a ./images directory (if it doesn't exist β it won't yell at you, it'll just make it π) with all the extracted environments converted to .pdf, .eps, .png and standalone files, plus a file test-in-fig-all.ltx with all extracted environments, and the file test-out.ltx with all environments converted to \includegraphics.
all of that using latex>dvips>ps2pdf and the preview package for test-in.ltx, and pdflatex for test-out.ltx. ate. π
π§ DOCUMENTATION π§
for the full documentation, use:
texdoc ltximg
go read it, bestie, it's giving thorough. π
π₯ ISSUES AND REPORTS π₯
- Repository :
https://github.com/pablgonz/ltximg - Bug tracker:
https://github.com/pablgonz/ltximg/issues
found a bug? tell the repo. they wanna know. π«Ά
π AUTHOR π
Pablo GonzΓ‘lez Luengo, pablgonz@yahoo.com.
π COPYRIGHT AND LICENSE π
Copyright 2013-2021 Pablo GonzΓ‘lez, pablgonz@yahoo.com.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
no warranty bestie. none. zero. the lawyers said so. π
πΈ SEE ALSO πΈ
gs(1)dvips(1)ps2pdf(1)pdfcrop(1)pdftops(1)pdftocairo(1)pdftoppm(1)
and that's the whole page!! this was version 2.1, dated 2021-05-21, living in the General Commands Manual β so like, if you ever forget any of this, the manual remembers for you. byeee, go extract some environments πβ¨ππ¦
π¦ where this page comes from
- arch rolling: texlive-doc 2026.1-1 Β· GPL
- debian bookworm: texlive-extra-utils 2022.20230122-4
- debian trixie: texlive-extra-utils 2024.20250309-2
- fedora 43: texlive-ltximg 11:svn59335-93.fc43 Β· GPL-2.0-or-later
- fedora 43: texlive-ltximg 11:svn59335-95.fc43.1 Β· GPL-2.0-or-later
- fedora 44: texlive-ltximg 12:svn59335-105.fc44 Β· GPL-2.0-or-later
- fedora 44: texlive-ltximg 12:svn59335-111.fc44 Β· GPL-2.0-or-later
- opensuse-leap 16.0: texlive-ltximg-doc 2025.221.2.1svn59335-160000.3.1 Β· GPL-2.0-or-later
- ubuntu jammy: texlive-extra-utils 2021.20220204-1
- ubuntu noble: texlive-extra-utils 2023.20240207-1
- ubuntu questing: texlive-extra-utils 2024.20250309-2
- ubuntu resolute: texlive-extra-utils 2025.20260124-1
- ubuntu stonking: texlive-extra-utils 2026.20260711-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms