latexdocs


Namelatexdocs JSON
Version 0.0.2 PyPI version JSON
download
home_pagehttps://github.com/BALOGHBence/latexdocs
SummaryA Python library to generate publication-ready documents with LaTeX.
upload_time2022-09-12 21:38:28
maintainer
docs_urlNone
authorBence Balogh
requires_python>=3.7, <3.11
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![CircleCI](https://circleci.com/gh/dewloosh/latexdocs.svg?style=shield)](https://circleci.com/gh/dewloosh/latexdocs) 
[![Documentation Status](https://readthedocs.org/projects/latexdocs/badge/?version=latest)](https://latexdocs.readthedocs.io/en/latest/?badge=latest) 
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![PyPI](https://badge.fury.io/py/latexdocs.svg)](https://pypi.org/project/latexdocs) 

# **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](https://github.com/JelteF/PyLaTeX), but offers a different approach to structuring your document or writing custom extensions.

## **Documentation**

Click [here](https://latexdocs.readthedocs.io/en/latest/) 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

```console
>>> python -m venv venv_name
```

Once the enviroment is created, activate it via typing

```console
>>> .\venv_name\Scripts\activate
```

`latexdocs` can be installed (either in a virtual enviroment or globally) from PyPI using `pip` on Python >= 3.7:

```console
>>> pip install latexdocs
```

Installing latex on different operating systems is well described [here](https://latex-tutorial.com/installation/).

## **Basic Example**

The equivalent of the [example](https://jeltef.github.io/PyLaTeX/current/examples/full.html) provided by the folks at `PyLaTeX` would be the following:

```python
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)

```console
>>> python -m unittest
```

## **License**

Copyright 2022 Bence Balogh, under [the MIT license](https://github.com/dewloosh/latexdocs/blob/master/LICENSE).



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/BALOGHBence/latexdocs",
    "name": "latexdocs",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7, <3.11",
    "maintainer_email": "",
    "keywords": "",
    "author": "Bence Balogh",
    "author_email": "benceeok@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/21/10/7ad4f01d75735538f15fb03397e3980773e027f9112786ba3276f7c55a57/latexdocs-0.0.2.tar.gz",
    "platform": null,
    "description": "[![CircleCI](https://circleci.com/gh/dewloosh/latexdocs.svg?style=shield)](https://circleci.com/gh/dewloosh/latexdocs) \n[![Documentation Status](https://readthedocs.org/projects/latexdocs/badge/?version=latest)](https://latexdocs.readthedocs.io/en/latest/?badge=latest) \n[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![PyPI](https://badge.fury.io/py/latexdocs.svg)](https://pypi.org/project/latexdocs) \n\n# **latexdocs** - A document generation solution for LaTeX\n\nlatexdocs is a Python library with the goal of making the generation of LaTeX documents as easy as possible. It builds on [PyLaTeX](https://github.com/JelteF/PyLaTeX), but offers a different approach to structuring your document or writing custom extensions.\n\n## **Documentation**\n\nClick [here](https://latexdocs.readthedocs.io/en/latest/) to read the documentation.\n\n## **Installation**\nThis 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\n\n```console\n>>> python -m venv venv_name\n```\n\nOnce the enviroment is created, activate it via typing\n\n```console\n>>> .\\venv_name\\Scripts\\activate\n```\n\n`latexdocs` can be installed (either in a virtual enviroment or globally) from PyPI using `pip` on Python >= 3.7:\n\n```console\n>>> pip install latexdocs\n```\n\nInstalling latex on different operating systems is well described [here](https://latex-tutorial.com/installation/).\n\n## **Basic Example**\n\nThe equivalent of the [example](https://jeltef.github.io/PyLaTeX/current/examples/full.html) provided by the folks at `PyLaTeX` would be the following:\n\n```python\nfrom latexdocs import Document, TikZFigure, Image\nfrom pylatex import Alignat, Matrix, Math, Tabular, Plot\nfrom pylatex.utils import italic\nimport numpy as np\n\nimage_filename = 'image.png'\n\ndoc = Document()\n\ndoc['Some basic content'].append('Some regular text and some')\ndoc['Some basic content'].append(italic('italic text. '))\ndoc['Some basic content'].append('\\nAlso some crazy characters: $&#{}')\ndoc['Some basic content', 'Math that is incorrect'].append((Math(data=['2*3', '=', 9])))\n\na = np.array([[100, 10, 20]]).T\nM = np.matrix([[2, 3, 4],\n                [0, 0, 1],\n                [0, 0, 2]])\n\ncontent = Math(data=[Matrix(M), Matrix(a), '=', Matrix(M * a)])\ndoc['Another section', 'Correct matrix equations'].append(content)\n\ntable = Tabular('rc|cl')\ntable.add_hline()\ntable.add_row((1, 2, 3, 4))\ntable.add_hline(1, 2)\ntable.add_empty_row()\ntable.add_row((4, 5, 6, 7))\ndoc['Some basic content', 'Table of something'].append(table)\n\nagn = Alignat(numbering=False, escape=False)\nagn.append(r'\\frac{a}{b} &= 0 \\\\')\nagn.extend([Matrix(M), Matrix(a), '&=', Matrix(M * a)])\ndoc['Another section', 'Alignat math environment'].append(agn)\n\nfig = TikZFigure(plot_options='height=4cm, width=6cm, grid=major')\nfig.append(Plot(name='model', func='-x^5 - 242'))\ncoordinates = [\n    (-4.77778, 2027.60977),\n    (-3.55556, 347.84069),\n    (-2.33333, 22.58953),\n    (-1.11111, -493.50066),\n    (0.11111, 46.66082),\n    (1.33333, -205.56286),\n    (2.55556, -341.40638),\n    (3.77778, -1169.24780),\n    (5.00000, -3269.56775),\n]\nfig.append(Plot(name='estimate', coordinates=coordinates))\ndoc['Another section']['Beautiful graphs'].append(fig)\n\nimg = Image(filename=image_filename, position='h!', \n            caption='A simple structure.', width='350px')\ndoc['Another section']['An image'].append(img)\n\n# doc.build() returns a pylatex.Document instance\ndoc.build().generate_pdf('basic_example', compiler='pdflatex')\n```\n\n## **Contributing**\n\nSince latexdocs builds on PyLaTeX, we suggest you to contribute to that package and enjoy the result here.\n\n## **Testing**\n\nTo 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)\n\n```console\n>>> python -m unittest\n```\n\n## **License**\n\nCopyright 2022 Bence Balogh, under [the MIT license](https://github.com/dewloosh/latexdocs/blob/master/LICENSE).\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A Python library to generate publication-ready documents with LaTeX.",
    "version": "0.0.2",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "dd4d180b98d72c51d27e59cfdd25ad48",
                "sha256": "08986704baee75fe886c2fde344b6220944c0b7f9115db71eb8520493a017a47"
            },
            "downloads": -1,
            "filename": "latexdocs-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dd4d180b98d72c51d27e59cfdd25ad48",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7, <3.11",
            "size": 13110,
            "upload_time": "2022-09-12T21:38:26",
            "upload_time_iso_8601": "2022-09-12T21:38:26.111847Z",
            "url": "https://files.pythonhosted.org/packages/98/f7/16c769a3631322f9a81187866e70966d349d135272b909eda80ba24d0697/latexdocs-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "32f2ccebee967aaf2c945728ffef0084",
                "sha256": "76022799976551c4b0dfca0f15bac354502fda6e5712c99683c281a226057edb"
            },
            "downloads": -1,
            "filename": "latexdocs-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "32f2ccebee967aaf2c945728ffef0084",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7, <3.11",
            "size": 13321,
            "upload_time": "2022-09-12T21:38:28",
            "upload_time_iso_8601": "2022-09-12T21:38:28.350921Z",
            "url": "https://files.pythonhosted.org/packages/21/10/7ad4f01d75735538f15fb03397e3980773e027f9112786ba3276f7c55a57/latexdocs-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-09-12 21:38:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "BALOGHBence",
    "github_project": "latexdocs",
    "lcname": "latexdocs"
}
        
Elapsed time: 0.04952s