brucemiller / LaTeXML

LaTeXML: a TeX and LaTeX to XML/HTML/ePub/MathML translator.
http://dlmf.nist.gov/LaTeXML/
Other
961 stars 101 forks source link

memoir.cls support #1011

Open mspertus opened 6 years ago

mspertus commented 6 years ago

When I run latexml on memoir documents, I get a fatal error, presumably because there is no binding for the memoir class. Here is a minimal example that I have adapted from https://github.com/cplusplus/draft.

\begin{document}
\makepagestyle{foo}
\makeatletter
\makepsmarks{foo}{%
  \def\chaptermark##1{\markboth{##1}{##1}}%
}
\end{document}

resulting in the following output (note the missing binding and the fatal error)


processing started Fri Jul  6 17:39:09 2018

(Digesting TeX foo...
(Loading /usr/share/perl5/LaTeXML/Package/TeX.pool.ltxml...
(Loading /usr/share/perl5/LaTeXML/Package/eTeX.pool.ltxml... 0.00 sec)
(Loading /usr/share/perl5/LaTeXML/Package/pdfTeX.pool.ltxml... 0.01 sec) 0.12 sec)
(Processing content /home/mps/foo.tex...
(Loading /usr/share/perl5/LaTeXML/Package/LaTeX.pool.ltxml... 0.13 sec)
Warning:missing_file:memoir Can't find binding for class memoir (using OmniBus)
    at /home/mps/foo.tex; line 2 col 6
    Anticipate undefined macros or environments
    search paths are /home/mps
    In Core::Definition::Constructor[\docume... from LaTeX.pool.ltxml line 56

(Loading /usr/share/perl5/LaTeXML/Package/OmniBus.cls.ltxml...
(Loading /usr/share/perl5/LaTeXML/Package/article.cls.ltxml... 0.01 sec)
(Loading /usr/share/perl5/LaTeXML/Package/inst_support.sty.ltxml... 0.00 sec)
(Loading /usr/share/perl5/LaTeXML/Package/epsf.sty.ltxml... 0.01 sec)
(Loading /usr/share/perl5/LaTeXML/Package/graphicx.sty.ltxml...
(Loading /usr/share/perl5/LaTeXML/Package/graphics.sty.ltxml... 0.00 sec) 0.02 sec) 0.07 sec)
Error:undefined:\makepagestyle The token T_CS[\makepagestyle] is not defined.
    at /home/mps/foo.tex; line 3 col 14
    Defining it now as <ltx:ERROR/>
    In Core::Stomach[@0x558455987108] at /home/mps/foo.tex; line 3 col 14
     <= Core::Definition::Constructor[\begin{... <= Core::Stomach[@0x558455987108] <= ...

Error:undefined:\makepsmarks The token T_CS[\makepsmarks] is not defined.
    at /home/mps/foo.tex; line 5 col 12
    Defining it now as <ltx:ERROR/>
    In Core::Stomach[@0x558455987108] at /home/mps/foo.tex; line 5 col 12
     <= Core::Definition::Constructor[\begin{... <= Core::Stomach[@0x558455987108] <= ...

Fatal:expected:#1 Parameters for '\chaptermark' not in order in ##1
    at /home/mps/foo.tex; line 6 col 42
    In Core::Definition::Primitive[\def Skip... from TeX.pool.ltxml line 1044
     <= Core::Stomach[@0x558455987108] <= Core::Definition::Primitive[Begin] <= Core::Stomach[@0x558455987108] <= Core::Definition::Constructor[\begin{... <= Core::Stomach[@0x558455987108]
1 warning; 2 errors; 1 fatal error; 2 undefined macros[\makepagestyle, \makepsmarks]; 1 missing file[memoir.cls]

Conversion complete: 1 warning; 2 errors; 1 fatal error; 2 undefined macros[\makepagestyle, \makepsmarks]; 1 missing file[memoir.cls].
processing finished Fri Jul  6 17:39:09 2018```

Any advice on how to proceed?
Thanks,
Mike
brucemiller commented 6 years ago

Hmm, I thought there was another open issue about memoir; maybe I was thinking of koma #915. They're both really nice, but large & complex classes/packages. You could try using --includestyles to let latexml try to interpret the class file, but even if it can cope with the TeX, class files typically slip in beneath the layer where latexml can interpret the document structure.

What would help to create bindings (other than writing the bindings yourself! :>) would be a sample or set of sample files as simple as possible, yet exercising most of the features of the class/package. The really time consuming part, for me, is sifting through the documentation to find all the unique bits. And the memoir documentation is 500 pages!

mspertus commented 6 years ago

Thanks, Bruce. I have been modifying the "book" binding, pretty much just by adding DefMacro{...}{} because I'm new to latexml and don't know what the @#$% I'm doing, but that might serve as a good starting point for someone more knowledgeable. I will share once I've gotten a little further along.

mspertus commented 6 years ago

Also wanted to call out https://github.com/cplusplus/draft std.tex mentioned in the issue as a possible sample file. While it is large, nearly of it is just content, with most of the action in styles.tex. Perhaps the biggest benefit of that is that I am trying to build this, so my fork at https://github.com/mspertus/LaTeXML, however lame, is at least a starting point. The biggest awkwardness is that it uses some other unbound style files like isodate, but I think those are fairly small and likely good targets too.

mspertus commented 6 years ago

While I don't really know what I'm doing, I created support for memoir (and some other style files I need) at https://github.com/mspertus/LaTeXML. This successfully compiles https://github.com/cplusplus/draft with one caveat: I had to comment out the error for underscores outside of math mode due to the problem described at http://lists.informatik.uni-erlangen.de/pipermail/latexml/2018-July/002391.html.

Still, it is very satisfying and important to my projects to be able to compile an intricate 1400 page memoir file and hope that it can point the way to proper support.

Thanks, Mike