Coder Social home page Coder Social logo

yml2tex's Introduction

yml2tex

yml2tex is a simple python script which generates LaTeX Beamer code out of YAML files.

Requirements

Usage

Pass yml2tex a YAML file as the first argument. The output will be printed to stdout.

yml2tex foobar.yml > foobar.tex

The document can then be compiled:

pdflatex foobar.tex

Structure

Since LaTeX Beamer presentations are structured in sections, subsections and frames, the YAML file must have the following structure:

Introduction:
    About this presentation:
        Author:
            - Name
            - Age
            - Occupation

"Introduction" would be the title of the section, "About this presentation" the title of the subsection and "Author" the frame title. "Name", "Age" and "Occupation" would be items in a list.

Nested Items

Each item can have other items associated.

Introduction:
    About this presentation:
        Author:
            - Name
            - Age
            - Occupation:
                - 2001 to 2009 Company A
                - 2009 Company Z

The script doesn't limit the depth of nested items, however LaTeX Beamer does limit it up to three items.

Images

It's possible to create a frame with an image in it by using the "image" keyword followed by the image path as a frame title.

Features:
  Images:
    image bar:
    image foo:
        width: 10cm
        height: 30cm

In the above example, two frames would be created that include the "bar" and "foo" image.

Please note to not specify the file extension. The "\pgfimage" extension in LaTeX automatically searches for JPG and PNG files.

Options will be passed directly to the \pgfimage command, the supported options as of writing this are:

  • width
  • height
  • page
  • interpolate
  • mask

If no options are specified, the image will be the same size as the frame.

Metadata

It's possible to specify metadata for the document in the YAML file itself.

To do this, create a "metas" key at the top of the YAML file. The supported options are:

  • title (string) If not specified, 'Example Presentation' is used.
  • short_title (string) Short title to appear on top. If not specified, the contents of title is used.
  • author (string) If not specified, 'Arthur Koziel' is used.
  • institute (string) If not specified, nothing is used.
  • date (string) If not specified, current date is used.
  • outline (boolean) If an Outline/Table of contents should be generated. True if not specified.
  • highlight_style (string) Pygments style for code highlighting. If not specified 'default' is used.
  • outline_name (string) Custom outline text. If not specified, 'Outline' is used.

Example:

metas:
    title: My First Presentation
    short_title: Presentation
    author: Arthur Koziel
    institute: FH-Dortmund
    date: 14.11.2008
    outline: False
    highlight_style: colorful
    outline_name: Contents

Code Highlighting

It is possible to include source code in a frame and highlight it (if Pygments is available). If Pygments is not available the source code will still be included but not highlighted.

Per default Pygments "default" style is used. You can change it by specifying a "highlight_style" in the Metadata. The Pygments Lexer is guessed by the filename.

To include the source code of a file, use the "include" keyword followed by the filepath as a frame title. The path of the file must be relative to the YAML file's path.

This example below would include and highlight the contents of "foobar.py".

Features:
    Code Highlighting:
        include foobar.py:

yml2tex's People

Contributors

arthurk avatar eugeni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.