mirror of https://github.com/yjwen/org-reveal.git
Add MathJax support.
This commit is contained in:
parent
e3f4fe2f17
commit
2f0d07581c
23
Readme.org
23
Readme.org
|
@ -2,7 +2,7 @@
|
||||||
#+Author: Yujie Wen
|
#+Author: Yujie Wen
|
||||||
#+Email: yjwen.ty@gmail.com
|
#+Email: yjwen.ty@gmail.com
|
||||||
|
|
||||||
#+OPTIONS: reveal_center:nil
|
#+OPTIONS: reveal_center:nil reveal_progress:t reveal_history:nil reveal_control:t reveal_mathjax:t
|
||||||
#+REVEAL_TRANS: cube
|
#+REVEAL_TRANS: cube
|
||||||
#+REVEAL_THEME: moon
|
#+REVEAL_THEME: moon
|
||||||
#+REVEAL_HLEVEL: 2
|
#+REVEAL_HLEVEL: 2
|
||||||
|
@ -227,13 +227,30 @@ $ git clone https://github.com/yjwen/org-reveal.git
|
||||||
If you saw odd indentation, please set variable =org-html-indent=
|
If you saw odd indentation, please set variable =org-html-indent=
|
||||||
to =nil= and export again.
|
to =nil= and export again.
|
||||||
|
|
||||||
|
** MathJax
|
||||||
|
|
||||||
|
${n! \over k!(n-k)!} = {n \choose k}$
|
||||||
|
|
||||||
|
LateX equation are renderred in native HTML5 contents.
|
||||||
|
|
||||||
|
*IMPORTANT*: Displaying equations requires internet connection to
|
||||||
|
[[mathjax.org]] or local MathJax installation.
|
||||||
|
|
||||||
|
*IMPORTANT 2*: MathJax is disabled by default to reduce internet
|
||||||
|
traffic. Set =#+OPTIONS= tag =reveal_mathjax= or variable
|
||||||
|
=org-reveal-mathjax= to true to enable it. For local MathJax
|
||||||
|
installation, set option =REVEAL_MATH_JAX_URL= to pointing to the
|
||||||
|
installation location.
|
||||||
|
|
||||||
* Thanks
|
* Thanks
|
||||||
|
|
||||||
Courtesy to:
|
Courtesy to:
|
||||||
|
|
||||||
#+ATTR_REVEAL: :frag roll-in
|
#+ATTR_REVEAL: :frag roll-in
|
||||||
the powerful Org-mode,
|
The powerful Org-mode,
|
||||||
#+ATTR_REVEAL: :frag roll-in
|
#+ATTR_REVEAL: :frag roll-in
|
||||||
and the impressive Reveal.js
|
the impressive Reveal.js
|
||||||
|
#+ATTR_REVEAL: :frag roll-in
|
||||||
|
and the precise MathJax
|
||||||
|
|
||||||
|
|
||||||
|
|
30
ox-reveal.el
30
ox-reveal.el
|
@ -40,6 +40,8 @@
|
||||||
(:reveal-trans "REVEAL_TRANS" nil org-reveal-transition t)
|
(:reveal-trans "REVEAL_TRANS" nil org-reveal-transition t)
|
||||||
(:reveal-theme "REVEAL_THEME" nil org-reveal-theme t)
|
(:reveal-theme "REVEAL_THEME" nil org-reveal-theme t)
|
||||||
(:reveal-hlevel "REVEAL_HLEVEL" nil nil t)
|
(:reveal-hlevel "REVEAL_HLEVEL" nil nil t)
|
||||||
|
(:reveal-mathjax nil "reveal_mathjax" org-reveal-mathjax t)
|
||||||
|
(:reveal-mathjax-url "REVEAL_MATHJAX_URL" nil org-reveal-mathjax-url t)
|
||||||
)
|
)
|
||||||
|
|
||||||
:translate-alist
|
:translate-alist
|
||||||
|
@ -97,20 +99,31 @@ can be include."
|
||||||
:type 'string)
|
:type 'string)
|
||||||
|
|
||||||
(defcustom org-reveal-progress t
|
(defcustom org-reveal-progress t
|
||||||
"Reveal progress applit."
|
"Reveal progress applet."
|
||||||
:group 'org-export-reveal
|
:group 'org-export-reveal
|
||||||
:type 'boolean)
|
:type 'boolean)
|
||||||
|
|
||||||
(defcustom org-reveal-history t
|
(defcustom org-reveal-history t
|
||||||
"Reveal history applit."
|
"Reveal history applet."
|
||||||
:group 'org-export-reveal
|
:group 'org-export-reveal
|
||||||
:type 'boolean)
|
:type 'boolean)
|
||||||
|
|
||||||
(defcustom org-reveal-center t
|
(defcustom org-reveal-center t
|
||||||
"Reveal center applit."
|
"Reveal center applet."
|
||||||
:group 'org-export-reveal
|
:group 'org-export-reveal
|
||||||
:type 'boolean)
|
:type 'boolean)
|
||||||
|
|
||||||
|
(defcustom org-reveal-mathjax nil
|
||||||
|
"Enable MathJax script."
|
||||||
|
:group 'org-export-reveal
|
||||||
|
:type 'boolean)
|
||||||
|
|
||||||
|
(defcustom org-reveal-mathjax-url
|
||||||
|
"http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
|
||||||
|
"Default MathJax URL."
|
||||||
|
:group 'org-export-reveal
|
||||||
|
:type 'string)
|
||||||
|
|
||||||
(defun if-format (fmt val)
|
(defun if-format (fmt val)
|
||||||
(if val (format fmt val) ""))
|
(if val (format fmt val) ""))
|
||||||
|
|
||||||
|
@ -229,7 +242,7 @@ to form a legal path name."
|
||||||
|
|
||||||
|
|
||||||
(defun org-reveal-stylesheets (info)
|
(defun org-reveal-stylesheets (info)
|
||||||
"Return the HTML contents for decalaring reveal stylesheets
|
"Return the HTML contents for declaring reveal stylesheets
|
||||||
using custom variable `org-reveal-root'."
|
using custom variable `org-reveal-root'."
|
||||||
(let* ((root-path (plist-get info :reveal-root))
|
(let* ((root-path (plist-get info :reveal-root))
|
||||||
(css-dir-name (org-reveal--append-path root-path "css"))
|
(css-dir-name (org-reveal--append-path root-path "css"))
|
||||||
|
@ -238,9 +251,15 @@ using custom variable `org-reveal-root'."
|
||||||
(theme-path (org-reveal--append-path css-dir-name "theme"))
|
(theme-path (org-reveal--append-path css-dir-name "theme"))
|
||||||
(theme-full (org-reveal--append-path theme-path theme-file)))
|
(theme-full (org-reveal--append-path theme-path theme-file)))
|
||||||
(format "<link rel=\"stylesheet\" href=\"%s\">
|
(format "<link rel=\"stylesheet\" href=\"%s\">
|
||||||
<link rel=\"stylesheet\" href=\"%s\" id=\"theme\">"
|
<link rel=\"stylesheet\" href=\"%s\" id=\"theme\">\n"
|
||||||
min-css-file-name theme-full)))
|
min-css-file-name theme-full)))
|
||||||
|
|
||||||
|
(defun org-reveal-mathjax-scripts (info)
|
||||||
|
"Return the HTML contents for declaring MathJax scripts"
|
||||||
|
(if (plist-get info :reveal-mathjax)
|
||||||
|
;; MathJax enabled.
|
||||||
|
(format "<script type=\"text/javascript\" src=\"%s\"></script>\n"
|
||||||
|
(plist-get info :reveal-mathjax-url))))
|
||||||
|
|
||||||
(defun org-reveal-scripts (info)
|
(defun org-reveal-scripts (info)
|
||||||
"Return the necessary scripts for initializing reveal.js using
|
"Return the necessary scripts for initializing reveal.js using
|
||||||
|
@ -404,6 +423,7 @@ info is a plist holding export options."
|
||||||
(if-format "<meta name=\"description\" content=\"%s\"/>\n" (plist-get info :description))
|
(if-format "<meta name=\"description\" content=\"%s\"/>\n" (plist-get info :description))
|
||||||
(if-format "<meta name=\"keywords\" content=\"%s\"/>\n" (plist-get info :keywords))
|
(if-format "<meta name=\"keywords\" content=\"%s\"/>\n" (plist-get info :keywords))
|
||||||
(org-reveal-stylesheets info)
|
(org-reveal-stylesheets info)
|
||||||
|
(org-reveal-mathjax-scripts info)
|
||||||
"</head>
|
"</head>
|
||||||
<body>
|
<body>
|
||||||
<div class=\"reveal\">
|
<div class=\"reveal\">
|
||||||
|
|
Loading…
Reference in New Issue