Skip to main content

Preprocessor to generate LaTeX/beamer files

Project description

beamer_gen

Preprocessor to generate LaTeX-beamer code from a more compact language.

The needs for a new sub language were:

  • compactness: so as to type as few formatting informations as possible,
  • expressiveness: allow to format most beamer frames with clear and short syntax,
  • flexibility: allowance for LaTeX without too much overhead.

In TeX, environments are enclosed into \begin{env} and \end{env} tags which makes it unambiguous but requires duplicating the name of the environment. Here, for compactness, the choice is made instead to use indentation as environment markers. Indentation is therefore significant and compulsory.

Features

beamer_gen code has shortcuts for the following current LaTeX/beamer features:

  • sections, using s Section title,
  • subsections, using ss Subsection title,
  • frames, using + Frame title,
  • blocks, using b Block title,
  • itemize, using - item text with automatic environment creation,
  • enumerate, using # item text with automatic environment creation,
  • columns, using c{ratio} (ratio relative to \columnwidth) with automatic environment creation,
  • figures, using f{ratio}[options]{filename} (ratio relative to \columnwidth, it can be omitted).

In addition, options can be placed to some environments that are implicitly defined by inserting them before:

  • itemize, using {itemize} commands
  • columns, using {columns}[options]

Beamer overlay directives (<...>) are supported for most elements. Frames and items can also have options ([...]), in which case, they must be specified after an optional beamer directive (+<+->[fragile] Title, or -<+->[\square] item for instance). Columns can also have a placement option (e.g. [c]), which needs to be specified before the size.

Everything else is reproduced verbatim.

Usage

Usage is straightforward:

usage: beamer_gen.py [-h] filename [filename ...]

Generate LaTeX/beamer files from a stub.

positional arguments:
  filename    name of the file to be processed.

optional arguments:
  -h, --help  show this help message and exit

Each file is processed by creating a new file with the original extension replaced by .tex.

Example

The following source:

+[allowframebreaks] Example 1
    b<+-> Example block
        - first item
            # subitem in enumerate
            # other subitem
        - second item
        -<2>[!] third item
    b<+-> second block
        {columns}[T]
        c{0.4}
            f<3->{0.8}{figure1.png}\\caption text
        c[t]{0.6}
            Some generic text:
            {itemize}<+-> \itemsep 1.5em
            - and
            - items
            {enumerate}<+->
            # and numbered
            # items
    f{1}[draft]{figure2.png}

    f<4>[height=2cm]{figure3.png}

translates into:

\begin{frame}[allowframebreaks]
    \frametitle{Example 1}
    \begin{block}<+->{Example block}
        \begin{itemize}
            \item first item
            \begin{enumerate}
                \item subitem in enumerate
                \item other subitem
            \end{enumerate}
            \item second item
            \item<2>[!] third item
        \end{itemize}
    \end{block}
    \begin{block}<+->{second block}
        \begin{columns}[T]
            \column{0.4\columnwidth}
            \includegraphics<3->[width=0.8\columnwidth]{figure1.png}\\caption text
            \column[t]{0.6\columnwidth}
            Some generic text:
            \begin{itemize}<+-> \itemsep 1.5em
                \item and
                \item items
            \end{itemize}
            \begin{enumerate}<+->
                \item and numbered
                \item items
            \end{enumerate}
        \end{columns}
    \end{block}
    \includegraphics[width=1\columnwidth,draft]{figure2.png}

    \includegraphics[height=2cm]{figure3.png}
\end{frame}

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

beamer_gen-1.6.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

beamer_gen-1.6.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file beamer_gen-1.6.0.tar.gz.

File metadata

  • Download URL: beamer_gen-1.6.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for beamer_gen-1.6.0.tar.gz
Algorithm Hash digest
SHA256 7fc685124542ef5470eebed4257d0d10bb9725656d68757bd78d5cf0db64ea7c
MD5 ee341ed46a7b284dd505d89dd8ad4692
BLAKE2b-256 989d44587a16ddc708e5d85ca7543b5b266b01519e93e7a8f861c040ee519ad5

See more details on using hashes here.

File details

Details for the file beamer_gen-1.6.0-py3-none-any.whl.

File metadata

  • Download URL: beamer_gen-1.6.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for beamer_gen-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8397c5e4a8c24c238c8d6688d008bc6f497ab50e36aece2281e39592da9003c9
MD5 bae36c45b11800acd5f14b0fcd969a56
BLAKE2b-256 4e69e19bbc408c72b4519a1e7a08c4a5b9c82f6c8ab509133f6316abfa0d10b9

See more details on using hashes here.

Supported by

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