Skip to main content

PyPI version REUSE status

🗜️ Flatten the file structure of a LaTeX document

✨ What can it do?

  • replace \input{FILE} with contents of FILE
  • point all \includegraphics{PATH} next to the .tex file
  • replace \bibliography with contents of .bbl file (--replace-bib, needed e.g. for PLoS)
  • Rename figure filenames like fig3.pdf (--sequential-figures)
  • Hide figures by commenting \includegraphics{} (--hide-figures, needed for PLoS)
  • copy all source files next to the LaTeX file (--inplace)
  • modify your LaTeX file in-place (--inplace)
  • make a new folder with the flattened LaTeX project structure (--outdir MYDIR)
  • make a ZIP file with the flattened LaTeX project structure (--zip)

These steps are necessary for some Journals (e.g. Springer, PLoS, etc.). With latex-flatten, one can work flexibly on a manuscript with a nested structure and included files and flatten the project only before submission.

📝 TODO - Known Issues - Planned Features

  • Have --hide-figures and --sequential-figures operate only within figure environments. The currently don't know whether they're manipulating an actual figure or just a random included graphic anywhere.
  • Use relative (not absolute) symlinks for linking to --outdir.
  • Find input files from TEXINPUTS
  • 🐛 If the same graphic file is \includegraphicsed multiple times, it will only land once in the outdir or ZIP.

❓ Usage

You can run this tool if you have nix installed:

nix run gitlab:nobodyinperson/latex-flatten

# or with arguments (note the lonely double dash --)
nix run gitlab:nobodyinperson/latex-flatten -- --help

Otherwise, you can install it like any other Python package, e.g. with pip or better pipx:

pipx install latex-flatten

# latest development version
pipx install git+https://gitlab.com/nobodyinperson/latex-flatten

This installs the latex-flatten command:

# will operate on all *.tex documents in this folder
latex-flatten 

# specific document
latex-flatten myfile.tex 

# Make a ZIP for PLoS submission
latex-flatten --plos --zip

# Make a new folder with flattened LaTeX structure (to check compilation, etc.)
latex-flatten --outdir FLATTENED

# Make a flat ZIP from your LaTeX project
latex-flatten --zip

# Be moreo chatty, useful for debugging
latex-flatten -vvv

# Help
latex-flatten --help

🛠️ Workflow

  1. Compile LaTeX successfully with latexmk or pdflatex -recorder once
  2. Run this script next to (or on) the .tex file.

Before using --inplace, you should probably back up your files or git-track them to see the differences and revert in case something unexpected happens.

Metadata

Release files for latex-flatten 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for latex-flatten 0.3.0
File Size Uploaded Provenance
latex_flatten-0.3.0.tar.gz 11.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for latex-flatten 0.3.0
File Interpreter ABI Platform
latex_flatten-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.0 kB

Release files / latex_flatten-0.3.0.tar.gz

Download URL latex_flatten-0.3.0.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
671cd00d1289f86df5dfb80e80daf16fa1ddf8d222567f978e956306f3ad601d
BLAKE2b-256 checksum
How to use checksums
d8967d8050ef723035597c8ff2083faa88c400b8c71db6437bf553b37e8e168c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.6 Linux/6.1.65

Release files / latex_flatten-0.3.0-py3-none-any.whl

Download URL latex_flatten-0.3.0-py3-none-any.whl
Size 23.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16d7ed0f4d21e59075f8597104313adb6ba1f0e89baa0295e79bdf649f4030c7
BLAKE2b-256 checksum
How to use checksums
71632f4bd4263a5c2cb0a51d5558046d3e6c6f5271ddd79150548980a4da41c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.6 Linux/6.1.65

Security for latex-flatten 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page