The invoice content lives in details.yml and it's structured like so:
invoice-nr: 2015-11-04
author: Max Mustermann
city: Musterstadt
from:
- Musterstraße 37
- 12345 Musterstadt
to:
- Erika Mustermann
- Musterallee 1
- 12345 Musterstadt
- Germany
VAT: 20
service:
- description: The first service provided
price: 450.00
- description: And another one, with a list of details
price: 245.00
details:
- Some more detailed explanation
- of the service provided
- Looking good
- description: The last service provided
price: 245.00When running make, Pandoc starts iterating on the YAML file, populates template.tex with your data, and pipes the result to XeTeX. XeTeX deals with the typesetting and compiles a PDF ready to be printed/faxed/emailed and archived (see the output).
The math gets handled internally by LaTeX through the spreadtab package, Excel-style (mad props to clemens on TeX SE for helping me out with this). You just need to provide a VAT rate and your prices, the boilerplate takes care of the rest.
Unless you plan to edit the template, no particular LaTeX knowledge is required to use this boilerplate. If you need your invoice in a language other than English, finding the relevant strings in template.tex and translating them to your language should be easy enough.
- LaTeX with the following extra packages:
fontspecgeometryragged2espreadtabfpxstringarydshlnhhlinetitlesecenumitemxunicodexltxtrahyperrefpolyglossiawallpaperfootmisc - Pandoc, the universal document converter.
To install LaTeX on Mac OS X, I recommend getting the smaller version BasicTeX from here and installing the additional packages with tlmgr afterwards. Same goes for Linux: install texlive-base with your package manager and add the needed additional packages later.
To install pandoc on Mac OS X, run brew install pandoc. To install it on Linux, refer to the official docs.
- Open
details.ymlwith your text editor and fill it with your details, the invoice recipient's details, services/prices, and the desired settings. - Run
maketo compile the PDF.
Note: this template needs to be compiled with XeTeX.
VAT: Your VAT rate.currency: Your currency code (USD, EUR...)commasep: Set totrueto use a comma as decimal separator. This is for display purposes only—remember to always use a dot to set the prices in your YAML file.lang: Sets the main language through thepolyglossiapackage. This is important for proper hyphenation and date format.seriffont: Used for the heading and the sender address. Hoefler Text is the default, but every font installed on your system should work out of the box (thanks, XeTeX!)sansfont: Used to render the recipient address, the table and the closing note. Defaults to Helvetica Neue.fontsize: Possible values here are 10pt, 11pt and 12pt.geometry: A string that sets the margins throughgeometry. Read this to learn how this package works.closingnote: This gets printed after the table as a closing note. Use it to provide your bank details and a thank you message.letterhead: include custom letterhead in the PDF (see below).
If you have already designed your own letterhead and want to use it with this template, including it should be easy enough. Set the letterhead option to true to activate the wallpaper package in the template. wallpaper will look for a file named letterhead.pdf in the project root folder and print it on the PDF before compiling the document. Change the fonts to match the ones in your letterhead, adjust the margins with geometry and you should be all set.
- Typesetting Automation, my article about this project with in-depth instructions and some suggestions for an ideal workflow.
- Grids of Numbers Recommendations on Butterick's Practical Typography
- Multichannel Text Processing by iA
- Why Microsoft Word must Die by Charlie Stross
- Word Processors: Stupid and Inefficient by Allin Cottrell
- Proprietary Binary Data Formats: Just Say No! by Sam Steingold
- The Beauty of LaTeX by Dario Taraborelli
- Refer to pandoc's documentation to learn more about how templates work.
- If you're not familiar with the YAML syntax, here's a good overview.
- If you want to edit the template but LaTeX scares you, these docs put together by ShareLaTeX cover most of the basics and are surprisingly kind to the beginner.
- Odds are your question already has an answer on TeX Stack Exchange. Also, pretty friendly crowd in there.
- Need to fax that invoice? Check out Phaxio and learn how to send your faxes from the command line with a simple API call.
- cv-boilerplate — Easing the process of building and maintaining a CV using LaTeX
- letter-boilerplate — Typeset your important letters without leaving your text editor