latexdocs - A document generation solution for LaTeX
latexdocs is a Python library with the goal of making the generation of LaTeX documents as easy as possible. It builds on PyLaTeX, but offers a different approach to structuring your document or writing custom extensions.
Documentation
Click here to read the documentation.
Installation
This is optional, but we suggest you to create a dedicated virtual enviroment at all times to avoid conflicts with your other projects. Create a folder, open a command shell in that folder and use the following command
>>> python -m venv venv_name
Once the enviroment is created, activate it via typing
>>> .\venv_name\Scripts\activate
latexdocs can be installed (either in a virtual enviroment or globally) from PyPI using pip on Python >= 3.7:
>>> pip install latexdocs
Installing latex on different operating systems is well described here.
Basic Example
The equivalent of the example provided by the folks at PyLaTeX would be the following:
from latexdocs import Document, TikZFigure, Image
from pylatex import Alignat, Matrix, Math, Tabular, Plot
from pylatex.utils import italic
import numpy as np
image_filename = 'image.png'
doc = Document()
doc['Some basic content'].append('Some regular text and some')
doc['Some basic content'].append(italic('italic text. '))
doc['Some basic content'].append('\nAlso some crazy characters: $&#{}')
doc['Some basic content', 'Math that is incorrect'].append((Math(data=['2*3', '=', 9])))
a = np.array([[100, 10, 20]]).T
M = np.matrix([[2, 3, 4],
[0, 0, 1],
[0, 0, 2]])
content = Math(data=[Matrix(M), Matrix(a), '=', Matrix(M * a)])
doc['Another section', 'Correct matrix equations'].append(content)
table = Tabular('rc|cl')
table.add_hline()
table.add_row((1, 2, 3, 4))
table.add_hline(1, 2)
table.add_empty_row()
table.add_row((4, 5, 6, 7))
doc['Some basic content', 'Table of something'].append(table)
agn = Alignat(numbering=False, escape=False)
agn.append(r'\frac{a}{b} &= 0 \\')
agn.extend([Matrix(M), Matrix(a), '&=', Matrix(M * a)])
doc['Another section', 'Alignat math environment'].append(agn)
fig = TikZFigure(plot_options='height=4cm, width=6cm, grid=major')
fig.append(Plot(name='model', func='-x^5 - 242'))
coordinates = [
(-4.77778, 2027.60977),
(-3.55556, 347.84069),
(-2.33333, 22.58953),
(-1.11111, -493.50066),
(0.11111, 46.66082),
(1.33333, -205.56286),
(2.55556, -341.40638),
(3.77778, -1169.24780),
(5.00000, -3269.56775),
]
fig.append(Plot(name='estimate', coordinates=coordinates))
doc['Another section']['Beautiful graphs'].append(fig)
img = Image(filename=image_filename, position='h!',
caption='A simple structure.', width='350px')
doc['Another section']['An image'].append(img)
# doc.build() returns a pylatex.Document instance
doc.build().generate_pdf('basic_example', compiler='pdflatex')
Contributing
Since latexdocs builds on PyLaTeX, we suggest you to contribute to that package and enjoy the result here.
Testing
To run all tests, open up a console in the root directory of the project and type the following (requires the unittest library to be installed)
>>> python -m unittest
License
Copyright 2022 Bence Balogh, under the MIT license.
Metadata
Release files for latexdocs 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| latexdocs-0.0.2.tar.gz | 13.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| latexdocs-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.4 kB
Release files / latexdocs-0.0.2.tar.gz
| Download URL | latexdocs-0.0.2.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
76022799976551c4b0dfca0f15bac354502fda6e5712c99683c281a226057edb
|
|
BLAKE2b-256 checksum How to use checksums |
21107ad4f01d75735538f15fb03397e3980773e027f9112786ba3276f7c55a57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.10
|
Release files / latexdocs-0.0.2-py3-none-any.whl
| Download URL | latexdocs-0.0.2-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
08986704baee75fe886c2fde344b6220944c0b7f9115db71eb8520493a017a47
|
|
BLAKE2b-256 checksum How to use checksums |
98f716c769a3631322f9a81187866e70966d349d135272b909eda80ba24d0697
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.10
|
Security for latexdocs 0.0.2
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.