3

I have managed to get tex4ht working (on debian jessie) for a moderately complex document (containing muliple \includegraphics, bibliography) with article class. However, for beamer class even the following simple document (t.tex) fails:

\documentclass{beamer}
\usetheme{default}

\title{Simple beamer doc}
\author{John D}
\date{12 Aug 2014}
\usepackage{graphicx}

\begin{document}

\begin{frame}
  \titlepage
\end{frame}

\begin{frame}{frame title}

  \includegraphics{xml-proc.eps}

\end{frame}

\end{document}

'latex t.tex' works fine but 'mk4ht htlatex t.tex' results in the error:

! TeX capacity exceeded, sorry [input stack size=5000].
<to be read again> 
                   \def 
l.19 \end{frame}

The culprit is \includegraphics. Removing \includegraphics eliminates above error producing html file with all slides (but obviously no figures). Tried increasing stack size to 50000, but same error. Also, specifying just \includegraphics{} (no filename) also produces same error.

A possible hint to the problem may be the following line in the log file (generated by 'mk4ht htlatex t.tex'):

LaTeX Info: Redefining \includegraphics on input line 16.

Above line is absent in the log file when an article class tex file is used (in which case \includegraphics causes no problem).

Any ideas why \includegraphics with beamer fails? Else any workaround?

  • Can you convert your image and include png or jpg? – percusse Aug 11 '14 at 23:44
  • Same problem using png image instead of eps. – sidhu1f Aug 12 '14 at 6:08
2

I think you will find many issues in tex4ht support for beamer, because it is really complex package which redefines many commands, which is what tex4ht do as well. \includegraphics is patched by both beamer and tex4ht, which creates a conflict. For easy fix of this issue, you may define custom command which will use \includegraphics with normal LaTeX and special tex4ht command otherwise.

create file mypic.sty:

\RequirePackage{graphicx}
\newcommand\mypic[1]{\includegraphics{#1}}
\endinput

and definition for tex4ht, file mypic.4ht

\renewcommand\mypic[1]{\Picture[picture]{#1}\special{t4ht+@File: #1}}

Note that this will work only for pictures supported b web browsers, ie. png, jpg, gif and svg.

\documentclass[trans]{beamer}
\usetheme{default}

\title{Simple beamer doc}
\author{John D}
\date{12 Aug 2014}
\usepackage{mypic}


\begin{document}


\begin{frame}
  \titlepage
\end{frame}

\begin{frame}{frame title}

  \mypic{xml-proc.png}

\end{frame}

\end{document}

note that I've added trans option to \documentclass{beamer}. this suppress creation of multiple slides when \only commands are used.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.