mrzool / invoice-boilerplate

Simple automated LaTeX invoicing system
http://mrzool.cc/tex-boilerplates/
GNU General Public License v2.0
702 stars 102 forks source link

Paragraph ended before \ST@left@ii was complete. #16

Closed phlind closed 3 years ago

phlind commented 3 years ago

A nice template, that worked fine till some time ago, but I assume that either a pandoc or a latex package update broke it(?). When I run it as is, I get:

pandoc details.yml -o output.pdf --template=template.tex --pdf-engine=xelatex
[WARNING] Could not deduce format from file extension .yml
  Defaulting to markdown
[WARNING] Invalid 'lang' value 'english'.
  Use an IETF language tag like 'en-US'.

After correcting the language code, I get another error:

[WARNING] Could not deduce format from file extension .yml
  Defaulting to markdown
Error producing PDF.
! Paragraph ended before \ST@left@ii was complete.
<to be read again>
                   \par
l.135

make: *** [output.pdf] Error 43
the-solipsist commented 3 years ago

Hi Mattia! @mrzool, I can confirm that this fails. Here's what I get with the --verbose flag set:

New spreadtab: \begin{tabular}[t t t]{lp{8.2cm}r}
* reading tab:
Runaway argument?
\number \ST@rowcount )\fi \fi \fi \fi \ST@letname {text@\number \ST@colcount \E
TC.
! Paragraph ended before \ST@left@ii was complete.
<to be read again> 
                   \par 
l.135 

No pages of output.
Transcript written on /tmp/tex2pdf.-c668c60288c687b8/input.log.

Error producing PDF.
! Paragraph ended before \ST@left@ii was complete.
<to be read again> 
                   \par 
l.135 
erictapen commented 3 years ago

@mrzool seemed to ask for a solution to this problem four years ago, but I'm too much of a TeX noob to apply the answer.

145818 commented 3 years ago

Same thing happening for me on Ubuntu 20.04.1. Unfortunate since this looks like a very nice template.

sigstart commented 3 years ago

If I recall correctly, last time I looked at this the issue traced back to the hyphenation package.

Since I didn't have time to sit and figure it out, I just left the invalid "english" lang value in there and the template works just fine.

the-solipsist commented 3 years ago

If I recall correctly, last time I looked at this the issue traced back to the hyphenation package.

Hi, @sigstart. The problem seems to be with spreadtab, not hyphenation. If you comment out the following lines, then no error is thrown up:

https://github.com/mrzool/invoice-boilerplate/blob/08bbe351192bdf9f9098e450802755324a2e66fd/template.tex#L125-L139

If you replace that with a simple example from the spreadtab user's manual, then it works:

\begin{spreadtab}{{tabular}{rr|r}}
22       & 54         & a1+b1 \\
43       & 65         & a2+b2 \\
49       & 37         & a3+b3 \\
\hline
a1+a2+a3 & b1+b2+b3   & a4+b4
\end{spreadtab}

So clearly, the problem is somewhere in that table.

mattiabiondi commented 3 years ago

If I recall correctly, last time I looked at this the issue traced back to the hyphenation package.

Since I didn't have time to sit and figure it out, I just left the invalid "english" lang value in there and the template works just fine.

I confirm that this fixed the issue for me. Thanks!

thestr4ng3r commented 3 years ago

This would passthrough the pandoc-defined lang parameter directly: https://github.com/mrzool/invoice-boilerplate/blob/08bbe351192bdf9f9098e450802755324a2e66fd/template.tex#L69

But pandoc doesn't like english et al., which would be specific to polyglossia, and instead can automatically translate IETF tags to the corresponding ids for whatever generator/package is used. So use lang: en-US and replace the part in the template with something like:

\setmainlanguage{$polyglossia-lang.name$}

I have no clue how this affects the spreadtab stuff, but this is the correct way to do it and somehow fixes the issue.

Reference: https://pandoc.org/MANUAL.html#language-variables https://github.com/jgm/pandoc/blob/efa34a8de67409a5604207e016b0a49e525c2db6/data/templates/default.latex#L334

the-solipsist commented 3 years ago

Thanks, @thestr4ng3r! I can confirm that replacing \setmainlanguage{$lang$} with \setmainlanguage{$polyglossia-lang.name$} in template.tex, and changing lang: english to lang: en-GB in details.yml works great.

I think you should submit a pull request in case @mrzool wishes to close this issue.

mrzool commented 3 years ago

A PR would be much appreciated @the-solipsist! Sorry for not being more active here.