Usage
To apply the filter, use the following option with pandoc:
$ pandoc --filter pandoc-latex-absolute-image
Explanation
In the metadata block, specific set of classes can be defined to position an image relatively to each page:
It’s also possible to specify a new image using description by attributes.
The metadata block add information using the pandoc-latex-absolute-image
entry by a list of definitions:
pandoc-latex-absolute-image:
- classes: [left]
image: Tux.pdf
x-coord: 1cm
y-coord: 1cm
width: 32pt
The metadata block above is used to position Tux on all pages 1cm from the left edge and 1cm from the top edge.
Each entry of pandoc-latex-absolute-image is a YAML dictionary containing:
classes: the set of classes that triggers the position of the image. This parameter is mandatory.image: the image pathimage-odd: the image path for odd page (default toimage),image-even: the image path for even page (default toimage),reset: to remove the image on all subsequent pagesreset-odd: to remove the image on all subsequent odd pages (default toreset)reset-even: to remove the image on all subsequent even pages (default toreset)width: the width of the rendered imagewidth-odd: the width of the rendered image for odd pages (default towidth)width-even: the width of the rendered image for odd pages (default towidth)height: the height of the rendered imageheight-odd: the height of the rendered image for odd pages (default toheight)height-even: the height of the rendered image for odd pages (default toheight)anchor: the image anchoranchor-odd: the image anchor for odd pagesanchor-even: the image anchor for even pagesx-coord: the x-coordinatex-coord-odd: the x-coordinate for odd pagesx-coord-even: the x-coordinate for even pagesy-coord: the y-coordinatey-coord-odd: the y-coordinate for odd pagesy-coord-even: the y-coordinate for even pagesopacity: the image opacityopacity-odd: the image opacity for odd pagesopacity-even: the image opacity for even pages
It’s also possible to specify the image using attribute description:
latex-absolute-imagelatex-absolute-image-oddlatex-absolute-image-evenlatex-absolute-resetlatex-absolute-reset-oddlatex-absolute-reset-evenlatex-absolute-widthlatex-absolute-width-oddlatex-absolute-width-evenlatex-absolute-heightlatex-absolute-height-oddlatex-absolute-height-evenlatex-absolute-anchorlatex-absolute-anchor-oddlatex-absolute-anchor-evenlatex-absolute-x-coordlatex-absolute-x-coord-oddlatex-absolute-x-coord-evenlatex-absolute-y-coordlatex-absolute-y-coord-oddlatex-absolute-y-coord-evenlatex-absolute-opacitylatex-absolute-opacity-oddlatex-absolute-opacity-even
The following LaTeX packages are required:
tikz
Example
Demonstration: Using pandoc-latex-absolute-image-sample.txt as input gives output file in pdf.
$ pandoc --filter pandoc-latex-absolute-image pandoc-latex-absolute-image-sample.txt \
-o pandoc-latex-absolute-image-sample.pdf
The Tux image is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication (https://commons.wikimedia.org/wiki/File:Tux.svg).