-
Notifications
You must be signed in to change notification settings - Fork 0
pandoc texlogo
This is the documentation for pandoc-texlogo.pl.
pandoc-texlogo.pl - pandoc filter to display TeX logos intelligently.
0.03
pandoc -F pandoc-texlogo.pl [OPTIONS] [-|FILE...]
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.
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:
Will print the CSS code needed to render the HTML logos generated by this script to STDOUT and then exit.
Will print some help.
Will display the full manual for the script.
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:
Will output a raw tex
element \CODETEXT{}
(i.e. `TeX`{.texlogo}
-> \TeX
, `AnyThing`{.texlogo}
-> \AnyThing
etc. -- no validation is performed!)
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
-
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.
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:
-
If the metadata entry
include-css
does not exist it is created as a metadata list. -
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
Install these with your favorite CPAN client. (try perldoc cpan
on the commandline if you don't have one!)
-
JSON
-
Data::Rmap
-
autovivification
-
indirect
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Benct Philip Jonsson <bpjonsson@gmail.com>
Copyright 2014- Benct Philip Jonsson
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Hey! The above document had some coding errors, which are explained below:
- Around line 67:
-
Deleting unknown formatting code T<>