reitzig / ltx2any

Yet another LaTeX build wrapper, with one or two nifty features
GNU General Public License v3.0
59 stars 4 forks source link

How to debug errors in PDF log compilation? #64

Closed koppor closed 8 years ago

koppor commented 8 years ago

Creation of the pdf logs (parameter -lf pdf) fails here. The content of document.log.pdf.log is as follows:

! Too many }'s.
\endminipage ...pagefalse \color@endgroup \egroup 
                                                  \expandafter \@iiiparbox \...
l.134   \logref{207}{208}\endblockitem

pandoc: Error producing PDF from TeX source

I was searching for document.log.tex, but there was only diss-kopp.log.md. Where can I find the .tex to dig a bit into possible causes for the above error message?

koppor commented 8 years ago

Although this sounds like a pandoc issue, pandoc "document.log.md" -o "document.log.pdf" runs without any issues.

akerbos commented 8 years ago

Good question; I have no idea where Pandoc writes the temporary LaTeX file.

What you can do is change the call to Pandoc yourself. Insert

  target_file = "#{ParameterManager.instance[:jobname]}.log.tex

above that line and you should get the LaTeX file.

If you manage to construct an MWE, I'll have a look myself.

FWIW, \logref is something I hack into the Markdown log before passing it to Pandoc. It's entirely reasonable that there are bugs there, and that has happend before. In most cases, the issue was that specific log messages contained stuff that skrewed the regexp matching and/or ended up as LaTeX code when they should have stayed in their block code environments.

Note to self: this may be more robust if the markdown log used fenced code blocks instead of indented code blocks.

Note to self 2: since this keeps popping up, maybe log compilation should be done in two steps, always: Pandoc creates .tex and we call xelatex ourselves for the last step. Then we always have the intermediate step for debugging.

koppor commented 8 years ago

Think, a MWE will be difficult to construct. Maybe on a rainy day. :smiley:

Current investigation result. The first occurrence of logref in tex reads as follows:

\logref{207}{208}\endblockitem

But there is no \blockitem before.

akerbos commented 8 years ago

There should be a \blockitem right before either one of \(linked)error, \warning or \info, i.e. right at the start of this list item. If that's not there, it seems to be a bug indeed.

A good approach to creating MWEs is to delete half of the code and see if the error persists. If yes, continue. If no, undo and delete the other half.

akerbos commented 8 years ago

Deferred to #77 after inspecting a concrete example (private communication).

Hotfix for the specific issue may happen, though, pending further input.

reitzig commented 8 years ago

@koppor I completely reimplemented LaTeX/PDF log generation. If you are still interested, give it a shot -- there should be no (or other, at least) problems now.