uwdata / living-papers

Authoring tools for scholarly communication. Create interactive web pages or formal research papers from markdown source.
BSD 3-Clause "New" or "Revised" License
131 stars 10 forks source link

feat: latex classToCommand option #103

Closed joshuahhh closed 2 months ago

joshuahhh commented 2 months ago

This adds an option you can put in your YAML to map classes to LaTeX commands.

Motivational story: I wanted to put highlighted text in my paper. I could do this by putting \myhl{some text} directly into the md (and defining \myhl in a ~~~ latex:preamble). But 1. this will disappear from HTML output, and 2. the contents of the command won't get parsed. So the idea here is to instead write [some text]{.myhl}, set classToCommand: [['myhl', 'myhl']] in the yaml frontmatter, define \myhl in a ~~~ latex:preamble, and define a CSS rule for .myhl in a linked CSS. It works pretty nicely.