13.11.2015 Views

my Latex and Tex4ht cheat sheet

my Latex cheat sheet - 12000.org

my Latex cheat sheet - 12000.org

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3.10 using png for math display, no mathjax, no mathml<br />

There are some issues with using MathML <strong>and</strong> MathJax with tex4ht. See http://tex.stackexchange.com/<br />

questions/109714/conversion-issues-using-htlatex-<strong>and</strong>-mathjax-mathml-method<br />

Also, using mathjax, any latex code in verbatim environment will get rendered as math ! which is not what I<br />

want. So it is not working well.<br />

Hence I am back to using png now. To get the best result from png, this is the setup I use. First the<br />

comm<strong>and</strong> line<br />

rm -rf report<br />

mkdir report<br />

make4ht report.tex "nma,htm,charset=utf-8,pic-align,notoc*" " -cunihtf -utf8" -d report<br />

It is very important to use pic-align else big problem will show up. see http://puszcza.gnu.org.ua/<br />

bugs/?179<br />

I also add this to the preamble of the document itself (not the .cfg)<br />

\DeclareMathSizes{12}{13}{8}{8}<br />

\DeclareMathSizes{10}{12}{6}{6}<br />

\end{X310}<br />

But this is not all. It is very important to also use this .cfg file<br />

(which is nma.cfg in the above comm<strong>and</strong>). Must use these configure comm<strong>and</strong>s<br />

also here, else it will not work<br />

\begin{X311}<br />

\Preamble{html,p-width}<br />

\begin{document}<br />

\Configure{$}{\PicMath}{\EndPicMath}{}<br />

\Configure{PicMath}{}{}{}{ class="math" align="absmiddle"}<br />

\EndPreamble<br />

If you want later on to change back to mathjax, remember to remove or comment the above 2 lines, else<br />

tex4ht will make .png for the in-line math <strong>and</strong> use mathjax for the display math. So can’t have the above when<br />

using mathjax.<br />

The file /usr/local/texlive/2013/texmf-dist/tex4ht/base/unix/tex4ht.env I am currently using is<br />

tex4ht.env<br />

Use the file above for best results.<br />

Lines that are pushed all the way to the left, are the effective lines that gets used.<br />

Everything else remains the same. Only the above change is needed in tex4ht.env<br />

This is the current .cfg that I use to make png for math. Notice, this line below makes it generate png for<br />

math<br />

\Preamble{xhtml,charset="utf-8",p-width,pic-align}<br />

while this line below makes it generate mathml, not png, <strong>and</strong> no mathjax. Just mathml for native browser<br />

use.<br />

\Preamble{xhtml,mathml,charset="utf-8",p-width,pic-align}<br />

\Preamble{xhtml,charset="utf-8",p-width,pic-align}<br />

\Configure{VERSION}{}<br />

\Configure{DOCTYPE}{\HCode{\Hnewline}}<br />

\Configure{HTML}{\HCode{\Hnewline}}{\HCode{\Hnewline}}<br />

\Configure{@HEAD}{}<br />

63

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!