github - Latex \newcommand in kramdown -
i understand cramdown not support \newcommand type macros. there workaround not involve pandoc, used jekyll in github blog?
this input markdown:
--- layout: post --- \newcommand{\a}{\alpha} test $$\a$$.
the output should jekyll blog, mathematical notation, this.
there seems 2 questions here — first, can 1 define commands in kramdown similar latex's \newcommand
syntax, , second, can kramdown support mathematics.
regarding first issue, kramdown doesn't support syntax or i'm aware of, and isn't going in future, can't define non-math kramdown commands. you'd need use language that's focused on completeness rather ease , simplicity, latex, features that.
for math, though, mathjax (the parser kramdown uses) parse \newcommand
: go ahead , use in first code block. example,
$$\newcommand{\a}{\alpha} \a{}/2 $$
yields expected fraction expected computer modern italic greek alpha, , you'll able use \a
in every subsequent code block. can have code block @ beginning of document contains of \newcommand
definitions if don't want them interspersed in random code blocks throughout document.
regarding second issue, guess obvious @ point, kramdown handle math using similar notation latex:
here paragraph inline math, $$ \pi{}/2 $$, followed text , math block. $$ \int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi} $$
this yields:
<p>here paragraph inline math, <script type="math/tex">\pi{}/2</script>, followed text , math block.</p> <script type="math/tex; mode=display">\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}</script>
if isn't rendering on site, don't forget include mathjax library in <head>
of html page:
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/mathjax.js?config=tex-ams-mml_htmlormml"> </script>
Comments
Post a Comment