matkant_invoice/pandoc/template.tex

156 lines
3.9 KiB
TeX
Raw Normal View History

2017-01-30 13:06:38 +00:00
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[$fontsize$, a4paper]{article}
% LAYOUT
%--------------------------------
\usepackage{geometry}
\geometry{$geometry$}
% No page numbers
\pagenumbering{gobble}
% Left align
\usepackage[document]{ragged2e}
$if(letterhead)$
% To include the letterhead
\usepackage{wallpaper}
\ULCornerWallPaper{1}{letterhead.pdf}
$endif$
2017-01-31 15:13:26 +00:00
$if(draft)$
\usepackage{draftwatermark}
\SetWatermarkText{$drafttext$}
\SetWatermarkScale{1}
$endif$
2017-01-30 13:06:38 +00:00
% TYPOGRAPHY
%--------------------------------
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
% converts LaTeX specials (quotes, dashes etc.) to Unicode
\defaultfontfeatures{Mapping=tex-text}
\setromanfont [Ligatures={Common}, Numbers={OldStyle}]{$seriffont$}
\setsansfont[Scale=0.9]{$sansfont$}
% Set paragraph break
\setlength{\parskip}{1em}
% Custom ampersand
\newcommand{\amper}{{\fontspec[Scale=.95]{$seriffont$}\selectfont\itshape\&}}
$if(seriffont)$
\setmainfont[SmallCapsFeatures={LetterSpace=5,Letters=SmallCaps}]{$seriffont$}
$endif$
$if(sansfont)$
\setsansfont{$sansfont$}
$endif$
% Command required by how Pandoc handles the list conversion
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
% TABLE CUSTOMIZATION
%--------------------------------
\usepackage{spreadtab}
\usepackage[compact]{titlesec} % For customizing title sections
\titlespacing*{\section}{0pt}{3pt}{-7pt} % Remove margin bottom from the title
\usepackage{arydshln} % For the dotted line on the table
\renewcommand{\arraystretch}{1.5} % Apply vertical padding to table cells
\usepackage{hhline} % For single-cell borders
\usepackage{enumitem} % For customizing lists
\setlist{nolistsep} % No whitespace around list items
\setlist[itemize]{leftmargin=0.5cm} % Reduce list left indent
\setlength{\tabcolsep}{9pt} % Larger gutter between columns
% LANGUAGE
%--------------------------------
$if(lang)$
\usepackage{polyglossia}
\setmainlanguage{$lang$}
$endif$
% PDF SETUP
%--------------------------------
\usepackage[xetex, bookmarks, colorlinks, breaklinks]{hyperref}
\hypersetup
{
pdfauthor=$author$,
pdfsubject=Faktura nr. $invoice-nr$,
pdftitle=Faktura nr. $invoice-nr$,
linkcolor=blue,
citecolor=blue,
filecolor=black,
urlcolor=blue
}
% To display custom date
% \usepackage[nodayofweek]{datetime}
% \newdate{date}{01}{12}{1867}
% \date{\displaydate{date}}
% Use this instead of \today: % \displaydate{date}
% DOCUMENT
%--------------------------------
\begin{document}
\small
\textsc{\textbf{$author$}}
$for(from)$
\textbullet{} \textsc{$from$}
$endfor$
\vspace{1em}
\normalsize \sffamily
$for(to)$
$to$\\
$endfor$
2017-01-30 14:23:50 +00:00
%\vspace{6em}
2017-01-30 13:06:38 +00:00
\begin{flushright}
\small
$city$, \today
\end{flushright}
\vspace{1em}
\section*{\textsc{Invoice} \textsc{\#$invoice-nr$}}
\footnotesize
\newcounter{pos}
\setcounter{pos}{0}
\STautoround*{2} % Get spreadtab to always display the decimal part
$if(commasep)$\STsetdecimalsep{,}$endif$ % Use comma as decimal separator
2017-01-30 14:23:50 +00:00
\begin{spreadtab}{{tabular}[t t t t]{lp{7.2cm}cr}}
2017-01-30 13:06:38 +00:00
\hdashline[1pt/1pt]
2017-01-30 14:23:50 +00:00
@ \noalign{\vskip 2mm} \textbf{\#} & @ \textbf{Produkt} & @ \textbf{Antal} & @ \textbf{Priser i $currency$} \\ \hline
2017-01-30 13:06:38 +00:00
$for(service)$ @ \noalign{\vskip 2mm} \refstepcounter{pos} \thepos
& @ $service.description$
$if(service.details)$\newline \begin{itemize}
$for(service.details)$\scriptsize \item $service.details$
$endfor$ \end{itemize}
2017-01-30 14:23:50 +00:00
$endif$ & $service.amount$ & $service.price$\\$endfor$ \noalign{\vskip 2mm} \hline
@ & @ \multicolumn{2}{r}{Subtotal:} & :={sum(d1:[0,-1])} \\ \hhline{~~~-}
@ & @ \multicolumn{2}{r}{Rabat fra kantinekort (-10\%):} & -(100-90)/100*[0,-1] \\ \hhline{~~~-}
@ & @ \multicolumn{2}{r}{\textbf{Total:}} & \textbf{:={[0,-2]+[0,-1]}} \\ \hhline{~~~-}
2017-01-30 13:06:38 +00:00
\end{spreadtab}
\vspace{15mm}
\sffamily
\small
$closingnote$
\medskip
$author$
\end{document}