diff --git a/MANUAL.txt b/MANUAL.txt index 5f5929974..8edd116a3 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -3513,7 +3513,7 @@ reStructuredText ~ It will be rendered using an [interpreted text role `:math:`]. AsciiDoc - ~ It will be rendered as `latexmath:[...]`. + ~ It will be rendered as `latexmath:[...]` when inline and `[latexmath]++++....++++` when in display mode. Texinfo ~ It will be rendered inside a `@math` command. diff --git a/src/Text/Pandoc/Writers/AsciiDoc.hs b/src/Text/Pandoc/Writers/AsciiDoc.hs index 7b417af47..c156a1908 100644 --- a/src/Text/Pandoc/Writers/AsciiDoc.hs +++ b/src/Text/Pandoc/Writers/AsciiDoc.hs @@ -414,7 +414,10 @@ inlineToAsciiDoc _ (Str str) = return $ text $ escapeString str inlineToAsciiDoc _ (Math InlineMath str) = return $ "latexmath:[$" <> text str <> "$]" inlineToAsciiDoc _ (Math DisplayMath str) = - return $ "latexmath:[\\[" <> text str <> "\\]]" + return $ + blankline <> "[latexmath]" $$ "++++" $$ + "\\[" <> text str <> "\\]" + $$ "++++" $$ blankline inlineToAsciiDoc _ il@(RawInline f s) | f == "asciidoc" = return $ text s | otherwise = do diff --git a/test/writer.asciidoc b/test/writer.asciidoc index 7d8d74aa6..2a162a81e 100644 --- a/test/writer.asciidoc +++ b/test/writer.asciidoc @@ -466,7 +466,11 @@ Ellipses…and…and…. * latexmath:[$223$] * latexmath:[$p$]-Tree * Here’s some display math: -latexmath:[\[\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}\]] + +[latexmath] +++++ +\[\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}\] +++++ * Here’s one that has a line break in it: latexmath:[$\alpha + \omega \times x^2$].