在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):mbr/latex开源软件地址(OpenSource Url):https://github.com/mbr/latex开源编程语言(OpenSource Language):Python 100.0%开源软件介绍(OpenSource Introduction):latexDocumentation 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.
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 Example usefrom jinja2.loaders import FileSystemLoader
from latex.jinja2 import make_env
env = make_env(loader=FileSystemLoader('.'))
tpl = env.get_template('doc.latex')
print(tpl.render(name="Alice")) The \documentclass{article}
\begin{document}
\BLOCK{block body}\BLOCK{endblock}
\end{document} Finally, %- extends "base.latex"
%- block body
Hello, \VAR{name|e}.
%- endblock Translations using BabelStrings from [jinja2: *.latex]
block_start_string = \BLOCK{
block_end_string = }
variable_start_string = \VAR{
variable_end_string = }
comment_start_string = \#{
comment_end_string = }
line_statement_prefix = %-
line_comment_prefix = %#
trim_blocks = True
autoescape = False |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论