Skip to content
/ latex Public
forked from mbr/latex

Python wrappers for calling LaTeX/building LaTeX documents.

License

Notifications You must be signed in to change notification settings

Anupam-/latex

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

latex

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 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 bytes(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

About

Python wrappers for calling LaTeX/building LaTeX documents.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%