0.0.1 • Published 7 years ago

generator-latex-mail v0.0.1

Weekly downloads
5
License
Apache-2.0
Repository
github
Last release
7 years ago

generator-latex-mail

Yeoman LaTex Apache-2.0

A Yeoman template for scaffolding LaTeX administrative mails (in french format)

Features

  • Scaffolds a workspace where all latex resources lay in
  • Manages institute files which hold the identity of the senders
  • Generates nice default LaTex letters using the letter.cls LaTeX class, with following features:
    • support generation for Registered Letters (Lettres recommandées)
    • automatically set the letter date to the current date
    • support the link to an institute (previously created)

icon-screenshot letter-example.pdf

Why ?

what ! latex for writing letters ?

Yes ! This is what I personally use; mainly because:

  • LaTex is free, portable, flexible, sexy and produces very high quality documents.
  • I'm a coder and I just can't imagine using a WYSIWYG editor for writing something.

Installation

Prerequisites

So you want to play with it. I assume the following is already installed:

Project

Install generator-latex-mail using npm:

npm install -g generator-latex-mail

Alternately you can install the module directly from sources. You will need git for that.

git clone https://github.com/ccamel/generator-latex-mail.git
cd generator-latex-mail
npm link

Getting started

Create the workspace

Before anything else, you need to create a workspace. For that, you just have to invoke the latex-mail generator with yeoman and let you guide.

yo latex-mail

You will be asked to answer a few questions.

? What is the name of the workspace you want to create ? mails

As a result, you will get the following directory structure.

[workspace]                     # folder created by template
   ├── assets                   # contains all resources used by LaTex
   │   ├── fonts                # contains alternative fonts
   │   └── institutes           # contains the institutes
   │       └── default.ins
   ├── letters                  # contains all the letters
   │   └── letter.tex
   ├── outputs                  # contains all the pdf generated from the letters
   │   └── letter.pdf
   ├── temp                     # folder containing temporary files
   ├── gulp.js                  # the gulp file used to process tex files
   └─  package.json             # npm dependencies used by gulp

Create an institute

An institute is a LaTex file containing the information about the sender of a letter, like the name, the address, the phone number.

The creation of an institute is performed with the institute sub-generator.

yo latex-mail:institute

You will be asked to answer a few questions.

? What is the name of the institute (a file that describes the sender) default
? Full name John Doe
? Address 1 10 rue de la Pomme
? Address 2 
? City Paris
? Zipcode 75010
? Phone 06 01 02 03 04
? Email john.doe@yopmail.com
   create assets/institutes/default.ins

As a result, you will get the new institute file in the assets/institutes folder. You can of course freely modify it to adapt it to your needs.

Create a new letter

Creating a new letter is fairly simple, thanks to the letter sub-generator.

yo latex-mail:letter

You will be asked to answer a few questions.

? Name of the letter (without extension) letter
? What institute do you want yo use ? default
? Subject of the letter Réclamation
? Does the letter a Registered Letter or not (If 'yes', a special mention is added to the subject of the letter). Yes

As a result, you will get the new letter file in the letters folder. Modify it with the editor of your choice.

Make PDF

I use XeLaTex which is a TeX typesetting engine with support of Unicode and modern font technologies.

The process is driven by Gulp which is a streaming build system. The pipeline generation is as such:

  letters/*.tex -> [XelaTex] -> outputs/*.pdf

The process is idempotent: only letters that have been modified since last generation are built again.

To launch the process, just invoke the Gulp default task:

gulp

Samples

Sample PDF

Technologies

Yeoman-logo Gulp-logo LaTex-logo

Useful links

License

Apache-2.0 © Christophe Camel