metanorma / tex2mn

Write Metanorma documents in LaTeX
https://www.metanorma.com
MIT License
2 stars 0 forks source link

Unable to compile Rice document, fails at latexmlpost #66

Closed ronaldtse closed 4 years ago

ronaldtse commented 4 years ago

After setting everything up, the first command runs:

$ latexml main.tex --output=main.xml --nocomments
latexml (LaTeXML version 0.8.4; revision 9a0e7dc5)
processing started Thu Nov 28 22:17:09 2019

(Digesting TeX main...
(Loading /Library/Perl/5.18/LaTeXML/Package/TeX.pool.ltxml...
(Loading /Library/Perl/5.18/LaTeXML/Package/eTeX.pool.ltxml... 0.00 sec)
(Loading /Library/Perl/5.18/LaTeXML/Package/pdfTeX.pool.ltxml... 0.01 sec) 0.17 sec)
(Processing content /Users/ronaldtse/src/mn/mn-samples-tex-iso/main.tex...
(Loading /Library/Perl/5.18/LaTeXML/Package/LaTeX.pool.ltxml... 0.22 sec)
(Loading /Users/ronaldtse/src/mn/mn-samples-tex-iso/metanorma.cls.ltxml...
(Loading /Library/Perl/5.18/LaTeXML/Package/article.cls.ltxml... 0.01 sec)
(Loading /Library/Perl/5.18/LaTeXML/Package/lxRDFa.sty.ltxml... 0.00 sec)
(Loading /Library/Perl/5.18/LaTeXML/Package/graphicx.sty.ltxml...
(Loading /Library/Perl/5.18/LaTeXML/Package/graphics.sty.ltxml... 0.00 sec) 0.03 sec)
(Loading /Library/Perl/5.18/LaTeXML/Package/hyperref.sty.ltxml...
(Loading /Library/Perl/5.18/LaTeXML/Package/url.sty.ltxml... 0.00 sec)
(Loading /Library/Perl/5.18/LaTeXML/Package/nameref.sty.ltxml... 0.00 sec) 0.07 sec)
(Loading /Library/Perl/5.18/LaTeXML/Package/amsmath.sty.ltxml...
(Loading /Library/Perl/5.18/LaTeXML/Package/amsbsy.sty.ltxml... 0.00 sec)
(Loading /Library/Perl/5.18/LaTeXML/Package/amstext.sty.ltxml... 0.00 sec)
(Loading /Library/Perl/5.18/LaTeXML/Package/amsopn.sty.ltxml... 0.00 sec) 0.04 sec)
(Loading /Library/Perl/5.18/LaTeXML/Package/subcaption.sty.ltxml...
(Loading /Library/Perl/5.18/LaTeXML/Package/caption.sty.ltxml... 0.02 sec) 0.03 sec) 0.20 sec)
(Processing content /Users/ronaldtse/src/mn/mn-samples-tex-iso/sections-en/00-foreword.tex... 0.14 sec)
(Processing content /Users/ronaldtse/src/mn/mn-samples-tex-iso/sections-en/00-introduction.tex... 0.15 sec)
(Processing content /Users/ronaldtse/src/mn/mn-samples-tex-iso/sections-en/01-scope.tex... 0.05 sec)
(Processing content /Users/ronaldtse/src/mn/mn-samples-tex-iso/sections-en/02-normref.tex... 0.18 sec)
(Processing content /Users/ronaldtse/src/mn/mn-samples-tex-iso/sections-en/03-termdef.tex... 0.41 sec)
(Processing content /Users/ronaldtse/src/mn/mn-samples-tex-iso/sections-en/07-testreport.tex... 0.35 sec)
(Processing content /Users/ronaldtse/src/mn/mn-samples-tex-iso/sections-en/08-packaging.tex... 0.09 sec)
(Processing content /Users/ronaldtse/src/mn/mn-samples-tex-iso/sections-en/aa-annex-a.tex... 1.00 sec)
(Processing content /Users/ronaldtse/src/mn/mn-samples-tex-iso/sections-en/b0-bibliography.tex... 1.18 sec) 4.16 sec) 4.35 sec)
(Building...
(Loading compiled schema /Library/Perl/5.18/LaTeXML/resources/RelaxNG/LaTeXML.model... 0.02 sec)................................. 1.34 sec)
(Rewriting... 0.01 sec)
(Math Parsing...9 formulae ...[1][2][3][4][5][6][7][8][9]
Math parsing succeeded:
   ltx:XMath: 9/9
   ltx:XMArg: 7/7
Symbols assumed as simple identifiers (with # of occurences):
   'm{italic}' (6), 't{italic}' (1), 'w{italic}' (1)
Set MATHPARSER_SPECULATE to speculate on possible notations.
 0.04 sec)
(Finalizing... 0.06 sec)
Conversion complete: No obvious problems.
processing finished Thu Nov 28 22:17:15 2019

But then the latexmlpost command fails:

$ latexmlpost main.xml --destination=main.adoc --stylesheet=Metanorma.xsl --nocrossref --nodefaultresources
latexmlpost (LaTeXML version 0.8.4; revision 9a0e7dc5)
processing started Thu Nov 28 22:17:17 2019
Error:malformed:document Document fails RelaxNG validation (LaTeXML)
    Validation reports: main.xml:0: Relax-NG validity error : Element document has extra content: resource
    In Post::Document[main.adoc] ->validate

(post-processing...
(Scan main.adoc processing... 0.08 sec)
(MakeBibliography main.adoc 2 to process... 0.00 sec)
(XSLT[using Metanorma.xsl] main.adoc processing... 0.01 sec)
(Writer main.adoc processing...
Warning:perl:warn Wide character in print
    at /Library/Perl/5.18/LaTeXML/Post/Writer.pm line 59
    In Post::Writer[@0x7f87dd32a5a8] ->process
 0.00 sec) 0.09 sec)
Postprocessing complete: 1 warning
processing finished Thu Nov 28 22:17:17 2019
paolobrasolin commented 4 years ago

The weird error message is possibly due to a bug I reported in https://github.com/brucemiller/LaTeXML/issues/1220

The actual reason of the failure is the usage of a few attributes outside of LaTeXml's ltx schema. This is not particularly dangerous, as we use them just as as a simple passthrough.

Note that despite the error latexmlpost outputs the file anyways. To skip schema validation you can pass the --novalidate flag to it as shown in the sample Makefile.

I'm closing this as it's not blocking the expected output. However I'm opening an issue for implementing the appropriate solution to the general problem: https://github.com/metanorma/tex2mn/issues/69

ronaldtse commented 4 years ago

@paolobrasolin works well for me now. Thanks!