I would like to use org-mode files with embedded latex code. Some of the latex content is based on packages like

\usepackge{algorithm, algorithmic}

to generate pseudo-code.

These org-files should be converted to HTML via preferably MathJax, without intermediate steps. My trials so far have yielded complete failure.

For instance, if I would like to use ORG --> MATHJAX --> HTML for the following example, what is needed ?

#+begin_src latex :results html replace :exports results :eval t 
\caption{Calculate $y = x^n$}
\REQUIRE $n \geq 0 \vee x \neq 0$
\ENSURE $y = x^n$
\STATE $y \leftarrow 1$
\IF{$n < 0$}
\STATE $X \leftarrow 1 / x$
\STATE $N \leftarrow -n$
\STATE $X \leftarrow x$
\STATE $N \leftarrow n$
\WHILE{$N \neq 0$}
\IF{$N$ is even}
\STATE $X \leftarrow X \times X$
\STATE $N \leftarrow N / 2$
\ELSE[$N$ is odd]
\STATE $y \leftarrow y \times X$
\STATE $N \leftarrow N - 1$

If I evaluate this example via C-c C-c, within the org file, I obtain the same thing with the following

#+begin_export html
 same code as above

(The resulting html side though has that not correctly rendered at all ...)

My preamble looks something like this.

#+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
#+INFOJS_OPT: view:info toc:t
#+LATEX_HEADER: \usepackage{tikz} 
#+LATEX_HEADER: \usepackage{amsmath} 
#+LATEX_HEADER: \usepackage[linesnumbered, ruled]{algorithm2e}
#+LATEX_HEADER: \usepackage{algorithm}
#+LATEX_HEADER: \usepackage{algorithmic}
#+OPTIONS: ':t *:t -:t ::t <:t H:3 \n:nil ^:t arch:headline author:t c:nil
#+OPTIONS: creator:comment d:(not LOGBOOK) date:t e:t email:nil f:t inline:t
#+OPTIONS: num:t p:nil pri:nil stat:t tags:t tasks:t tex:t timestamp:t toc:t
#+OPTIONS: todo:t |:t
#+CREATOR: Deloitte  (version 0.0.1)
#+EXCLUDE_TAGS: noexport
#+SELECT_TAGS: export
#+OPTIONS: html-postamble:auto html-preamble:t tex:t
#+html_head_extra: <link rel="stylesheet" type="text/css" href="code.css"/>
  • @Stefan can you assist here please ? I'd be grateful for input. – user26858 Feb 16 '20 at 11:58
  • Nope, sorry, neither Org nor HTML nor MathJax are within my expertise. – Stefan Feb 16 '20 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.