-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemplate.tex
178 lines (149 loc) · 5.41 KB
/
template.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
[%- USE Latex -%]
[%- USE Number.Format -%]
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[10pt, letterpaper]{article}
% LAYOUT
%--------------------------------
\usepackage{geometry}
\geometry{letterpaper, left=1.25in, right=1.25in, top=1.5in, bottom=0.7in}
\usepackage{lastpage}
\usepackage{fancyhdr}
% clear the heading ruler
\renewcommand{\headrulewidth}{0pt}
% clear all fields
\fancyhf{}
\pagestyle{fancy}
\cfoot{Page \thepage\ of \pageref{LastPage}}
% Left align
\usepackage[document]{ragged2e}
% To include the letterhead
%\usepackage{wallpaper}
%\ULCornerWallPaper{1}{letterhead.pdf}
% TYPOGRAPHY
%--------------------------------
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{tabularx}
% Needed to use icons from font-awesome
% (https://github.com/posquit0/latex-fontawesome)
\usepackage{fontawesome}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
% converts LaTeX specials (quotes, dashes etc.) to Unicode
%\defaultfontfeatures{Mapping=tex-text}
\defaultfontfeatures{
Mapping = tex-text,
Path = /app/fonts/ }
\setmainfont[ BoldFont = Roboto-Bold, ItalicFont = Roboto-Italic ]{Roboto-Regular}
\setsansfont[ BoldFont = Roboto-Bold, ItalicFont = Roboto-Italic ]{Roboto-Regular}
\usepackage[table]{xcolor}
\definecolor{lightgray}{HTML}{777777}
\colorlet{lighttext}{lightgray}
\newcommand*{\datetime}[1]{\footnotesize\vspace{0.35em}\color{lighttext} #1}
\newcommand*{\taskdesc}[1]{\small\color{lighttext} #1\newline}
\newcommand*{\taskproj}[1]{\textbf{#1}\newline}
% Defines writer's email (optional)
% Usage: \email{<email adress>}
\newcommand*{\email}[1]{\href{mailto:#1}{#1}}
% phone number
\newcommand*{\mobile}[1]{\faMobile\space#1}
% Set paragraph break
\setlength{\parskip}{1em}
\usepackage[xetex, bookmarks, colorlinks, breaklinks]{hyperref}
% TABLE CUSTOMIZATION
%--------------------------------
\usepackage{longtable}
\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
%--------------------------------
\usepackage{polyglossia}
\setmainlanguage{english}
% PDF SETUP
%--------------------------------
\hypersetup
{
pdfauthor={[% personal.name | latex_encode %]},
pdfsubject=Invoice Nr. [% invoice_num %],
pdftitle=Invoice Nr. [% invoice_num %],
linkcolor=black,
citecolor=black,
filecolor=black,
urlcolor=black
}
% DOCUMENT
%--------------------------------
\begin{document}
% person providing the invoice
\hfil{\Huge\bf [% personal.name | latex_encode %]}\hfil
\bigskip
\break
\hrule
\begin{minipage}[t]{0.5\textwidth}
[% FOREACH address_line IN personal.address %]
[% address_line | latex_encode ~%][% UNLESS loop.last %] \\[% END ~%]
[%~ END %]
\end{minipage}%
\begin{minipage}[t]{0.5\textwidth}
\hfill \mobile{[% personal.phone | latex_encode %]} \\
\hfill \email{[% personal.email | latex_encode %]}
\end{minipage}
\section*{Invoice}
\begin{tabularx}{\linewidth}{llX}
\hdashline[1pt/1pt]
\textbf{Invoice Number} & \textbf{[% invoice_num %]} & \textbf{[% client_name | latex_encode %]} \\
\textbf{Invoice Date} & [% invoice_date.strftime('%B %d, %Y') %] & [% client_country | latex_encode %] \\
\textbf{Balance Due} & [% amount_due | latex_encode %] & [% client_email %] \\
\hdashline[1pt/1pt]
\end{tabularx}
%\footnotesize
\newcounter{pos}
\setcounter{pos}{0}
\rowcolors{2}{gray!10}{white}
\begin{longtable}[t]{L{.25in}p{4.25in}R{.75in}}
\noalign{\vskip 2mm}\textbf{\#} & \textbf{Description} & \textbf{Hours} \\ \hline
[%- FOREACH item IN line_items -%]
% the invoice line number
\refstepcounter{pos}\thepos &
[%- IF item.project -%]
\taskproj{[% item.project | latex_encode %]}
[%- END -%]
[%- IF item.description -%]
\taskdesc{[% item.description | latex_encode %]}
[%- END -%]
\datetime{
[% item.start.strftime('%B %d, %Y %H:%M') %] - [% item.end.strftime('%H:%M') %]
[%- IF item.tasks.size > 1 -%]
([% item.tasks.size %] time entries totaling [% item.hms %])
[%- ELSE -%]
([% item.hms %])
[%- END -%]
}
& [% item.hours %] \\ \hdashline[1pt/1pt]
[%- END -%]
% other items available under total are:
% total.hours - float (seconds / 3600)
% total.minutes - int - total minutes worked (seconds / 60)
% total.seconds - int - total seconds worked
% \rowcolor{white}\multicolumn{2}{r}{\bf Total Minutes:} & {\bf [% total.minutes | format_number %]} \\
\rowcolor{white}\multicolumn{2}{r}{\bf Total Hours:} & {\bf [% total.hours %]} \\
\rowcolor{white}\multicolumn{2}{r}{\bf Hourly Rate:} & {\bf [% hourly_rate | latex_encode %]} \\
\rowcolor{white}\multicolumn{2}{r}{\bf Balance Due:} & {\bf [% amount_due | latex_encode %]} \\
\end{longtable}
% Example notes section
%{\bf Notes}
%\begin{itemize}
% \item Off on July 4 -- US Holiday
%\end{itemize}
\end{document}