New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latexmlc (LaTeXML 0.8.2) epub generation fails on Windows 10 #827

Closed
senthilmm opened this Issue Jan 31, 2017 · 11 comments

Comments

Projects
None yet
3 participants
@senthilmm

senthilmm commented Jan 31, 2017

There are multiple issues with epub generation.

Command line latexmlc --dest "%1.epub" "%1.tex" produces an epub with only mimetype file and META-INF folder containing container.xml.

The same script when run through TeXWorks throws an error

Can't locate loadable object for module XML::LibXML in @inc (@inc contains: C:\Strawberry\perl\site\lib D:/texlive/2016/tlpkg/tlperl/lib d:/texlive/2016/tlpkg/tlperl/site/lib d:/texlive/2016/tlpkg/tlperl/lib .) at C:\Strawberry\perl\site\lib/XML/LibXML.pm line 156.

and does not generate any epub.

On removing the path definition d:\texlive\2016\tlpkg\tlperl\bin from TeXWorks preferences, produces a new error

Cwd.c: loadable library and perl binaries are mismatched (got handshake key 0AA80080, needed 0AF00080)

@dginev

This comment has been minimized.

Collaborator

dginev commented Jan 31, 2017

I am sorry to say currently latexml doesn't have an active windows maintainer, so the regression is understandable.

If this is indeed a Windows-only problem I would welcome any patches sent to the main repository, as I may not have time to address this myself soon.

@brucemiller

This comment has been minimized.

Owner

brucemiller commented Jan 31, 2017

Yeah there's that (what @dginev says)...

And although I appreciate your trying to do some debugging, I'm not at all clear what the messages are saying. In the first case, isn't %1 a windows variable as used in a script? What's the actual command that gets executed? Does the TeX file implied by % exist? Were there no other errors or warnings? (Possibly the script you've used hid them?)

As for the other cases, I'm not clear what it means to "run through TeXWorks"; Isn't that a TeX frontend? I'm not clear what should happen in that case, why it might run any better. It seems that what has happened there is some confusion about which libraries get linked. That's probably not a useful scenario.

@senthilmm

This comment has been minimized.

senthilmm commented Feb 8, 2017

Apologize for the late response.

I'm not at all clear what the messages are saying. In the first case, isn't %1 a windows variable as used in a script? What's the actual command that gets executed? Does the TeX file implied by % exist? Were there no other errors or warnings? (Possibly the script you've used hid them?)

Yes, I am executing the windows batch file to convert the active document in TeXWorks to epub using the syntax specified in https://github.com/brucemiller/LaTeXML/wiki/Integrating-LaTeXML-into-TeX-editors.

The issue I found is, the Perl installation invoked in TeXWorks uses the lib from tlperl found in TeXLive folder. Whereas the same batch file executed on command prompt uses the Strawberry Perl libs where the required files (XML::LibXML) are found.

As for the other cases, I'm not clear what it means to "run through TeXWorks"; Isn't that a TeX frontend? I'm not clear what should happen in that case, why it might run any better. It seems that what has happened there is some confusion about which libraries get linked. That's probably not a useful scenario.

Yes, TeXWorks is a TeX Frontend that comes along with TeXLive installations. Being a newbie to Perl, unable to understand how the @inc is constructed and append the path to XML::LibXML. I understand this is off-topic.

I have attached a txt file that highlights the difference in environment where the batch file (latexmlc-epub.bat) is executed.
Perl_Installation_Issues.txt

@brucemiller

This comment has been minimized.

Owner

brucemiller commented Feb 8, 2017

Thanks for the clarifications. There are 2 parts here: Firstly, LaTeXML "should" work under Strawberry Perl's Perl (ie. from the command line) since it supplies the necessary and consistent libraries. Running under TeXWorks is probably not fruitful, since there's no way to know what libraries it accesses.

On the other hand, LaTeXML does need to use parts of your local TeX installation: the kpsewhich program, and various style files. But this should work via commandline and need not (should not) be run from within TeXWorks.

So, what might be useful for debugging would be to run
latexmlc --dest=mydocument.epub mydocument.tex
(for whatever mydocument) and capture the entire output as text; perhaps there's some error or warning message hint in there?

@senthilmm

This comment has been minimized.

senthilmm commented Feb 8, 2017

Thanks for your prompt response.

Here is the output captured after executing the following.

E:\Testing\LaTeXML>latexmlc --dest sample2e.epub sample2e.tex

(Loading C:\Strawberry\perl\site\lib\LaTeXML\Package\TeX.pool.ltxml...
(Loading C:\Strawberry\perl\site\lib\LaTeXML\Package\eTeX.pool.ltxml... 0.01 sec)
(Loading C:\Strawberry\perl\site\lib\LaTeXML\Package\pdfTeX.pool.ltxml... 0.06 sec) 0.20 sec)

