summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus <rasmus@gmx.us>2015-02-25 13:31:52 +0100
committerRasmus <rasmus@gmx.us>2015-02-26 15:49:34 +0100
commitf82dad1237485201ded59c800a291c0ec7632042 (patch)
treee929ae4d61bd73e69983863f32034346465eced5
parent398165f5a1d90b89ed40ee8750ccb2072df02113 (diff)
downloadorg-mode-f82dad1237485201ded59c800a291c0ec7632042.tar.gz
org.el: More general TeX to MathML convert support
* org.el (org-latex-to-mathml-convert-command): Work with other converters than mathtoweb. (org-latex-to-mathml-convert-command): Add possibility of passing latex-fragment. * org.texi (Working with @LaTeX{} math snippets): Show LaTeXML config.
-rw-r--r--doc/org.texi11
-rwxr-xr-xlisp/org.el17
2 files changed, 20 insertions, 8 deletions
diff --git a/doc/org.texi b/doc/org.texi
index 5b4862b..272d855 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -12491,9 +12491,9 @@ You can specify the @LaTeX{}-to-MathML converter by customizing the variables
@code{org-latex-to-mathml-convert-command} and
@code{org-latex-to-mathml-jar-file}.
-If you prefer to use @file{MathToWeb}@footnote{See
-@uref{http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl, MathToWeb}} as your
-converter, you can configure the above variables as shown below.
+To use MathToWeb@footnote{See
+@uref{http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl, MathToWeb}.} as your
+converter, you can configure the above variables as
@lisp
(setq org-latex-to-mathml-convert-command
@@ -12501,6 +12501,11 @@ converter, you can configure the above variables as shown below.
org-latex-to-mathml-jar-file
"/path/to/mathtoweb.jar")
@end lisp
+To use @LaTeX{}ML@footnote{See @uref{http://dlmf.nist.gov/LaTeXML/}.} use
+@lisp
+(setq org-latex-to-mathml-convert-command
+ "latexmlmath \"%i\" --presentationmathml=%o")
+@end lisp
You can use the following commands to quickly verify the reliability of
the @LaTeX{}-to-MathML converter.
diff --git a/lisp/org.el b/lisp/org.el
index bf0953d..c72f48c 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3970,12 +3970,16 @@ Replace format-specifiers in the command as noted below and use
`shell-command' to convert LaTeX to MathML.
%j: Executable file in fully expanded form as specified by
`org-latex-to-mathml-jar-file'.
-%I: Input LaTeX file in fully expanded form
-%o: Output MathML file
+%I: Input LaTeX file in fully expanded form.
+%i: The latex fragment to be converted.
+%o: Output MathML file.
This command is used by `org-create-math-formula'.
When using MathToWeb as the converter, set this to
-\"java -jar %j -unicode -force -df %o %I\"."
+\"java -jar %j -unicode -force -df %o %I\".
+
+When using LaTeXML set this to
+\"latexmlmath \"%i\" --presentationmathml=%o\"."
:group 'org-latex
:version "24.1"
:type '(choice
@@ -18949,6 +18953,7 @@ inspection."
`((?j . ,(shell-quote-argument
(expand-file-name org-latex-to-mathml-jar-file)))
(?I . ,(shell-quote-argument tmp-in-file))
+ (?i . ,latex-frag)
(?o . ,(shell-quote-argument tmp-out-file)))))
mathml shell-command-output)
(when (org-called-interactively-p 'any)
@@ -18963,9 +18968,11 @@ inspection."
(when (re-search-forward
(concat
(regexp-quote
- "<math xmlns=\"http://www.w3.org/1998/Math/MathML\">")
+ "<math xmlns=\"http://www.w3.org/1998/Math/MathML\"")
+ "[^>]*?>"
"\\(.\\|\n\\)*"
- (regexp-quote "</math>")) nil t)
+ "</math>")
+ nil t)
(prog1 (match-string 0) (kill-buffer))))))
(cond
(mathml