[tex4ht] Tex4ht bugreport

Michal Hoftich michal.h21 at gmail.com
Mon Jan 20 10:37:32 CET 2014


Hi,

in recent Koma-script, old font commands (\rm, \it, \bf, ...) are
defined in the other way than they
used to.

old way:

----
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
-----

new way:

-------
\newcommand*{\scr at DeclareOldFontCommand}[3]{%
  \DeclareRobustCommand #1{\@fontswitch {%
      \ClassWarning{\KOMAClassName}{Some warning}%
      #2%
    }{%
      \ClassWarning{\KOMAClassName}{Some warning}%
      #3%
    }%
  }%
}
\scr at DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
\scr at DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
-----

TeX4ht also tries to redefine these old font commands (from scrreprt.4ht):

---------------
\def\:temp#1#2!*?: {\def\:temp{#1}}
\expandafter\:temp\usepackage!*?:
\def\:tempa{\@latex at e@error}
\ifx \:temp\:tempa \else
   \def\:tempa#1#2#3#4{\tmp:toks{#1{#2}}%
   \long\expandafter\edef\csname #4 \endcsname{\the\tmp:toks
        {\expandafter\noexpand
   \csname o:\expandafter\:gobble\string #3:\endcsname}}}
\def\:temp#1{%
  \expandafter\expandafter\expandafter\:tempa\csname #1 \endcsname{#1}}
\:temp{rm}
\:temp{sf}
\:temp{tt}
\:temp{bf}
\:temp{it}

\fi
---------------

it is not easy to see what is going on, but \:tempa macro tries to
parse tokens produced by \DeclareOldFontCommand, resp.
\scr at DeclareOldFontCommand and some macros based on them are produced.
Because parameter #3 now contains `\ClassWarning{...}{...}\fontcommand
instead of just `\fontcommand`, this `\ClassWarning{...}{...}` must be
removed:

------
\ifx \:temp\:tempa \else
   \def\popthree#1#2#3#4{#4}
   \def\:tempa#1#2#3#4{\tmp:toks{#1{#2}}%
   \long\expandafter\edef\csname #4 \endcsname{\the\tmp:toks
        {\expandafter\noexpand
   \csname o:\expandafter\expandafter\:gobble\expandafter\string
\popthree#3:\endcsname}}}
-------

Same correction must be done also for scrbook.4ht.

Sample file now works correctly:

---------------
\documentclass{scrreprt}
\usepackage{pokus}
\begin{document}
Lorem ipsum dolor sit amet.
\bf Bold \it italic \rm and normal text.
\end{document}
----------------

Patch for tex4ht literate sources is attached.

Best regards,
Michal


2014/1/16 Tobias Pape <tobias at netshed.de>:
> Dear tex4ht community
> (Mail as sent to Karl Berry)
>
> The following very simple latex file fails to compile with tex4ht
> as of 2014-01.
> --->8---
> \documentclass{scrreprt}
> \begin{document}
> Lorem ipsum dolor sit amet.
> \end{document}
> ---8<---
>
> The error:
> […]
> (/usr/local/texlive/2013/texmf-dist/tex/generic/tex4ht/scrreprt.4ht
> ! Missing \endcsname inserted.
> <to be read again>
>                   \MessageBreak
> l.272 \:temp{rm}
>
> I use an up-to-date TeXLive 2013, with koma-script (scrreprt) v3.12 (2013-12-19)
> See also attached log files.
>
> An intermediate thing that got me further, was commenting the
> “offending” \:temp{rm} (and similar), while not being perfect, it was a
> tiny step forward.
>
>
> Best
>         -Tobias Pape
>
>
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scrfonts.patch
Type: text/x-patch
Size: 1211 bytes
Desc: not available
URL: <http://tug.org/pipermail/tex4ht/attachments/20140120/205cb664/attachment.bin>


More information about the tex4ht mailing list