I'm trying to use Pandoc for the semi-automatic generation of billing statements from YAML text inputs:
- For doing sum calculations I use the
spreadtab
package. - For getting automatic page breaks if the statement is long, the
longtable
package is wrapped insidespreadtab
.
Most elementary things work now as needed, but I want to polish the appearance of long numbers by inserting a thousand separator. However, I'm now lost with this last issue: inserting a "thousands separator" into the display of long numbers:
Here is a minimally working example LaTeX code which Pandoc generated from my own custom LaTeX template:
%\listfiles \documentclass[12pt]{article} \usepackage[]{geometry} \geometry{a4paper, paperwidth=595pt, paperheight=842pt, left=25.0mm, right=18mm, top=45.5mm, bottom=32mm} \usepackage[boldmath, np, oldcolumntypes, sepfour, warning, autolanguage, addplus,]{numprint} \usepackage[table]{xcolor} \usepackage{polyglossia} \setmainlanguage{german} \usepackage[document]{ragged2e} \usepackage{fontspec} \usepackage{xunicode} %-------------------------------- % I'm really using WeidemannStd-Medium %-------------------------------- %\setmainfont[SmallCapsFeatures={LetterSpace=5,Letters=SmallCaps}]{WeidemannStd-Medium} % \setsansfont{WeidemannStd-Medium} %-------------------------------- %-------------------------------- % However, for the MWE I'm switching to Vollkorn, because not everybody has Weidemann fonts... %-------------------------------- \setmainfont[Numbers={Lining,Monospaced}]{Vollkorn-Regular} %-------------------------------- \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} %-------------------------------- % TABLE CUSTOMIZATION %-------------------------------- \usepackage{enumitem} % Anpassen von Listen \setlist{nolistsep} % Kein whitespace zwischen Listen-Items \setlist[itemize]{leftmargin=0.6cm} % Reduziere linken Einzug bei Listen \usepackage{spreadtab} \setlength{\tabcolsep}{6pt} % Größeren gutter zwischen Spalten %-------------------------------- % To be decided! %-------------------------------- \usepackage{longtable} %\usepackage{supertabular} %\usepackage{tabularx} %\usepackage{booktabs} %\usepackage{ltablex} %\usepackage{tabu} %-------------------------------- \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex \TeXXeTstate=1 \newcommand{\RL}[1]{\beginR #1\endR} \newcommand{\LR}[1]{\beginL #1\endL} \newenvironment{RTL}{\beginR}{\endR} \newenvironment{LTR}{\beginL}{\endL} \fi \begin{document} \makeatletter \newcommand\myFootnotesize{\@setfontsize\tinyv{9pt}{11.5}} \makeatother \newcounter{pos} \setcounter{pos}{0} \STautoround*{2} \STsetdecimalsep{,} \npfourdigitsep \npstylegerman \npthousandsep{\.} \rowcolors{1}{gray!30}{gray!20} %-------------------------------- % HIER WIRD'S INTERESSANT! %-------------------------------- \begin{spreadtab} {{longtable}[t t t]{rp{120.0mm}r}} @ \textbf{Pos.} & @ \textbf{Beschreibung} & @ \textbf{Preise in EUR} \\ @ \refstepcounter{pos}\thepos & @ Die erste erbrachte Leistungs-Position & 14450 \\ @ \refstepcounter{pos}\thepos & @ Weitere Position, mit einer Liste von Einzelheiten \newline \begin{itemize} \myFootnotesize \item Nähere Erläuterungen zur erbrachten\ldots{} \myFootnotesize \item \ldots{}Leistung, wie evtl. erforderlich \myFootnotesize \item Sieht gut aus \end{itemize} & -734 \\ @ & @ \multicolumn{1}{r}{Summe, netto:} & :={sum(c1:[0,-1])} \\ @ & @ \multicolumn{1}{r}{MWSt. 19\%:} & 19/100*[0,-1] \\ @ & @ \multicolumn{1}{r}{\textbf{Gesamt:} } & \textbf{:={[0,-1]+[0,-2]}}\\ \end{spreadtab} \end{document}
I'm using xelatex
to compile the LaTeX code to PDF.
As you can see, the numprint
packages is loaded in line 5 with the sepfour
option, so I can possibly get the thousands separator to work. I played with the available options there, but I did not find any which would get it to work.
I would assume that the \npthousandsep{\.}
command (line 73 of the MWE) should do what I want, but it doesn't.
So I must clearly be missing something obvious...
My main question for now is the first one below. However, I'm interested in getting answers for the second and third ones too:
- How can I get a "thousands separator" (either a dot, or a narrow space) inserted into all long numbers?
- Is there a way to automatically append the Euro sign to all displayed numbers in column 3?
- I could not get the code to work with other table packages (other than
longtable
), as they are listed in lines 44-49:- Which one of the other table packages can also automatically insert line breaks if required?
- What do I need to change in the table code to use that other package?
Update: I can hardly believe that no-one tried to answer my question(s) more than 12 months after submitting it. Maybe this update draws new attention to it?