Skip to main content

Wrappers for calling LaTeX/building LaTeX documents.

Project description

Documentation can be found at https://pythonhosted.org/latex .

Allows calling LaTeX from Python without leaving a mess. Similar to the (officially obsolete) tex package, whose successor is not PyPi-installable:

min_latex = (r"\documentclass{article}"
             r"\begin{document}"
             r"Hello, world!"
             r"\end{document}")

from latex.build import build_pdf

# this builds a pdf-file inside a temporary directory
pdf = build_pdf(min_latex)

# look at the first few bytes of the header
print pdf[:10]

Also comes with support for using Jinja2 templates to generate LaTeX files.

make_env can be used to create an Environment that plays well with LaTex:

Variables can be used in a LaTeX friendly way: Hello, \VAR{name|e}.

Note that autoescaping is off. Blocks are creating using the block macro:

\BLOCK{if weather is 'good'}
Hooray.
\BLOCK{endif}

\#{comments are supported as well}
%# and so are line comments

To keep things short, line statements can be used:

%- if weather is good
Yay.
%- endif

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-0.4.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file latex-0.4.tar.gz.

File metadata

  • Download URL: latex-0.4.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for latex-0.4.tar.gz
Algorithm Hash digest
SHA256 424d02741cb94f36263cb7736c258a2fc066c5626b583e1c46cb6a972477fb7b
MD5 2f5d0ebacfcd898cba28c5956d93d52b
BLAKE2b-256 d9acb2f158014a67828cd9f8003f40f46e85a7ab9ff1d5e30f128eee656126d9

See more details on using hashes here.

Supported by

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