2

If I try to compile this example document

\documentclass{beamer}
\begin{document}

\begin{frame}{Test}
  Test
\end{frame}

\end{document}

with htlatex temp.tex I get the output:

l.34951 --- TeX4ht warning --- \Configure{frametitle}? ---

! LaTeX Error: Missing \begin{document} in `'.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.34952 ...i \EndP \HCode{<h2 class="frametitle">}
                                                  \bgroup
? 
! Emergency stop.
 ...                                              
                                                  
l.34952 ...i \EndP \HCode{<h2 class="frametitle">}
                                                  \bgroup
No pages of output.

Full log can be found here

2

1 Answer 1

2

Here is modernized version of beamer.4ht, which should compile your sample:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% beamer.4ht                            2021-04-30-17:38 %
% Copyright (C) 2003-2009       Eitan M. Gurari         %
% Copyright 2009-2021 TeX Users Group
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or (at your option) any
% later version. The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions
% of LaTeX version 2005/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% The Current Maintainer of this work
% is the TeX4ht Project <http://tug.org/tex4ht>.
%
% If you modify this program, changing the
% version identification would be appreciated.
\NewConfigure{titlepage}{2}
\NewConfigure{title}{2}
\NewConfigure{author}{2}
\NewConfigure{institute}{2}
\NewConfigure{date}{2}
\NewConfigure{titlegraphic}{2}
\NewConfigure{andtitle}{1}
\NewConfigure{inst}{2}

\let\o:@section:\@section
\def\@section[#1]#2{%
   \expandafter\global\expandafter\sl:toks\expandafter
   {\the\sl:toks\leavevmode \o:@section:[#1]{#2}%
    \add:toc{section}{\thesection}{\secname}}%
   \expandafter\ifx\csname a:sec@slide\endcsname\relax
   \expandafter\ifx\csname b:sec@slide\endcsname\relax
       \the\sl:toks \global\sl:toks={}%
\fi\fi
%
}

\let\o:untitledsubsection:\untitledsubsection
\def\untitledsubsection#1{%
   \expandafter\global\expandafter\sl:toks\expandafter
   {\the\sl:toks\leavevmode \o:untitledsubsection:}%
   \expandafter\ifx\csname a:sec@slide\endcsname\relax
   \expandafter\ifx\csname b:sec@slide\endcsname\relax
       \the\sl:toks \global\sl:toks={}%
\fi\fi
%
}

\newtoks\sl:toks
\NewConfigure{sec@slide}{2}

\def\addtocontents#1#2{%
   \add:toc{#1}{}{#2}%
}
\def\add:toc#1#2#3{{%
   \csname if:toc\endcsname{
      \def\protect{\noexpand\noexpand\noexpand}%
      \edef\:tempa{\the\:tokwrite{\string\doTocEntry
   \string\toc#1{#2}{%
      \string\csname\space a:TocLink\string\endcsname
            {\FileNumber}{\cur:th\@currentlabel}{}{#3}%
   }{}\relax
}%
}\:tempa
   }%
}}
\def\tableofcontents{\futurelet\:temp\:TOC}
\def\:TOC{\ifx [\:temp \expandafter\:TableOfContents
          \else \:TableOfContents[toc]\fi}

\pend:defI\alert{\a:alert}
\append:defI\alert{\b:alert}
\NewConfigure{alert}{2}
\pend:defI\structure{\a:structure}
\append:defI\structure{\b:structure}
\NewConfigure{structure}{2}
\NewConfigure{sectionshadedintoc}{2}
\NewConfigure{sectionintoc}{2}
\NewConfigure{subsectionshadedintoc}{2}
\NewConfigure{subsectionintoc}{2}


\ifx \beamer@version\:UnDef
   
   \ifx \insertinstituteshort\:UnDef
      \append:def\beamer@andtitle{\a:andtitle}
\def\beamer@insttitle#1{\a:inst$\sp{#1}$\b:inst}
\def\beamer@instinst#1{\a:inst$\sp{#1}$\b:inst\ignorespaces}
\pend:def\titlepage{%
   \a:titlepage
   \pend:def\inserttitle{\a:title}%
   \append:def\inserttitle{\b:title}%
   \pend:def\insertauthor{\a:author}%
   \append:def\insertauthor{\b:author}%
   \pend:def\insertinstitute{\a:institute}%
   \append:def\insertinstitute{\b:institute}%
   \pend:def\insertdate{\a:date}%
   \append:def\insertdate{\b:date}%
   \pend:def\inserttitlegraphic{\a:titlegraphic}%
   \append:def\inserttitlegraphic{\b:titlegraphic}%
}
\append:def\titlepage{\b:titlepage}
\let\o:@subsection:\@subsection
\def\@subsection[#1]#2{%
   \expandafter\global\expandafter\sl:toks\expandafter
   {\the\sl:toks\leavevmode \o:@subsection:[#1]{#2}%
    \add:toc{subsection}{\thesection.\thesubsection}{#2}}%
   \expandafter\ifx\csname a:sec@slide\endcsname\relax
   \expandafter\ifx\csname b:sec@slide\endcsname\relax
       \the\sl:toks \global\sl:toks={}%
\fi\fi
%
}
\let\be:frameslide\frameslide
\def\frameslide{\a:sec@slide\the\sl:toks\b:sec@slide
   \global\sl:toks={}\be:frameslide}

   \else
      \append:def\andtitle{\a:andtitle}
\def\insttitle#1{\a:inst$\sp{#1}$\b:inst}
\def\instinst#1{\a:inst$\sp{#1}$\b:inst\ignorespaces}
\pend:def\titlepage{%
   \a:titlepage
   \pend:def\inserttitletitle{\a:title}%
   \append:def\inserttitletitle{\b:title}%
   \pend:def\insertauthortitle{\a:author}%
   \append:def\insertauthortitle{\b:author}%
   \pend:def\insertinstitute{\a:institute}%
   \append:def\insertinstitute{\b:institute}%
   \pend:def\insertdate{\a:date}%
   \append:def\insertdate{\b:date}%
   \pend:def\inserttitlegraphic{\a:titlegraphic}%
   \append:def\inserttitlegraphic{\b:titlegraphic}%
}
\append:def\titlepage{\b:titlepage}
\let\o:subsection:\subsection
\def\subsection#1{%
   \expandafter\global\expandafter\sl:toks\expandafter
   {\the\sl:toks\leavevmode \o:subsection:{#1}%
    \add:toc{subsection}{\thesection.\thesubsection}{#1}}%
   \expandafter\ifx\csname a:sec@slide\endcsname\relax
   \expandafter\ifx\csname b:sec@slide\endcsname\relax
       \the\sl:toks \global\sl:toks={}%
\fi\fi
%
}
\pend:def\slide{\a:sec@slide\the\sl:toks\b:sec@slide
   \global\sl:toks={}}

   \fi
\else
   
\fi
\let\Hy@EveryPageAnchor\relax
\def\pgf@trimright@final{0pt}
\def\pgf@trimleft@final{0pt}
\let\origEndP\EndP
\AtBeginDocument{\def\EndP{\let\EndP\origEndP}\SaveEndP}


\NewConfigure{frame}{2}
\NewConfigure{frametitle}{2}
\AddToHook{env/beamer@frameslide/before}{\RecallEndP\a:frame}
\AddToHook{env/beamer@frameslide/after}{\b:frame}

\long\def\:temp[#1]#2{%
\a:frametitle%
\o:beamer@@frametitle:[#1]{#2}%
\b:frametitle%
}

\HLet\beamer@@frametitle\:temp
% Beamer redefines \emph, it is necessary to insert hooks again

\pend:defI\emph{\a:emph}%
\append:defI\emph{\b:emph}%


\Hinput{beamer}
\endinput

It defines configurable hooks for slides that are not configured by default. So you need to use also a myconfig.cfg file:

\Preamble{xhtml}
\Css{section.slide {border:solid black 0.4pt;margin-bottom:1em;}}

\Configure{frame}{\ifvmode\IgnorePar\fi\EndP
    \HCode{<section class="slide">}
}{\ifvmode\IgnorePar\fi\EndP\HCode{</section>}}
\Configure{frametitle}{\ifvmode\IgnorePar\fi\EndP\HCode{<h2>}}{\ifvmode\IgnorePar\fi\EndP\HCode{</h2>}\par\ShowPar}
\begin{document}
\EndPreamble

Compile using (don't use htlatex, is is deprecated):

make4ht -c myconfig.cfg temp.tex

This is the result:

enter image description here

Not the answer you're looking for? Browse other questions tagged .