Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor changes #17

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
26 changes: 26 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Contributors
Commits in brackets. Made with git-summary from [git extras](https://github.com/tj/git-extras).

```bash
# Use this to update
$ git summary

# Just to check
$ git shortlog -sn >> CONTRIBUTORS.md
```

project : letter-boilerplate
repo age : 2 years, 5 months
active : 31 days
commits : 81
files : 10
authors :
47 zool 58.0%
15 mrzool 18.5%
10 HaoZeke 12.3%
4 Mattia Tezzele 4.9%
2 Fabrice Laporte 2.5%
1 MT 1.2%
1 Rafael Epplee 1.2%
1 Sascha Hagedorn 1.2%

26 changes: 26 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
The MIT License (MIT)
=====================

Copyright © `<year>` `<copyright holders>`

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

File renamed without changes.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Why settle for MS Word when you can get the job done using your text editor?

## Dependencies

1. LaTeX with the following extra packages: `fontspec` `geometry` `ragged2e` `enumitem` `xunicode` `xltxtra` `hyperref` `polyglossia` `footmisc` (also, `datetime2` plus its language modules if you want to use a custom date, see below in the settings section)
1. LaTeX with the following extra packages: `fontspec` `geometry` `ragged2e` `enumitem` `xunicode` `xltxtra` `hyperref` `polyglossia` `footmisc` `graphicx` (also, `datetime2` plus its language modules if you want to use a custom date, and `mathtools` if you need equations; see below in the settings section)
2. [Pandoc](http://pandoc.org/), the universal document converter.

To install LaTeX on Mac OS X, I recommend getting the smaller version BasicTeX from [here](https://tug.org/mactex/morepackages.html) 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.
Expand All @@ -21,7 +21,7 @@ To install pandoc on Mac OS X, run `brew install pandoc`. To install it on Linux
2. Write your letter in markdown below.
3. Run `make` to compile the PDF.

If a file named `signature.pdf` is present in the directory, the boilerplate will automatically print it after the letter's body as a final touch. Follow [this method](http://tex.stackexchange.com/a/32940/82423) to import your own signature.
If the signature option points to a valid file (including the extension) in the directory, the boilerplate will automatically print it after the letter's body as a final touch. Follow [this method](http://tex.stackexchange.com/a/32940/82423) to import your own signature.

**Note**: this template needs to be compiled with XeTeX.

Expand All @@ -40,11 +40,14 @@ Although I didn't test it, you can probably use this on Windows, too. Both [Pand
- **`lang`**: Sets the main language through the `polyglossia` package. This is important for proper hyphenation and date format.
- **`geometry`**: A string that sets the margins through `geometry`. Read [this](https://www.sharelatex.com/learn/Page_size_and_margins) to learn how this package works.
- **`letterhead`**: include custom letterhead in the PDF (see below).
- **`letterheadAlt`**: include alternative custom letterhead in the PDF (see below).
- **`math`**: include math equations and formatting. Read [this](https://ctan.org/pkg/mathtools?lang=en) for the docs and [this](https://www.sharelatex.com/learn/Mathematical_expressions) for a gentle introduction to TeX math.
- **`signature`**: include a signature (see below).
- **`customdate`**: Allows you to specify a custom date in the format YYYY-MM-DD in case you need to pre/postdate your letter. *Caveat*: Requires `datetime2` along with its language module (ex: if `lang` is set to `german` do `tlmgr install datetime2 datetime2-german`)

## Custom letterhead

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.
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 the file name (include .pdf) to activate the `wallpaper` package in the template. `wallpaper` will look for the named file 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.

## Recommended readings

Expand Down
11 changes: 8 additions & 3 deletions letter.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
# subject: My life as a soldier
author: F. Nietzsche
author:
- F. Nietzsche
- RA16 989 587
city: Naumburg
from:
- Artillerieregiment, 8. Batt.
Expand All @@ -15,10 +17,13 @@ to:
mainfont: Hoefler Text
altfont: Helvetica Neue
monofont: Courier
lang: english
lang: en-US
fontsize: 10pt
geometry: a4paper, left=35mm, right=35mm, top=50mm, bottom=25mm
# letterhead: true
signature: signature.pdf
# math: true
# letterhead: letterhead.pdf
# letterheadAlt: letterhead-front.pdf
# customdate: YYYY-MM-DD
---

Expand Down
37 changes: 27 additions & 10 deletions template.tex
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@
\usepackage{enumitem}
\setlist{nolistsep}

% Include a standard letterhead
$if(letterhead)$
\usepackage{wallpaper}
% \ThisULCornerWallPaper{1}{letterhead-front.pdf} % Uncomment to include a different letterhead on the first page
\ULCornerWallPaper{1}{letterhead.pdf}
\ULCornerWallPaper{1}{$letterhead$}
$endif$

% Includes a different letterhead on the first page
$if(letterheadAlt)$
\usepackage{wallpaper}
\ThisULCornerWallPaper{1}{$letterheadAlt$}
$endif$

% LANGUAGE
Expand All @@ -32,6 +38,16 @@
\setmainlanguage{$lang$}
$endif$

% IMAGES
%--------------------------------
\usepackage{graphicx}

% MATH
%--------------------------------
$if(math)$
\usepackage{mathtools}
$endif$

% TYPOGRAPHY
%--------------------------------
\usepackage{xunicode}
Expand Down Expand Up @@ -117,14 +133,15 @@
$body$

\begin{FlushRight}
\IfFileExists{signature.pdf}
{
\includegraphics[height=5.5\baselineskip]{signature.pdf} \par
}
{
\vspace{5.5\baselineskip}
}
$author$
$if(signature)$
\includegraphics[height=5.5\baselineskip]{$signature$} \par
$else$
\vspace{5.5\baselineskip}
$endif$

$for(author)$
$author$\\
$endfor$
\end{FlushRight}

\end{document}