Re: [O] MathJax beyond org-html-mathjax-options?

2017-11-03 Thread Rasmus
Lawrence Bottorff  writes:

> Bottom line: we can't expand org-html-mathjax-options to add in MathJax's
> cancel.js, etc.

I did not say that.  With the current version, you could do it yourself by
adding (extensions "ext1.js, ..., extn.js") to org-html-mathjax-options
and changing org-html-mathjax-template to load the extensions at the right
place.  Once extensions is added to org-html-mathjax-options you should
also be able to set it in files via the #+html_mathjax keyword, but you
might have to be careful how you write it (I’m not sure space would go).
I hope this is clear enough.

> Yes, your first "quick-and-dirty" worked just fine.

> Q: How did you know how to format #+html: \(\require{cancel}\) ?

it’s in the mathjax manual,


http://docs.mathjax.org/en/latest/tex.html?highlight=cancel#tex-and-latex-extensions

> Also, how does the org world know that we're talking about loading
>MathJax's cancel.js?

It doesn’t really.  But content after "#+html:" is only added to html
output.  From there mathjax takes over.

> As you all know I'm not a "developer-class" poster here, so my questions
> often look dull-witted.

This is a community for all Org users.  There’s mostly no numb questions.
This one certainly wasn’t.  I’d no knowledge about mathjax extensions
before reading your mail.

> Will try the patch once I learn a bit more diff in Emacs lore. . . .

Thanks.

Rasmus

-- 
And when I’m finished thinking, I have to die a lot



Re: [O] MathJax beyond org-html-mathjax-options?

2017-11-03 Thread Lawrence Bottorff
Bottom line: we can't expand org-html-mathjax-options to add in MathJax's
cancel.js, etc. Yes, your first "quick-and-dirty" worked just fine. Q: How
did you know how to format #+html: \(\require{cancel}\) ? Also, how does
the org world know that we're talking about loading MathJax's cancel.js? As
you all know I'm not a "developer-class" poster here, so my questions often
look dull-witted. Will try the patch once I learn a bit more diff in Emacs
lore. . . .

On Thu, Nov 2, 2017 at 9:12 AM, Rasmus  wrote:

> Lawrence Bottorff  writes:
>
> > I'm trying to get a typical Latex strikethrough with MathJax in an HTML
> > export, i.e., \cancel{thing} puts line through "thing". This
> >  tells me how. But I
> > don't know how to include this MathJax markup in an org file for HTML
> > export. If I forego MathJax -- i.e., #+OPTIONS: tex:dvipng instead
> > of #+OPTIONS: tex:t -- \cancel works, but I need to use MathJax. It
> doesn't
> > look like orhg-html-mathjax-options is expandable. . . .
>
> For now this works for me:
>
> #+html: \(\require{cancel}\)
> \begin{equation}
> \cancel{x = 1}
> \end{equation}
>
> Cf. http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-extensions
> You could also autoload the extension, cf. https://github.com/mathjax/
> MathJax/blob/master/test/sample-autoload.html
>
>
> That being said, I don’t think extensions were available at the time
> #+HTML_MATHJAX was introduced.  We could add extension support, but the
> questions would be whether to add them to #+HTML_MATHJAX or make a new
> keyword, e.g.
>
> #+HTML_MATHJAX_EXTENSIONS: ext1 ext2 ... extN
>
> I guess it would default to the "autoload-all" extension.
>
> One issue is that some of them have configuration options, like "noError".
>
> If you want, you can try the attached patch.
>
> Rasmus
>
> --
> Vote for proprietary math!
>


Re: [O] MathJax beyond org-html-mathjax-options?

2017-11-02 Thread Rasmus
Lawrence Bottorff  writes:

> I'm trying to get a typical Latex strikethrough with MathJax in an HTML
> export, i.e., \cancel{thing} puts line through "thing". This
>  tells me how. But I
> don't know how to include this MathJax markup in an org file for HTML
> export. If I forego MathJax -- i.e., #+OPTIONS: tex:dvipng instead
> of #+OPTIONS: tex:t -- \cancel works, but I need to use MathJax. It doesn't
> look like orhg-html-mathjax-options is expandable. . . .

For now this works for me:

#+html: \(\require{cancel}\)
\begin{equation}
\cancel{x = 1}
\end{equation}

Cf. http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-extensions
You could also autoload the extension, cf. 
https://github.com/mathjax/MathJax/blob/master/test/sample-autoload.html


That being said, I don’t think extensions were available at the time
#+HTML_MATHJAX was introduced.  We could add extension support, but the
questions would be whether to add them to #+HTML_MATHJAX or make a new
keyword, e.g.

