Hi,
Thanks to those who have detailed some of the MMD6 changes. I’m using the
[code]
\begin{equation}
...
\end{equation}
```` [/code]
for block LaTeX equations, figures, tables etc. and it's working well.
I want to use an inline LaTeX maths expression though, to put Greek symbols in my text, which I could do with the old LaTeX MMD style. However, using the backticks inline with text converts it to \texttt{} in the tex file and I get an associated error when compiling. I've tried 3, 4 and 5 backticks with the same result.
Has anyone done this successfully?
Thanks,
Emma
Why not use the Dollar syntax – double dollar for block and single for inline maths:
An example of math within a paragraph --- ${e}^{i\pi }+1=0$
--- easy enough.
And an equation on it's own:
$${x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a}$$
That's it.
The preferred LaTeX math environment delimiters are ( ) for inline and [ ] for display. In MMD you need an extra \ to escape the backslashes. These delimiters are discussed in the link nontroppo provided. People do use the old TeX delimiters $ and $$, but they should stop. https://en.wikibooks.org/wiki/LaTeX/Mathematics#Mathematics_environments
For Greek I also just use XeLaTeX and unicode with a font that supports greek characters (with Alfred snippets auto-completing into greek for me during writing). I much prefer using unicode (i.e. Δδ) because I do not want to restrict my output to LaTeX alone, but to be robust to multiple output formats. i can compile to plain text, HTML, Libreoffice/Word, InDesign and never worry about some funky markup only one environment provides.
I didn’t know that $ syntax was deprecated, but remember that MMD and Pandoc will convert $ and $$ into ( and [ for you (well Pandoc does at least), so your LaTeX will still be ‘clean’. And again, say you also need to export a copy to Word/LibreOffice, then it will convert the markdown delimiters into the correct maths markup for that as well. I try to use markdown and unicode in preference to any output-specific markup wherever possible.
In fact, if you are using styles, you will never even see this markup because Scrivener will insert it for you…
Hm, $ and $$ to delimit maths work for me in Pandoc V2.21 or MMD 6.32 (Pandoc converts $ and $$ to ( and [ but not MMD):
❯ multimarkdown -t latex
An example of math within a paragraph --- ${e}^{i\pi }+1=0$
--- easy enough.
And an equation on it's own:
$${x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a}$$
That's it.
^D
An example of math within a paragraph --- ${e}^{i\pi }+1=0$
--- easy enough.
And an equation on it's own:
$${x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a}$$
That's it.
~
❯ pandoc -t latex
An example of math within a paragraph --- ${e}^{i\pi }+1=0$
--- easy enough.
And an equation on it's own:
$${x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a}$$
That's it.
^D
An example of math within a paragraph --- \({e}^{i\pi }+1=0\) --- easy
enough.
And an equation on it's own:
\[{x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a}\]
That's it.
But even with $ and $$ the MMD output tex builds just fine:
The single backtick raw latex is also working for me for escaping greek characters, at least from the command line so something else is triggering the conversion to teletype???:
❯ multimarkdown -t latex
Here is a test \delta to see if escaping `\delta`{=latex} works
^D
Here is a test \textbackslash{}delta to see if escaping \delta works
\delta (or \alpha, etc.) isn’t a LaTeX command unless you’re in math mode. This is why you need to either use the textgreek package or unicode+XeLaTeX.
It’s possible that nontroppo’s LaTeX installation is automatically putting the missing math mode delimiters around \alpha, but MMD understands that it’s not a LaTeX command and instead renders it as text.
That is giving the same output as the command line, which I hope it should (well, at least Scrivener 3.03 that has MMD 6 by default), so this is working I think…
Liz: yes you are absolutely right, though the example was just as a quick demonstration that ``{=latex} was working for MMD 6…