Skip to content

pandoc texlogo

Benct Philip Jonsson edited this page Jul 6, 2015 · 3 revisions

This is the documentation for pandoc-texlogo.pl.

NAME

pandoc-texlogo.pl - pandoc filter to display TeX logos intelligently.

VERSION

0.03

SYNOPSIS

pandoc -F pandoc-texlogo.pl [OPTIONS] [-|FILE...]

DESCRIPTION

pandoc-texlogo.pl is a pandoc filter to help display the logos for TeX, LaTeX etc. correctly in in LaTeX (including when generating PDF!) and ConTeXt output while also rendering them sensibly in other formats.

OPTIONS

In normal usage, as a pandoc filter, you need not and can not pass any options. Nevertheless there are a few options which you can use when invoking the script directly:

--css

Will print the CSS code needed to render the HTML logos generated by this script to STDOUT and then exit.

-h, --help

Will print some help.

--man

Will display the full manual for the script.

HOW IT WORKS

If your pandoc-markdown input file contains inline code elements with a class .texlogo (or for backwards compatibility also .logo) like `LaTeX`{.texlogo} (although the text of the 'code' -- hereafter the CODETEXT -- can be anything) then this filter will replace it with something it thinks makes sense in the current output format:

If the output format is latex or context:

Will output a raw tex element \CODETEXT{} (i.e. `TeX`{.texlogo} -> \TeX, `AnyThing`{.texlogo} -> \AnyThing etc. -- no validation is performed!)

If the output format is another supported format

The filter has predefined output strings for some output formats and some _CODETEXT_s. Each .texlogo code element will be replaced in the pandoc AST with a raw markup element of the appropriate format.

If the filter has a special output string value associated with the output format and the exact CODETEXT the output string will be set to that value. Otherwise if there is an output string value associated with TeX for that output format every occurrence of the substring TeX within the CODETEXT with that value, so that e.g. for HTML `ConTeXt`{.texlogo} will become Con<span class="texlogo">sube</sub>t even if no special string is associated with the CODETEXT ConTeXt.

The currently supported output formats and their _CODETEXT_s with predefined raw markup replacement strings are:

  • html

    (Actually any output format with the substring html in the output format name pandoc gives to the filter!)

    • TeX

    • LaTeX

    • LaTeX2e

    • XeTeX

    • XeLaTeX

Any other output format:

The code element will be replaced with a plain string element with a text equal to the CODETEXT, e.g. `LaTeX`{.texlogo} will become LaTeX without any special formatting.

CSS

If the output format is HTML (Actually any output format with the substring html in the output format name pandoc gives to the filter!) some CSS appropriate for rendering the HTML code for TeX logos which this filter generates will be inserted into the metadata of your document. More exactly these steps are performed:

  1. If the metadata entry include-css does not exist it is created as a metadata list.

  2. If the metadata entry include-css exists (or was just created) and is a metadata list a metadata string element containing the appropriate CSS code is added to it.

You can now insert code like that shown under In your HTML template: in the SYNOPSIS into your HTML template and the CSS code will be inserted into your standalone HTML output as needed.

Alternatively you can invoce the script with the --css option and redirect the output to a file which you then link from your HTML document:

perl pandoc_texlogo.pl --css >texlogo.css

NEEDED CPAN MODULES

Install these with your favorite CPAN client. (try perldoc cpan on the commandline if you don't have one!)

  • JSON

  • Data::Rmap

  • autovivification

  • indirect

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Benct Philip Jonsson <bpjonsson@gmail.com>

COPYRIGHT

Copyright 2014- Benct Philip Jonsson

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 67:

Deleting unknown formatting code T<>