# tex4ht fails with scrartcl class when defining \rm command. Argument of \popthree has an extra

This MWE compiles OK with lualatex and pdflatex but fails with tex4ht. Why? And this happens only when using scrartcl and not with article.

\documentclass[11pt]{scrartcl}%{article}
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}

\begin{document}
test
\end{document}


Now

 make4ht -ulm draft foo.tex
....
(/usr/local/texlive/2018/texmf-dist/tex/generic/tex4ht/html5.4ht))
(/usr/local/texlive/2018/texmf-dist/tex/generic/tex4ht/scrartcl.4ht
! Argument of \popthree has an extra }.
<inserted text>
\par
l.33 \:temp{rm}
?


I also tried

 \documentclass[11pt,enabledeprecatedfontcommands]{scrartcl}


But make4ht still gave same error.

Is there a workaround other than using article? I need to use \DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm} for other things.

Using TL 2018

Try the following version of scrartcl.4ht file:

% scrartcl.4ht (2015-02-07-15:56), generated from tex4ht-4ht.tex
% Copyright 1999-2009 Eitan M. Gurari
% Copyright 2009-2015 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.
\immediate\write-1{version 2015-02-07-15:56}

\def\:temp#1#2#3{\DeclareOldFontCommand{#1}{\normalfont#2}{#3}}
\:temp{\rm}{\rmfamily}{\mathrm}
\:temp{\sf}{\sffamily}{\mathsf}
\:temp{\tt}{\ttfamily}{\mathtt}
\:temp{\bf}{\bfseries}{\mathbf}
\:temp{\it}{\itshape}{\mathit}

\input article.4ht
\Def:Section\minisec{}{#1}
\let\:minisec=\minisec

This version just defines old font commands and includes article.4ht file, where they are patched again. It seems that the patching of these commands in article.4ht is unnecessary and it should be safe to remove it. I need to investigate it more, but it looks like a really old hack.