Giter Club home page Giter Club logo

pandoc-letter's Introduction

A simple letter template for Pandoc

Build Status Package-License

Authors: Aaron Wolen and Andrew Dunning

This template allows you to write letters in Markdown and convert them to nice looking PDFs using Pandoc and LaTeX. It accepts arguments used in the LaTeX letter class, including:

  • opening
  • closing
  • address
  • return-address
  • postscript
  • enclosures list
  • carbon-copy list

All of which can be specified in a YAML metadata block. Additional Pandoc/LaTex options can be configured directly in the metadata block. For example:

---
author: Aaron
opening: To whom it may concern,
closing: Sincerely,
address:
- 123 Street Rd
- Chicago, IL
return-address:
- My Home
- 456 Road St.
- New York, NY

# ADDITIONAL ARGUMENTS
links-as-notes: true
...

Note that each address component should start with a hyphen. The provided example letter can be compiled with the following command:

pandoc --template=template-letter.tex example/letter.md -o example/letter.pdf

You can see the PDF output here.

Features

The following can be set either as variables when executing pandoc or added to the YAML metadata.

address : Name and address of the recipient; takes a list for a multi-line address.

subject : Subject of the letter.

author : Writer of the letter; can take a list for a multi-line signature.

blockquote : Changes style of block quotations to match bootstrap (requires the mdframed package).

cc : Recipients to be carbon-copied; can take a list for multiple recipients.

closing : Text for the complementary close.

closing-indentation : Amount for closing signature block to be intended from left margin.

date : Custom date (current date will be automatically inserted if not specified).

encl : List of enclosures.

letterhead : Image file to be used as letterhead (requires the wallpaper package), applied only to the first page.

opening : Text for the salutation.

ps : Text to be added at the end of the letter as a postscript.

return-address : Address of the sender: takes a list to allow a multi-line address.

signature : Image file for a signature.

signature-before, signature-after : Allows adjustment of vertical space surrounding signature.

signature-width : Specify width of signature image file.

Running with Docker

This requires Docker to be installed.

After cloning the repository build the container. cd to the cloned directory and run

  docker build --tag=pandoc-letter .

This has to be executed only once per machine.

To create a letter run

    docker run --volume <path_to_folder_with_letter.md>:/data pandoc-letter --template=template-letter.tex letter.md -o letter.pdf

Make sure you insert the full folder path where letter.md resides.

Images, Attachments

To insert an image into the body of your letter:

![](lalune.jpg){ width=50% }

The curly brackets are optional. This inserts the image into the location of the command, above the signature.

The recommended way to attach images on a new page after the signature is to compile a separate pdf file by other means than pandoc-letter, and then attach the two pdf files with whatever utilities you are familiar with.

License

GPL-3 for pandoc-letter and the underlying Pandoc template.

pandoc-letter's People

Contributors

aaronwolen avatar adunning avatar clindbergh avatar fisx avatar jgrigera avatar redmeades avatar wzel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pandoc-letter's Issues

Question: attachments?

Hi, I would like to attach documents with something like this

![la lune](lalune.jpg "Voyage to the moon")

but i'm uncertain how to go about it, or if it is supported at all. if you help me figure it out i'd be happy to write a PR that adds a hint to the README.

big fan of pandoc-letter, thanks for writing and publishing it!

Using template-letter.tex without Texlive?

Thanks a lot for this repository.

I would like to use it without installing Texlive, as it takes up to 800 MB and I do not use LaTeX otherwise. Would it be possible to provide a link to "template-letter.tex" so I can use it without installing the whole Texlive, or is the full fledged Texlive required even for basic functions in the example letter? If yes, is there any lightweight LaTeX install I could use if I just need the underlying language but not the editor and extra packages?

Thank you.

Can citations/references be supported?

I find the need to include a reference and its citation in a letter. But I find that the letter template does not support sections. Is there any way to work around this?

Thanks.

PS. Thanks for an excellent template.๐Ÿ™‚

Recipient address(es) on the right

Hello Aron,

thanks for your template (it provides me a super fast way of writing letter together with few macros in VIM). I just wanted to ask you if it is possible to modify it in order to get the recipient address on the right an return on the left (italian ways of writing letter ..!) ...

Example does not work for commit 31e603e

First of all: Thank you a lot for providing this template!

I cloned this repository and discovered that the example does not work. Then I went back by one commit and it worked again. I guess that 31e603e somehow introduced a bug here. I ran the following commands:

pandoc-letter$ pandoc --template=template-letter.tex example/letter.md -o example/letter.pdf
Error producing PDF.
! Undefined control sequence.
<recently read> \signature 
                           
l.64 \signature

pandoc-letter$ git checkout b0fd7342b352ebb87aea17614ec014f68d48747f
M	example/letter.pdf
Note: switching to 'b0fd7342b352ebb87aea17614ec014f68d48747f'.
...
pandoc-letter$ pandoc --template=template-letter.tex example/letter.md -o example/letter.pdf

The for b0fd734 the command worked as expected and a pdf was produced.

Nix package

Hello,

I was looking for such a template and I make a Nix flake for it so anyone can use it easily.

Find the repository here: https://github.com/drupol/latex-letter

If you want to try it, just install Nix on your computer, enable the flake feature, create a .md file and do: nix run github:drupol/latex-letter -- letter.md
After that, a PDF will be generated in the same directory.

Hope it helps!

license

Hi, what's the license for this repo?

Davide

background and pure-latex letterhead

Hi

If you're interested you can check out our fork we've added three features:

  • A semi-transparent background
  • Header generated in latex
  • A watermark for writings such as "draft" or "confidential"

Soon we plan to integrate the document and letter template, allowing one to be used for everything depending on configuration.

There is also a Gulpfile, a good improvement from my build.sh script that never really worked well

Davide

Output does not look like sample

I'm sure I'm doing something wrong, but I can't figure out what it is. My test letter outputs like the below:

image

As you can see, it looks like the bog standard style - no fonts, etc. not like the sample pdf provided in the repository. I'm sure the template is getting picked up, because all the frontmatter YAML stuff is getting put in the right places - the structure of the letter looks right, but the style is off. Any ideas?

Thanks!

Make the text non-justified

Hi, is there any way to make the letter text not be right-justified? Or if there is not, could I request that as an option?

German-style dates ("1. Januar 2017") throw error in pdf generation

When trying to generate a letter with a date like "1. Januar 2017", when invoking
pandoc --template=template-letter.tex test.md -o test.pdf

it throws the following error:

! LaTeX Error: Something's wrong--perhaps a missing \item.

See the LaTeX manual or LaTeX Companion for explanation.
Type H for immediate help.
...

l.74 \opening{To whom it may concern,}

pandoc: Error producing PDF

It seems german-style dates (Which are written with a dot to donate the ordering, ie. "1. Januar 2017" meaning "first of january of the year 2017") are parsed as lists or something like that, resulting in compiled LaTeX like this:

\date{\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\setcounter{enumi}{5}
\tightlist
\item
  April 2017
\end{enumerate}}

instead of the correct

\date{6 April 2017}

Sadly, my LaTeX skills are nonexistant, so I wouldn't even know where to start fixing this.

Undefined control sequence: \signature

Even in a container running an image built with the provided Dockerfile, Pandoc (or better yet, pdflatex) hits the Undefined control sequence error on \signature.

I've tried adding graphicx to the list of packages installed by tlmgr, but it complains the package isn't present in the repository.

Logo in header

Hi,

This template is great, and very useful. It would be even greater with the possibility to include a logo in the header for corporate mail. Is it in the plans?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.