Welcome to Python Extends LaTeX documentation!¶
To get started, look here.
An overview¶
pyexlatex
lets you create PDF and HTML documents and
presentations with a high-level API. Getting started is
as simple as:
pl.Document("some content")
It has two APIs, object-oriented and template-driven, to
suit different workflows. pyexlatex
makes it easy
to insert data into your document.
Object-oriented:
my_value = 5
contents = [
pl.Section(
[
f'Some text. My value is {my_value}.',
pl.UnorderedList([
'A bullet',
'List'
])
],
title='First Section'
)
]
pl.Document(contents)
Template-driven:
template = """
{% filter Section(title='First Section') %}
Some text. My value is {{ my_value }}.
{{ [
'A bullet',
'List'
] | UnorderedList }}
{% endfilter %}
"""
class MyModel(pl.Model):
my_value = 5
content = [MyModel(template_str=template)]
pl.Document(content)
Presentations are supported too.
pres_content = [
pl.Frame(
[
'Some text',
pl.Block(
[
'more text'
],
title='My Block'
),
pl.OrderedList(["one", "two"])
]
)
]
pl.Presentation(pres_content)
Document Types¶
|
Main class used for creating latex documents. |
|
The main high-level class for creating one-off graphics, equations, etc. |
|
The main high-level class for creating presentations, can render presentations as PDF in either a presenter style or a handouts style. |
Equations¶
|
Pass sympy or string equations to have them rendered in LaTeX. |
Sections¶
|
A paragraph, the second smallest section block. |
|
Part of a paragraph, the smallest section block. |
|
A section of the document, the second largest section type. |
|
A part of a section, the third largest section type. |
|
A part of a subsection, the fourth largest section type. |
|
Content to be placed at the end, separate from the main document. |
|
Adds a header to a document, aligned to right, center, or left. |
Text¶
|
Makes text bold. |
|
Adds an underline to text. |
|
Italicizes text. |
|
Resize text in this group by a relative size. |
|
Changes the color of text. |
|
Pass text to render it in a monospace font. |
|
Makes text all caps, but with originally capital letters slightly larger than other letters. |
|
Don't replace latex characters in this blocks such as or %, useful for adding latex commands or comments manually. |
|
Creates a footnote at the bottom of the page, with a mark next to where the object itself is placed to reference the footnote. |
|
Renders passed contents as Python code, with syntax highlighting. |
Gets a reference to the current page number, can be included in headers and more. |
|
|
Used for setting paragraph indents, from the left or right. |
|
Displays the string "LaTeX" with special formatting |
Lists¶
|
Bullet point items. |
Figures¶
|
Used for creating latex figures from images. |
|
Used for more control over building figures |
|
Basic class for including graphics, just the image with no structure. |
Tables¶
|
Represents one section of a table. |
|
Represents a subsection in a panel, but tracks row and column labels, which may be consolidated when assembled into Panels then a Table |
|
Represents one row of labels. |
|
A set of label rows to apply to a DataTable. |
|
Only necessary to use if need to set span or alignment manually. |
|
An object for creating latex tables. |
|
The main part of a LaTeX table which contains the rows and columns. |
|
Python interface for a part of a table containing rows and columns with values |
|
Alignment of a single column in a table |
|
A set of column alignments, usually for the whole table |
|
A line which can be added on the top of a table |
|
A line which can be added in the middle of a table |
A line which can be added at the bottom of a table |
|
|
A table line which does not need to stretch to the full length of the table |
|
A label which spans multiple columns in a table |
|
A line break character to be used in LaTeX tables |
|
tabular* environment, allows for controlling width. |
Layouts and Spacing¶
|
Align the passed contents to the center of the container |
Adds a break point where a new page should be started. |
|
|
Vertical fill, put between items to put vertical spacing between them. |
|
Horizontal fill, put between items to put horizontal spacing between them. |
|
Manually insert vertical spacing, of a given height. |
|
Manually insert horizontal spacing, of a given length. |
|
Draws a horizontal line across the text width. |
|
Create an intentional line break in text |
|
Contents within this environment will not have a page break come in the middle. |
|
Prevents a line break within text, where a hyphen would normally be placed. |
|
Returns paragraph to the default of justifying text on both left and right. |
|
Groups together latex items so that "global" commands will only affect the items in a group |
|
Lay content out in a grid where each cell is arbitrarily sized |
|
Evenly spaced grid layout. |
|
Multi-column layout that does not make any constraints on vertical sizing. |
|
Inserts vertical spacing between items until they fill the content area |
|
Inserts horiztonal spacing between items until they fill the content area |
|
Layout multiple columns in a text area |
References¶
|
Pass a label to create an in text reference to that label. |
|
Pass a label to create an in text reference to that label. |
|
A label which can later be referred to by Ref |
|
Create links to urls, with or without displaying text instead of the link. |
Citations¶
|
Biblography document which is an article. |
|
Biblography document which is of miscellaneous type. |
|
Biblography document which is a manual. |
|
High-level class for working with bibliographies in LaTeX. |
|
Basic citation command, creates a reference to a document included in the bibliography. |
|
Paragraph citation command, creates a paragraph (with parentheses) reference to a document included in the bibliography. |
|
In text citation command, creates an in text (without parentheses) reference to a document included in the bibliography. |
Presentations¶
|
The main high-level class for creating presentations, can render presentations as PDF in either a presenter style or a handouts style. |
|
Basic unit for creating a slide in a presentation. |
|
Block with an optional header |
|
Block with an optional header which is red |
|
Block which always has the header title "Examples" |
|
Takes content and adjusts it to 90% text width, 80% text height, but keeping the aspect ratio. |
|
Creates a CellFrame, automatically setting widths and heights as an even split based on the shape of the content passed |
|
Single list item which reveals on each slide one-by-one and as the next one reveals, the last one dims. |
List items which reveal on each slide one-by-one and as the next one reveals, the last one dims. |
|
A TwoColumnGraphicFrame where the non-graphic column is bulleted or numbered dim and reveal items |
|
A GridFrame with graphics on one side and text on the other. |
|
Similar to TwoColumnGraphicFrame, but does not put any constraints on vertical sizing |
|
|
Similar to TwoColumnFrame but does not put any constraints on vertical sizing |
|
Creates a GridFrame, automatically setting widths and heights as an even split based on the shape of the content passed |
|
A Frame where the content is bulleted or numbered dim and reveal items |
|
Resizes passed graphic to take up entire frame. |
|
Resizes each graphic to full width and puts vertical space in between graphics. |
|
Creates an effect on a frame such as appearing on a later frame. |
|
Option to be passed to Overlay which says object should exist on the frame on a certain range of slides e.g. |
|
Option to be passed to Overlay which makes object appear on the next slide of the frame, and creates an additional slide |
|
Option to be passed to Overlay which makes object appear on the next slide of the frame, and does not creates an additional slide |
|
Option to be passed to Overlay that makes object exist until the end of the frame |
|
Appendix to be used in a beamer presentation |
Colors¶
|
Define a color using an RGB code, such as RGB(33, 173, 42) |
|
Define a color using a hex code, such as #21ad2a |
Template-Driven¶
|
Base class for creating custom Pyexlatex templates. |
|
Base class which makes it easy to create new environment types. |
|
A jinja Environment but with pyexlatex models as built in filters and handling extracting pyexlatex data |
|
A jinja Template but with pyexlatex models as built-in filters and handling extracting pyexlatex data |
|
A data model combined with a Jinja template. |
LaTeX Package Management¶
|
Represents LaTeX usepackage{}, pass to Document if any custom LaTeX packages are needed. |
API Documentation¶
A full list of modules