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.
License
See License
Changelog
See Changelog
Purpose
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
Documentation is generated with MkDocs. See Contributing below for details.
Installation
Prerequesites
- Python3 is available with at least the version set in
pyproject.toml
Install
The installation itself can be done with pip or pipx:
pip(x) install latex-include
Usage
The package provides multiple levels of access:
- Function
latexIncludereceives an open input and an open output text stream resolving the inclusion commands in the input to create the output. - Function
latexIncludeFilesreceives an input file path and optionally an output file path. It opens the files and callslatexIncludewith them. If the output argument is omitted output will bestdout. - The package can be executed from the command line with the command
latex-include(see options below).
See generated documentation for details how to call the Python functions.
Command line options
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.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file latex_include-0.1.0.tar.gz.
File metadata
- Download URL: latex_include-0.1.0.tar.gz
- Upload date:
- Size: 6.3 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
272bd8565cc0236069c3822eb5e33a339a5045f2dc379a2129ea3c4cb00ece4a
|
|
| MD5 |
5ace56774d4dd0bcda67ccc80cde5936
|
|
| BLAKE2b-256 |
283a2423155b8887eb113a0c47d033e7cb0ab0f58f8c45757bdde21287b936b4
|
File details
Details for the file latex_include-0.1.0-py3-none-any.whl.
File metadata
- Download URL: latex_include-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.8 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
768580033b6e1c6a1f64bc719839d46e59fc7c926927161cd12f409a30088c26
|
|
| MD5 |
63f72e4acba0adf4496e43d821b57904
|
|
| BLAKE2b-256 |
745898ff66ecac496284db150161725151035f663d93164f2f463f738a38052e
|