Skip to main content

LaTeX Include

Resolve \include and \input commands in a LaTeX document as LaTeX does.

Some LaTeX tools like for example latexdiff cannot resolve \include and \input commands. This package resolves \include and \input creating a single LaTeX document that replaces the commands with the included files.

According to the LaTeX specification \input is recursively replaced by the included files. Opposed to that \include is only resolved one level deep and if the preamble contains an \includeonly command then only the include files listed in \includeonly are replaced. Other \include commands are ignored. This package considers this specification.

Documentation

Complete documentation is available on Read the Docs.

Changelog

See CHANGELOG.md

Installation

To use latex-include as executable script install it with pip or pipx:

pip(x) install latex-include

To use latex-include within Python import it with hyphen replaces by underscore:

import latex_include

Usage

As command line tool

After installation with pip or pipx (see above) the command latex-include is available.

Calling latex-include --help reproduces the following help text:

usage: latex-include [-h] -i INPUT [-o OUTPUT] [-w]

Resolve input/include commands in a LaTeX file to a single file

options:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        Main LaTeX file to resolve
  -o OUTPUT, --output OUTPUT
                        Output file, default is stdout
  -w, --overwrite       Silently overwrite existing diff (default: False)
  --version             Show version number and exit

Note, that stdin cannot be used for input, because we need the directory of the input file to find included files.

As Python package

The packge provides the following functions:

  • latexInclude receives an open input and an open output text stream resolving the inclusion commands in the input to create the output.
  • latexIncludeFiles receives an input file path and optionally an output file path. It opens the files and calls latexInclude with them. If the output argument is omitted output will be printed to stdout.

For details how to call these functions see reference documentation on Read the Docs or generate documentation locally as described below.

Contributing

Create issues or a pull requests to point out bugs or improvements.

We use uv as development and packaging tool so you may use uv sync to create a virtual environment with all required packages and execute the scripts with uv run. Likely poetry will work as well.

When contributing a pull request please check these points in addition to your tests:

  • Add a short description in Changelog under Next
  • Does the documentation still build and documents your changes?

Documentation is built with MkDocs. Call uv run mkdocs build --clean from the base directory and open site/index.html in a browser to check the results. You may use the MKDocs server to see your doc changes live (note: opposed to the MkDocs documentation you have to give option --livereload besides --watch to make it work).

Metadata

Release files for latex-include 0.1.1

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-include 0.1.1
File Size Uploaded
latex_include-0.1.1.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for latex-include 0.1.1
File Interpreter ABI Platform
latex_include-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / latex_include-0.1.1.tar.gz

Download URL latex_include-0.1.1.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5e9dcf9d5bb2c96d7f2f86848494e0a5591366fbfbd371d11e36cfe345294c09
BLAKE2b-256 checksum
How to use checksums
c0afc3f2fbcbd60d85a98ef3f26463ee5ec958f1c0393b269585e19a5967ed82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Manjaro Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / latex_include-0.1.1-py3-none-any.whl

Download URL latex_include-0.1.1-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f85d30cbd50ee054064da9fc40980cb5714f1984a4f7f2775948b676c8c7735a
BLAKE2b-256 checksum
How to use checksums
6c11386ad978d02397ec208d499b5a6f07216e5fd057fb8c07619f5439eaf830
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Manjaro Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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