Skip to main content

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

Project description

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).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

latex_include-0.1.1rc1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

latex_include-0.1.1rc1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file latex_include-0.1.1rc1.tar.gz.

File metadata

  • Download URL: latex_include-0.1.1rc1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for latex_include-0.1.1rc1.tar.gz
Algorithm Hash digest
SHA256 88376c20aa6002449ac00680e57e3719340bb0eb0fea759f566abcf447055dc6
MD5 81f8c6822ffbbb37de359451686ad8f4
BLAKE2b-256 4932e1e03c7f141daf484f29a7e18fcd0e2a9927268bd87ad146baeec50abd0f

See more details on using hashes here.

File details

Details for the file latex_include-0.1.1rc1-py3-none-any.whl.

File metadata

  • Download URL: latex_include-0.1.1rc1-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for latex_include-0.1.1rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 d8120ef59bd17b3e26564ff276e178b05de55d904552e3aa015fc59ccbb34db2
MD5 fee6ea8f64843c47b5a9d1b37a456270
BLAKE2b-256 3214d1f35ae6604813d07d29b06385e43fbfdce40e87489d135eddf747c9ad1e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page