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

Use 'latex' as raw format rather than 'tex' #72

Closed joshuahhh closed 1 year ago

joshuahhh commented 1 year ago

Currently, Living Papers assumes raw tex code will be labeled with format 'tex' rather than 'latex'. This deviates from Pandoc's built-in / documented practice. Living Papers needs to explicitly rewrite the format:

https://github.com/uwdata/living-papers/blob/804b7225534a79bb4a3540503e981253f6a1bf6f/packages/compiler/src/plugins/include/index.js#L56

Also, the Pandoc documents refer to using {=latex} for a raw latex block.

Not sure why we should use 'tex' rather than 'latex', since 'latex' is the name we use for the output format elsewhere (like in latex:only, etc.). At the very least, I'd like this condition to include 'latex':

https://github.com/uwdata/living-papers/blob/804b7225534a79bb4a3540503e981253f6a1bf6f/packages/compiler/src/output/latex/tex-format.js#L385-L388

Happy to make the change if desired.

jheer commented 1 year ago

I default to tex because that is what the Pandoc markdown parser produces by default (e.g., see this example).

Ideally everything could use latex to match the Living Papers output type name. One possibility would be to augment our Pandoc AST parser to simply map raw tex to raw latex. Alternatively, we could have both tex and latex map to the same semantics, though this might involve some new patches (possibly including to the recently added excludesNamespace AST utility). The first option feels "nicer" to me.