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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Now the file foo2.html will display in the browser as<br />

notice: The math does not show up in the HTML. This is a known issue with using math+tickz+htlatex see<br />

http://tex.stackexchange.com/questions/124682/error-using-htlatex-with-tikz-forest-package-invalid-<br />

A better approach is this: Use separate latex file to make the diagram using tikz. Use st<strong>and</strong>alone class. Then<br />

generate the pdf file using pdflatex.<br />

Next convert the pdf to png, then using a separate latex file, include this image as png where it needs to go.<br />

This way htlatex <strong>and</strong> pdflatex will be able to process it ok. Here are the steps.<br />

1. make separate latex file for each diagram. For example diagram.tex<br />

\documentclass{st<strong>and</strong>alone}<br />

\usepackage{tikz<br />

}<br />

\usetikzlibrary{trees}<br />

\begin{document}<br />

\begin{tikzpicture}<br />

\node {root}<br />

child {node {$\frac{a}{b}$}};<br />

\end{tikzpicture}<br />

\end{document}<br />

2. compile the above file to pdf<br />

pdflatex diagram.tex<br />

3. convert the pdf file to png<br />

pdftoppm -png diagram.pdf > diagram.png<br />

or<br />

convert -density 200 -limit memory 64MB -limit map 128MB -colorspace RGB diagram.pdf diagram.png<br />

\begin{X311}<br />

%<br />

\item create the latex file which will use the above diagram, say \verb|main.tex|<br />

\begin{X311}<br />

\documentclass{article}<br />

\usepackage{graphicx}<br />

\begin{document}<br />

The following diagram was generated using tikz+latex in<br />

a separate file<br />

\includegraphics{diagram.png}<br />

<strong>and</strong> it is now in html<br />

\end{document}<br />

66

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

Saved successfully!

Ooh no, something went wrong!