Inline LaTeX with MMD 6

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.

fletcher.github.io/MultiMarkdown-5/math.html

BTW single backticks are used for inline raw syntax, \pi{=latex} – pandoc documentation details this as the syntax is the same: pandoc.org/MANUAL.html#generic-raw-attribute

What nontroppo said, and also

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…

Thanks for the suggestions. I can confirm that:

  • $ and $$ do not work in MMD6 (for me, anyway)
  • Using a single backtick does not work inline (I still get the \texttt issue)
  • Using \( and \) does work to give inline math using MMD6 to LaTeX.

Thanks again,
Emma

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:
Screen Shot 2018-07-04 at 21.32.51.png

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

Hi,

I don’t use the command line - I compile in Scrivener for MMD to LaTeX.

Copying and pasting what you have done using the backtick into my document gives:

Here is a test \textbackslash{}delta to see if escaping \delta works

The dollar signs now work, although I’ve just updated my LaTeX distribution so that might have had some effect…

Thanks,
Emma

\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…