yml2tex is a simple python script which generates LaTeX Beamer code out of YAML files.
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:
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.
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.
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:
If no options are specified, the image will be the same size as the frame.
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.
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
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: