Skip to content

tomduck/pandoc-latex-extensions

Repository files navigation

pandoc-latex-extensions 0.2.2

pandoc-latex-extensions is a pandoc filter that adds latex extensions.

Bug reports and feature requests may be posted on the project's Issues tracker. If you find pandoc-latex-extensions useful, then please kindly give it a star on GitHub.

Plugin contributions are welcome. Information for developers is given in DEVELOPERS.md.

See also: pandoc-fignos, pandoc-eqnos, pandoc-tablenos, pandoc-secnos, and pandoc-comments.

Contents

  1. Installation
  2. Usage
  3. Markdown Syntax

Installation

Pandoc-latex-extensions requires python, a programming language that comes pre-installed on macOS and linux. It is easily installed on Windows -- see here.

Pandoc-latex-extensions may be installed using the shell command

pip install pandoc-latex-extensions --user

and upgraded by appending --upgrade to the above command. Pip is a program that downloads and installs software from the Python Package Index, PyPI. It normally comes installed with a python distribution.1

Usage

Pandoc-latex-extensions is activated by using the

--filter pandoc-latex-extensions

option with pandoc.

Extensions

The following extensions are enabled. Options for each extension will be implemented on request.

newpage

Synopsis: Converts pandoc horizontal rules to \newpage commands.

lettrine

Synopsis: Converts pandoc spans of class lettrine to \lettrine (drop caps) commands.

Installs: The lettrine package.

Example markdown:

[Lorem]{.lettrine} ipsum dolor sit amet, consectetur adipiscing elit. Duis non massa semper, commodo massa a, molestie justo. Donec id velit non mauris porttitor semper. Suspendisse non pharetra lorem, luctus euismod odio. Integer eu diam at odio feugiat venenatis vitae sit amet libero. Duis ut auctor libero, et venenatis nisi. Fusce nec posuere nisi, porta rutrum justo. Suspendisse blandit tellus eget venenatis scelerisque.

Result:

lettrine demonstration

noindent

Synopsis: Removes indentation from the content of pandoc divs with class noindent.

Example markdown:

::: {.noindent}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non massa semper, commodo massa a, molestie justo. Donec id velit non mauris porttitor semper.
:::

Result:

noindent demonstration

epigraph

Synopsis: Converts pandoc divs with class epigraph to \epigraph commands.

Installs: The epigraph package.

Example markdown:

::: {.epigraph}
Aliquam erat volutpat.

Lorem Ipsum Generatis
:::

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non massa semper, commodo massa a, molestie justo. Donec id velit non mauris porttitor semper.

Result:

epigraph demonstration

The last line in the div is taken to be the quote author. There must be a blank line above it.

Indentation is removed from the first paragraph after the epigraph.

newthought

Synopsis: Converts pandoc spans with class newthought to tufte-latex \newthought commands.

Documentclass: tufte-book or tufte-handout.

Example markdown:

---
documentclass: tufte-handout
...

[Lorem ipsum dolor sit amet,]{.newthought} consectetur adipiscing elit. Duis non massa semper, commodo massa a, molestie justo.

Result:

newthought demonstration

marginnote

Synopsis: Converts pandoc divs with class marginnote to tufte-latex \marginnote commands.

Documentclass: tufte-book or tufte-handout.

Options: offset.

Example markdown:

---
documentclass: tufte-handout
...

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non massa semper, commodo massa a, molestie justo. Donec id velit non mauris porttitor semper. Suspendisse non pharetra lorem, luctus euismod odio. Integer eu diam at odio feugiat venenatis vitae sit amet libero. Duis ut auctor libero, et venenatis nisi. Fusce nec posuere nisi, porta rutrum justo. Suspendisse blandit tellus eget venenatis scelerisque.

::: {.marginnote offset=-2cm}
Maecenas vehicula hendrerit massa, sed consequat ipsum facilisis et. Fusce eu velit neque. Duis vel aliquam ex.
:::

Result:

marginnote demonstration

marginfigure

Synopsis: Converts pandoc implicit figures with class marginfigure to tufte-latex marginfigure environments.

Documentclass: tufte-book or tufte-handout.

Options: offset.

Example markdown:

---
documentclass: tufte-handout
...

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non massa semper, commodo massa a, molestie justo. Donec id velit non mauris porttitor semper. Suspendisse non pharetra lorem, luctus euismod odio. Integer eu diam at odio feugiat venenatis vitae sit amet libero. Duis ut auctor libero, et venenatis nisi. Fusce nec posuere nisi, porta rutrum justo. Suspendisse blandit tellus eget venenatis scelerisque.

![Duis nisi eros, consectetur facilisis odio id, vehicula accumsan justo.](img/fig-1.png){.marginfigure offset=-2cm}

Result:

marginfigure demonstration


Footnotes

1: Anaconda users may be tempted to use conda instead. This is not advised. The packages distributed on the Anaconda cloud are unofficial, are not posted by me, and in some cases are ancient. Some tips on using pip in a conda environment may be found here.