Documents¶
- class latexdocs.document.BaseTexDoc(*args, geometry_options=None, title=None, author=None, date=False, doc=None, content=None, **kwargs)[source]¶
Base class for all document types.
- class latexdocs.document.Document(*args, geometry_options=None, title=None, author=None, date=False, doc=None, content=None, **kwargs)[source]¶
Base class to store information about a document.
- Parameters
geometry_options (dict, Optional) – A dictionary containing information about the geometry of the document. Default is None.
title (str, Optional) – The title of the document. Default is None.
author (str, Optional) – The author of the document. Default is None.
date (bool, Optional) – If True, a date is show on the title page. Default is False.
doc (
pylatex.document.Document, Optional) – An instance of pylatex.Document, if you already have one. Default is None.content (list, Optional) – Content related to the current section. Default is None.
Notes
The implementation is not foolproof. For instance, if you ask for the date to be shown but provide no title or author, you are gonna experience problems which I don’t care about (the author). Don’t be dumb.
Example
>>> from latexdocs import Document >>> doc = Document(title='Title', author='Author', date=True)
- append(*args)¶
Appends new content to the current section or item.
Example
>>> from latexdocs import Document >>> doc = Document(title='Title', author='Author', date=True) >>> doc['Section 1'].append('Some regular text')
- build(*args, **kwargs) Document¶
Builds and returns an instance of
pylatex.document.Document.Example
>>> from latexdocs import Document >>> doc = Document(title='Title', author='Author', date=True) >>> doc['Section 1'].append('Some regular text') >>> doc.build()
- generate_pdf(*args, clean_tex=False, compiler='pdflatex', **kwargs)¶
Builds the document and generates a pdf in one go.
- Parameters
args (tuple, Optional) – Extra positional arguments are forwarded to pylatex.Document.generate_pdf.
clean_tex (bool, Optional) – Default is False.
compiler (str, Optional) – The compiler to use. Default is pdflatex. See the docs of PyLaTeX for all the available options.
kwargs (tuple, Optional) – Extra kyeword arguments are forwarded to pylatex.Document.generate_pdf.
Example
>>> from latexdocs import Document >>> doc = Document(title='Title', author='Author', date=True) >>> doc['Section 1'].append('Some regular text') >>> doc.generate_pdf('filename', compiler='pdflatex')
- class latexdocs.document.Article(*args, geometry_options=None, title=None, author=None, date=False, doc=None, content=None, **kwargs)[source]¶
Top level class for articles.
Example
>>> from latexdocs import Article >>> doc = Article(title='Title', author='Author', date=True)
- append(*args)¶
Appends new content to the current section or item.
Example
>>> from latexdocs import Document >>> doc = Document(title='Title', author='Author', date=True) >>> doc['Section 1'].append('Some regular text')
- build(*args, **kwargs) Document¶
Builds and returns an instance of
pylatex.document.Document.Example
>>> from latexdocs import Document >>> doc = Document(title='Title', author='Author', date=True) >>> doc['Section 1'].append('Some regular text') >>> doc.build()
- generate_pdf(*args, clean_tex=False, compiler='pdflatex', **kwargs)¶
Builds the document and generates a pdf in one go.
- Parameters
args (tuple, Optional) – Extra positional arguments are forwarded to pylatex.Document.generate_pdf.
clean_tex (bool, Optional) – Default is False.
compiler (str, Optional) – The compiler to use. Default is pdflatex. See the docs of PyLaTeX for all the available options.
kwargs (tuple, Optional) – Extra kyeword arguments are forwarded to pylatex.Document.generate_pdf.
Example
>>> from latexdocs import Document >>> doc = Document(title='Title', author='Author', date=True) >>> doc['Section 1'].append('Some regular text') >>> doc.generate_pdf('filename', compiler='pdflatex')
- class latexdocs.document.Book(*args, geometry_options=None, title=None, author=None, date=False, doc=None, content=None, **kwargs)[source]¶
Top level class for books.
Example
>>> from latexdocs import Book >>> doc = Book(title='Title', author='Author', date=True)
- append(*args)¶
Appends new content to the current section or item.
Example
>>> from latexdocs import Document >>> doc = Document(title='Title', author='Author', date=True) >>> doc['Section 1'].append('Some regular text')
- build(*args, **kwargs) Document¶
Builds and returns an instance of
pylatex.document.Document.Example
>>> from latexdocs import Document >>> doc = Document(title='Title', author='Author', date=True) >>> doc['Section 1'].append('Some regular text') >>> doc.build()
- generate_pdf(*args, clean_tex=False, compiler='pdflatex', **kwargs)¶
Builds the document and generates a pdf in one go.
- Parameters
args (tuple, Optional) – Extra positional arguments are forwarded to pylatex.Document.generate_pdf.
clean_tex (bool, Optional) – Default is False.
compiler (str, Optional) – The compiler to use. Default is pdflatex. See the docs of PyLaTeX for all the available options.
kwargs (tuple, Optional) – Extra kyeword arguments are forwarded to pylatex.Document.generate_pdf.
Example
>>> from latexdocs import Document >>> doc = Document(title='Title', author='Author', date=True) >>> doc['Section 1'].append('Some regular text') >>> doc.generate_pdf('filename', compiler='pdflatex')