I now want to convert tex to html file. it only has some errors before but after i seems to update some package or something, it can not produce html file. the source code and the bib code is suggested to referred to another post

[Problems using htlatex and bibtex to html and then to word

The command i use is only simle as

htlatex Text.tex

the compling error are listed as below:

This is pdfTeX, Version 3.14159265-2.6-1.40.18 (MiKTeX 2.9.6350 64-bit) (preloaded format=latex 2017.10.24)  24 OCT 2017 20:55
entering extended mode
umentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname te
ode}{\documentstyle[tex4ht]}}}\makeatother\HCode .a.b.c.\input  Fancypattern
(Fancypattern.tex (iopart.cls
Document Class: iopart 1996/06/10 v0.0 IOP Journals LaTeX article class
File: iopart12.clo 1997/01/15 v1.0 LaTeX2e file (size option)
version 2008-10-27-17:23
Package: tex4ht 
--- Note --- for _ at preamble, use the command line option `early_'
--- Note --- for ^ at preamble, use the command line option `early^'
version 2009-05-21-09:32
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\epstopdf.sty"
Package: epstopdf 2016/05/15 v2.6 Conversion with epstopdf on the fly (HO)

("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\epstopdf-base.sty"
Package: epstopdf-base 2016/05/15 v2.6 Base part for package epstopdf

("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty"
Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO)
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\grfext.sty"
Package: grfext 2016/05/16 v1.2 Manage graphics extensions (HO)

("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\kvdefinekeys.sty"
Package: kvdefinekeys 2016/05/16 v1.4 Define keys (HO)

("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty"
Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\kvoptions.sty"
Package: kvoptions 2016/05/16 v3.12 Key value format for package options (HO)

("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\keyval.sty"
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\kvsetkeys.sty"
Package: kvsetkeys 2016/05/16 v1.17 Key value parser (HO)

("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\etexcmds.sty"
Package: etexcmds 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)

("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifluatex.sty"
Package: ifluatex 2016/05/16 v1.4 Provides the ifluatex switch (HO)
Package ifluatex Info: LuaTeX not detected.
Package etexcmds Info: Could not find \expanded.
(etexcmds)             That can mean that you are not using pdfTeX 1.50 or
(etexcmds)             that some package has redefined \expanded.
(etexcmds)             In the latter case, load this package earlier.
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\pdftexcmds.sty"
Package: pdftexcmds 2017/03/19 v0.25 Utility functions of pdfTeX for LuaTeX (HO

("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifpdf.sty"
Package: ifpdf 2017/03/15 v3.2 Provides the ifpdf switch
Package pdftexcmds Info: LuaTeX not detected.
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode is ignored in DVI mode.

Package epstopdf Warning: No graphics package `graphic{s,x}' loaded.

)) ("C:\Program Files\MiKTeX 2.9\tex\latex\subfigure\subfigure.sty"
Package: subfigure 2002/07/30 v2.1.4 subfigure package

* Local config file subfigure.cfg used *
("C:\Program Files\MiKTeX 2.9\tex\latex\subfigure\subfigure.cfg")
("C:\Program Files\MiKTeX 2.9\tex\latex\cite\cite.sty"
LaTeX Info: Redefining \cite on input line 302.
LaTeX Info: Redefining \nocite on input line 332.
Package: cite 2015/02/27  v 5.5
("C:\Program Files\MiKTeX 2.9\tex\latex\multirow\multirow.sty"
Package: multirow 2016/11/25 v2.2 Span multiple rows of a table
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)

("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
Package: graphics 2017/04/14 v1.1b Standard LaTeX Graphics (DPC,SPQR)

("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\trig.sty"
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics-cfg\graphics.cfg"
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
Package graphics Info: Driver file: dvips.def on input line 99.

("C:\Program Files\MiKTeX 2.9\tex\latex\graphics-def\dvips.def"
File: dvips.def 2016/07/10 v3.1a Driver-dependent file (DPC,SPQR)
) (iopams.sty
Package: iopams 1997/02/13 v1.0

("C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amsgen.sty"
File: amsgen.sty 1999/11/30 v2.0 generic functions
("C:\Program Files\MiKTeX 2.9\tex\latex\amsfonts\amsfonts.sty"
Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support
LaTeX Font Info:    Overwriting math alphabet `\mathfrak' in version `bold'
(Font)                  U/euf/m/n --> U/euf/b/n on input line 106.
("C:\Program Files\MiKTeX 2.9\tex\latex\amsfonts\amssymb.sty"
Package: amssymb 2013/01/14 v3.01 AMS font symbols
("C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amsbsy.sty"
Package: amsbsy 1999/11/29 v1.2d Bold Symbols
("C:\Program Files\MiKTeX 2.9\tex\latex\adjustbox\adjustbox.sty"
Package: adjustbox 2012/05/21 v1.0 Adjusting TeX boxes (trim, clip, ...)

("C:\Program Files\MiKTeX 2.9\tex\latex\xkeyval\xkeyval.sty"
Package: xkeyval 2014/12/03 v2.7a package option processing (HA)

("C:\Program Files\MiKTeX 2.9\tex\generic\xkeyval\xkeyval.tex"
("C:\Program Files\MiKTeX 2.9\tex\generic\xkeyval\xkvutils.tex"
File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
("C:\Program Files\MiKTeX 2.9\tex\latex\adjustbox\adjcalc.sty"
Package: adjcalc 2012/05/16 v1.1 Provides advanced setlength with multiple back
-ends (calc, etex, pgfmath)
("C:\Program Files\MiKTeX 2.9\tex\latex\adjustbox\trimclip.sty"
Package: trimclip 2012/05/16 v1.0 Trim and clip general TeX material

("C:\Program Files\MiKTeX 2.9\tex\latex\collectbox\collectbox.sty"
Package: collectbox 2012/05/17 v0.4b Collect macro arguments as boxes
Package trimclip Info: Using driver 'tc-dvips.def'.

("C:\Program Files\MiKTeX 2.9\tex\latex\adjustbox\tc-dvips.def"
File: tc-dvips.def 2012/05/13 v1.0 Clipping driver for dvips

("C:\Program Files\MiKTeX 2.9\tex\latex\ifoddpage\ifoddpage.sty"
Package: ifoddpage 2016/04/23 v1.1 Conditionals for odd/even page detection
("C:\Program Files\MiKTeX 2.9\tex\latex\ltxmisc\varwidth.sty"
Package: varwidth 2009/03/30 ver 0.92;  Variable-width minipages
("C:\Program Files\MiKTeX 2.9\tex\latex\was\upgreek.sty"
Package: upgreek 2003/02/12 v2.0 (WaS)
Package upgreek Info: Using Euler Roman for upright Greek on input line 31.
LaTeX Font Info:    Overwriting symbol font `ugrf@m' in version `bold'
(Font)                  U/eur/m/n --> U/eur/b/n on input line 38.
version 2009-01-07-07:11
--- Note --- for additional information, use the command line option `info'

 TeX4ht info is available in the log file 
) (C:\Users\zhang\AppData\Roaming\MiKTeX\2.9\tex\generic\tex4ht\tex4ht.sty
version 2008-10-27-17:23

--- needs --- tex4ht Fancypattern ---
\openout15 = `Fancypattern.tmp'.

--- Note --- for XML code, use the command line option `xml' or `xhtml'
Runaway argument?
{\GenericError { }{LaTeX Error: No \let \reserved@d =[\def \def docum\ETC.
! Paragraph ended before \:CrsWrd was complete.
<to be read again> 
l.2 ...voidb@x \futurelet \:temp \def \:temp {\par
                                                   }\:temp \relax \xdef {0}{...


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

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.

l.2 ...\futurelet \:temp \def \:temp {\par }\:temp
                                                   \relax \xdef {0}{}{{2}{{0...

! Missing control sequence inserted.
<inserted text> 
l.2 ...mp \def \:temp {\par }\:temp \relax \xdef {
                                                  0}{}{{2}{{0}{}}}}\def \bgr...

! Too many }'s.
l.2 ...par }\:temp \relax \xdef {0}{}{{2}{{0}{}}}}
                                                  \def \bgroup \def \:temp {...

! Too many }'s.
l.2 ...t 2\afterassignment \xdef \:temp {1}\egroup
                                                   \mth:op \tmp:cnt {\gdef \...

! Undefined control sequence.
l.2 ...rassignment \xdef \:temp {1}\egroup \mth:op
                                                   \tmp:cnt {\gdef \ht:every...

! Missing number, treated as zero.
<to be read again> 
l.2 ... \xdef \:temp {1}\egroup \mth:op \tmp:cnt {
                                                  \gdef \ht:everypar {\relax...

! Missing control sequence inserted.
<inserted text> 
l.2 ... \xdef \:temp {1}\egroup \mth:op \tmp:cnt {
                                                  \gdef \ht:everypar {\relax...

! Too many }'s.
l.2 ...t 2\afterassignment \xdef \:temp {1}\egroup
                                                   \mth:op \tmp:cnt {\ht:eve...

! Undefined control sequence.
l.2 ...rassignment \xdef \:temp {1}\egroup \mth:op
                                                   \tmp:cnt {\ht:everypar {}...

! Missing number, treated as zero.
<to be read again> 
l.2 ... \xdef \:temp {1}\egroup \mth:op \tmp:cnt {
                                                  \ht:everypar {}}\xdef \glo...

! Missing control sequence inserted.
<inserted text> 
l.2 ... \xdef \:temp {1}\egroup \mth:op \tmp:cnt {
                                                  \ht:everypar {}}\xdef \glo...

! Missing { inserted.
l.2 ...:cnt {\ht:everypar {}}\xdef \global \let  }
! Too many }'s.
l.2 ...nt {\ht:everypar {}}\xdef \global \let  } }

! Use of \bgroup doesn't match its definition.
\:CrossWord ->\bgroup \no:catcodes 
                                   {128}{255}{12}\catcode `\: 12 \catcode `\...
l.3 \:CrossWord
! Too many }'s.
\:CrsWrd #1#2#3->\egroup 
                         \sv:crs {#1}{#2}{#3}
l.3 \:CrossWord{)Qx1-10001}{1}{2}
! Missing $ inserted.
<inserted text> 
l.4 \:
! Use of global doesn't match its definition.
extract@font ...@external@font global expandafter 
                                                  font font@name external@fo...
l.4 \:
! Use of global doesn't match its definition.
extract@font ...@external@font global expandafter 
                                                  font font@name external@fo...
l.4 \:
! Use of global doesn't match its definition.
extract@font ...@external@font global expandafter 
                                                  font font@name external@fo...

but there is absolutely no error when i compile it to a pdf file. anyone who can tell me what is happening? may be i should create a special configuration file for HTlatex?

  • there is some issue with \maketitle, it causes the fatal error – michal.h21 Oct 24 '17 at 19:30
  • after i comment \maketitle, there is still such problem. it seems i changed some thing, maybe the version or some package. – shqiang Oct 24 '17 at 19:47
  • Please post an example code that reproduces the problem. Without this it may be difficult for anyone to help you. – Ian Thompson Oct 24 '17 at 19:50
  • i give source code in another post tex.stackexchange.com/questions/397812/… because if i put together, the body will be too long to post it in one single file. please take a look at it. – shqiang Oct 24 '17 at 19:56

As I said in my previous answer, the main issue is that iopart class redefines lot of standard LaTeX macros and even change which arguments they may take. Some of these issues may be solved in the configuration file for tex4ht, but some needs fix in the class itself.

I've fixed only most obvious issues:

  • \maketitle causes tex4ht fatal error

  • titling commands produce wrong formatting

  • sectioning commands produce spurious numbers on line that precede their use

  • \br command causes compilation error

All of them except the issue with sections can be fixed in the config file.

File iopart.4ht:

\input article.4ht


\Configure{title}{\ifvmode\IgnorePar\fi\EndP\HCode{<h2 class="titleHead">}\NoFonts}{\ifvmode\IgnorePar\fi\EndP\EndNoFonts\HCode{</h2>\Hnewline}}

\Configure{author}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="author">}\NoFonts}{\ifvmode\IgnorePar\fi\EndP\EndNoFonts\HCode{</div>\Hnewline}}

\Configure{address}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="address">}\NoFonts}{\EndNoFonts\ifvmode\IgnorePar\fi\EndP\HCode{</div>\Hnewline}}

\Configure{pacs}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="pacs">}\NoFonts}{\EndNoFonts\ifvmode\IgnorePar\fi\EndP\HCode{</div>\Hnewline}}

% \let\s:title\@stitle

% \let\f:title\@ftitle


\def\pacs#1{\a:pacs PACS numbers: #1\b:pacs\par}




The issue with sections need to be fixed in iopart.cls. It seems that default macros for sections are redefined in order to get dot after the last number in the section counter.

The following code:

\def\@sect#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth
     \edef\@svsec{\csname the#1\endcsname. }
     \@tempskipa #5\relax
      \ifdim \@tempskipa>\z@
        \begingroup #6\relax
          \noindent{\hskip #3\relax\@svsec
          {\interlinepenalty \@M #8\par}%
       \csname #1mark\endcsname{#7}\addcontentsline
         {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                      \protect\numberline{\csname the#1\endcsname}\fi
        \def\@svsechd{#6\hskip #3\relax  %% \relax added 2 May 90
                   \@svsec #8\csname #1mark\endcsname
                           {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                             \protect\numberline{\csname the#1\endcsname}\fi
\def\@ssect#1#2#3#4#5{\@tempskipa #3\relax
   \ifdim \@tempskipa>\z@
     \begingroup #4\noindent{\hskip #1}{\interlinepenalty \@M #5\par}\endgroup
   \else \def\@svsechd{#4\hskip #1\relax #5}\fi

Can be replaced with

 \renewcommand{\@seccntformat}[1]{\csname the#1\endcsname.\quad}

which does the same thing but doesn't break tex4ht.

With these changes, the document looks like this:

enter image description here

  • thanks a lot. i just summerize the problem and prepared another post. it seems not necessary now. thanks a lot! – shqiang Oct 25 '17 at 13:09
  • @shqiang I am sure you will find much more issues, but it shouldn't be that hard to fix them. At least I hope. – michal.h21 Oct 25 '17 at 13:50
  • for the moment, it works well. there is also other issue, like the .pdf file. i remembered there was also some post before. thanks a lot. – shqiang Oct 25 '17 at 14:17

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.