Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

LaTeX macros in Markdown on Cocalc

I'm trying to use some custom macros in sage worksheets and Markdown files. How do I include my own custom macros in a Markdown file? I thought the markdown conversion used pandoc so I tried adding YAML front matter:

---
header-includes: |
    \usepackage[all]{pabmacros}
---

but cocalc just tries to render it rather than treating it as YAML front matter.

I would also like to do something similar in Sage worksheets. It works okay with LaTeX. I have a cell like this

%auto
%latex.add_to_preamble
\usepackage[all]{pabmacros}

Then I can access my macros (such as "\Rm") in LaTeX cells:

%latex
\[
\Rm
\]

Everything works fine there.

If I try to use my macros in Markdown cells however, they do not render properly.

%md

# My heading

\[
\Rm
\]

just produces "\Rm" in red.

Does anyone know how I can use my own custom macros in Markdown?