#+HTML_MATHJAX_EXTENSIONS: ext1 ext2 ... extN

I guess it would default to the "autoload-all" extension.

One issue is that some of them have configuration options, like "noError".

If you want, you can try the attached patch.

Rasmus

-- 
Vote for proprietary math!
>From 229bddbaed66a476ebed588853a0250cfe68fdcf Mon Sep 17 00:00:00 2001
From: Rasmus 
Date: Thu, 2 Nov 2017 13:59:17 +0100
Subject: [PATCH] ox-html: MathJax extensions support

* lisp/ox-html.el (org-html-mathjax-options):
(org-html-mathjax-template):
(org-html--build-mathjax-config): Add MathJax extensions support.
* doc/org.texi (HTML Specific export settings):
  (Math formatting in HTML export): Mention #+HTML_MATHJAX_EXTENSIONS.
---
 doc/org.texi| 12 +-
 lisp/ox-html.el | 73 +
 2 files changed, 69 insertions(+), 16 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 77da6d335..6ac22aff9 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -11626,6 +11626,12 @@ Options for MathJax (@code{org-html-mathjax-options}).  MathJax is used to
 typeset @LaTeX{} math in HTML documents.  @xref{Math formatting in HTML
 export}, for an example.
 
+@item HTML_MATHJAX_EXTENSIONS
+@cindex #+HTML_MATHJAX_EXTENSIONS
+@vindex org-html-mathjax-options
+Extensions for MathJax (@code{org-html-mathjax-options}).  This can be used
+to e.g. add additional macro support to MathJax.
+
 @item HTML_HEAD
 @cindex #+HTML_HEAD
 @vindex org-html-head
@@ -11947,9 +11953,13 @@ options can be configured via @code{org-html-mathjax-options}, or in the
 buffer.  For example, with the following settings,
 @smallexample
 #+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
+#+HTML_MATHJAX: cancel.js noErrors.js
 @end smallexample
 equation labels will be displayed on the left margin and equations will be
-five ems from the left margin.
+five ems from the left margin.  In addition, it loads the two MathJax
+extensions @samp{cancel.js} and @samp{noErrors.js}@footnote{See
+@uref{http://docs.mathjax.org/en/latest/tex.html#tex-extensions, TeX and
+LaTeX extensions} in the @uref{http://docs.mathjax.org, MathJax manual} to learn about extensions.}.
 
 @noindent See the docstring of
 @code{org-html-mathjax-options} for all supported variables.  The MathJax
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 1c3dd8090..4f9e69fdf 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -121,6 +121,7 @@
 (:html-link-home "HTML_LINK_HOME" nil org-html-link-home)
 (:html-link-up "HTML_LINK_UP" nil org-html-link-up)
 (:html-mathjax "HTML_MATHJAX" nil "" space)
+(:html-mathjax-extensions "HTML_MATHJAX_EXTENSIONS" nil "" space)
 (:html-postamble nil "html-postamble" org-html-postamble)
 (:html-preamble nil "html-preamble" org-html-preamble)
 (:html-head "HTML_HEAD" nil org-html-head newline)
@@ -1168,7 +1169,8 @@ See `format-time-string' for more information on its components."
 (indent "0em")
 (multlinewidth "85%")
 (tagindent ".8em")
-(tagside "right"))
+(tagside "right")
+(extensions ("autoload-all.js")))
   "Options for MathJax setup.
 
 Alist of the following elements.  All values are strings.
@@ -1190,23 +1192,28 @@ autonumberHow to number equations.  Valid values are \"None\",
 tagindent The amount tags are indented.
 tagside   Which side to show tags/labels on.  Valid values are
   \"left\" and \"right\"
+extensionsWhich extensions to load.  See http://docs.mathjax.org/en/latest/tex.html#tex-extensions
 
 You can also customize this for each buffer, using something like
 
 #+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
+#+HTML_MATHJAX_EXTENSIONS: colors noErrors
 
 For further information about MathJax options, see the MathJax documentation:
 
   http://docs.mathjax.org/;
   :group 'org-export-html
-  :package-version '(Org . 

[O] MathJax beyond org-html-mathjax-options?

2017-10-31 Thread Lawrence Bottorff
I'm trying to get a typical Latex strikethrough with MathJax in an HTML
export, i.e., \cancel{thing} puts line through "thing". This
 tells me how. But I
don't know how to include this MathJax markup in an org file for HTML
export. If I forego MathJax -- i.e., #+OPTIONS: tex:dvipng instead
of #+OPTIONS: tex:t -- \cancel works, but I need to use MathJax. It doesn't
look like org-html-mathjax-options is expandable. . . .

LB