TeXhackse / LaTeX-ZUGFeRD

LaTeX packages to create ZUGFeRD/Faktur-X invoices
23 stars 4 forks source link

`\zugferd_startInvoiceSums:` produces text output #8

Open SaculRennorb opened 1 week ago

SaculRennorb commented 1 week ago

First of; thank you for creating basically the only package that can even create the attachments. I did however run into a few problems using it.

The only one I didn't manage to solve is this one:

using .\csname zugferd_startInvoiceSums:\endcsname. (within the ZUGFeRD environment) produces this random Omega and some white space (I added the dots to show the white space): grafik

I'm using the version currently available on CTAN (0.8 2024-09-11) and I haven't tried using the code on the master branch directly. I'm also not going to, I'm just reporting this before I just slap some \color{white} on to it and call it a day. Everything else works just as expected, and I don't have the patience right now to dive deeper into why this might happen.

TeXhackse commented 5 days ago

Hm… I tried to reconstruct and can not. Can I get more details and a full log? Would love to get a \listfiles included.

TeXhackse commented 5 days ago

Oh, you are running on pdflatex without a T1 font encoding? Explains why I did not see it before, as it's a newline char which is expanded otherwhise to a space which will be stripped of in a tabular. I will remove it, but …

Writing files from pdflatex might have some side effects with unicode-chars. So maybe you would prefer using lualatex.

freswa commented 5 days ago

I can repro this with xelatex, can work on a reproduces if required :)

TeXhackse commented 5 days ago

In that case you probably want to check your font setup/encoding. This should not happen otherwhise. But I found the linebreak causing this as you can see in the commit above. Just am thinking about what's the best way to construct unit tests for this issue. But have an idea.

SaculRennorb commented 5 days ago

Here is a minimal repo case (could be more minimal but it should be good enough). No other packages, no special encoding. just basic latex.

\DocumentMetadata{pdfstandard=a-3b, lang=de}
\documentclass[]{report}
\usepackage[]{zugferd}

\newcounter{position}%
\newcommand\lstitm[3]{%
  \stepcounter{position}%
  \csname keys_set:ne\endcsname{zugferd}{unit=hour}%
  \csname zugferd_write_Item:nnnnnn\endcsname{\theposition}{}{#1}{#3}{#2}{50}%
}
\newcommand\gettaxtotal{%
  \csname zugferd_write_TaxEntry:nnnn\endcsname{S}{19}{50}{50}%
}

\newcommand\baketotal{%
  \csname zugferd_write_Summation:nnnnnnnn\endcsname{50}{0}{0}{50}{50}{50}{0}{50}%
}

\SetZUGFeRDData{
  id       = 0001,
  currency = EUR,
  tax/category = S,
  tax/rate     = 19,
  %  date     =, %YYYYMMDD
  due-date = 20241231, %YYYYMMDD 
  payment-means/type = 42, %Payment to bank account
  payment-means/iban = IBANxxxxxxxxxxxxxxxx,
  payment-means/account-holder = Company,
  payment-means/bic  = BICXXXXXXX,
  seller/name     = Company,
  seller/email    = Company@localhost.com,
  seller/vatid    = xxxxxxxxxx,
  seller/contact-email = Company@localhost.com,
  seller/address  = Street 11,
  seller/postcode = xxxxx,
  seller/city     = City,  
  seller/country  = DE,
  buyer/name     = {ToCompany},
  buyer/vatid    = yyyyyyyyy,
  buyer/address  = {To Street 11},
  buyer/postcode = {yyyyyy},
  buyer/city     = {ToCity},
  buyer/country  = DE,
}

\begin{document}
    \begin{ZUGFeRD}
        %----------------------
        \lstitm{Consulting}{1.25}{20}
        \lstitm{Implementation}{4}{20}
        \lstitm{Instalation}{2.25}{20}
        \lstitm{Service}{7}{20}
        %----------------------
        {%
          \color{white}%       !!!!!!! Comment out this line to show the output.
          \csname zugferd_startInvoiceSums:\endcsname%
        }
        \gettaxtotal
        \baketotal
        \csname zugferd_stopInvoiceSums:\endcsname%
    \end{ZUGFeRD}
\end{document}