latexmlc (LaTeXML version 0.8.2)
processing started Wed Feb 8 20:17:40 2017

(Digesting TeX sample2e...
(Processing content E:/Testing/LaTeXML/sample2e.tex...
(Loading C:\Strawberry\perl\site\lib\LaTeXML\Package\LaTeX.pool.ltxml... 0.16 sec)
(Loading C:\Strawberry\perl\site\lib\LaTeXML\Package\article.cls.ltxml... 0.02 sec) 0.45 sec) 0.47 sec)
(Building...
(Loading compiled schema C:\Strawberry\perl\site\lib\LaTeXML\resources/RelaxNG\LaTeXML.model... 0.02 sec)........ 0.26 sec)
(Rewriting... 0.00 sec)
(Math Parsing...5 formulae ...[1][2][3][4][5]
Math parsing succeeded:
ltx:XMath: �[32m5/5�[0m
ltx:XMArg: �[32m12/12�[0m
Symbols assumed as simple identifiers (with # of occurences):
'�[33mA{italic}�[0m' (1), '�[33mB{italic}�[0m' (1), '�[33mGamma�[0m' (1), '�[33ma{italic}�[0m' (2), '�[33mb{italic}�[0m' (1), '�[33mn{italic}�[0m' (2), '�[33mpsi�[0m' (1), '�[33mx{italic}�[0m' (4), '�[33my{italic}�[0m' (3), '�[33mz{italic}�[0m' (2)
Set MATHPARSER_SPECULATE to speculate on possible notations.
0.08 sec)
(Finalizing... 0.01 sec)
Conversion complete: �[32mNo obvious problems�[0m.

(post-processing...
(Scan OPS\sample2e.xhtml processing... 0.03 sec)
(CrossRef OPS\sample2e.xhtml processing... 0.01 sec)
(MathML::Presentation OPS\sample2e.xhtml 5 to process... 0.03 sec)
(XSLT[using LaTeXML-epub3.xsl] OPS\sample2e.xhtml processing... 0.06 sec)
(Writer OPS\sample2e.xhtml processing... 0.02 sec) 0.15 sec)
Post-processing complete: �[32mNo obvious problems�[0m
processing finished Wed Feb 8 20:17:42 2017
Status:conversion:0
�[32mNo obvious problems�[0m
Wrote sample2e.epub

The resultant epub along with the source attached herewith. The epub file extension has been changed to zip as epub attachment is not supported here. Sample2e.tex changed to Sample2e.txt.

sample2e.zip
sample2e.txt

@senthilmm

This comment has been minimized.

senthilmm commented Feb 8, 2017

The OPS folder alongwith sample2e.xhtml missing in the resultant epub file.

@brucemiller

This comment has been minimized.

Owner

brucemiller commented Feb 11, 2017

Hmm...the log looks like what it should look like, and it claims to have processed the xhtml file. But the epub file seems to be corrupt. I may have to hijack a windows machine to figure it out.

@senthilmm

This comment has been minimized.

senthilmm commented Feb 25, 2017

Till line no. 303 in LateXML.pm is reached. The contents are available in the temporary folder.
snapshot

The temporary folder gets deleted at line no. 307 rmtree($$opts{sitedirectory});

I reiterate, I am a newbie to Perl. Yet to get the concepts cleared.

@senthilmm

This comment has been minimized.

senthilmm commented Feb 27, 2017

Line No. 215-221 Pack.pm
my $payload;
if ($whatsout =~ /^archive(::zip)?$/) {
my $content_handle = IO::String->new($payload);
undef $payload unless ($archive->writeToFileHandle($content_handle) == AZ_OK); }
elsif ($whatsout eq 'archive::zip::perl') {
$payload = $archive; }
return $payload; }

The actual text content are appended to the archive file. Any thoughts.

@dginev

This comment has been minimized.

Collaborator

dginev commented Sep 5, 2017

Hm, the only way I can figure out what exactly misfired here is to reproduce on Windows 10 and see which part is deleted. As you say the content should be appended to the archive, which should still be operational on Linux.

I may need to get an updated Windows 10 install going and come back to give feedback here, sorry for the slow reply!

@dginev dginev self-assigned this Sep 5, 2017

@dginev dginev added this to the LaTeXML-0.8.3 milestone Sep 5, 2017

@dginev

This comment has been minimized.

Collaborator

dginev commented Mar 18, 2018

Hi! I am finally back in front of a Windows 10 machine and I can reproduce this report.

Will try to diagnose now. Btw, I successfully installed a fresh latexml via:

  • Installing Strawberry Perl, as usual
  • Cloning the brucemiller/LaTeXML repository via GitHub Desktop
  • Running cpanm . --verbose from the perl command line, in the cloned directory
  • I also have a MikTeX installation, so I can see the TeX requiring tests also ran well.

As the epub generation failed on a very basic file, I think I will also contribute a new test, to ensure we don't regress in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment