Custom LaTeX templates¶
The templates are written in jinja2.
Just copy from e.g. texmark/templates/science/template.tex to your own, e.g.
custom_template.tex, and run again with:
texmark example.md --pdf -j science -o build/example-science.pdf --tex build/example-science.tex --template custom_template.tex
The -j journal template option (here science) is still used to set custom
filters (e.g. only \cite for Science, no \citet; extract specific sections
as metadata to be injected as {{section}} instead of {{body}}, etc.). The
machinery is defined in the
texmark/filters/
package and can in principle be extended or copied.
Two approaches are possible:
- Just add more filters via the
--filterscommand or in the yaml metadata. - Extend the existing filters in a module, e.g.
custom_filter.py, that extends thefiltersdict from thetexmark.filtersmodule (see the source code to check the details). Then pass it via--filters-module custom_filter(orcustom_filterin the metadata) to prompt the texmark filter to load that module and make it available via-j your-custom-name. Note that will require you to explicitly pass--templateas well — unless you overwrite an existing filter.