Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm wandering if there exists a package, that would take so-called Internet-Style Quoted plain text of an email, and format it accordingly for a PDF output. Internet-style quoting is discussed on the Wikipedia page Posting style; so let's say I take an example from there, and I have the following to be the content of email.eml file:

At 10.01am Wednesday, Danny wrote:
> At 9.40am Wednesday, Jim wrote:
>> I'm going to suspend the mail service for approx. thirty
>> minutes tonight, starting at 5pm, to install some updates
>> and important fixes.

> Whoa!  Hold on.  I have a job scheduled at 5:30 which mails out
> a report to key tech staff.  Could you push it back an hour?
> By the way, which systems will be updated? I had some network
> problems after last week's update.  Will I have to reboot?

No problems. 6pm it is then.

Basically, I will update our WWW server and firewall.
No, you won't have to reboot.

Then, I'd imagine one could prepare something like an email.tex, which I could use to obtain a formatted PDF:





I would be hoping that I'd at least have the control of choosing the color (grayscale) for the different levels of quoted replies (lines prefixed with '>')... But, if I can also control, say, fonts - or rendering lines instead of the '>' (like what Thunderbird does), that would be awesome! :)

Well, does anything similar to this exist?

share|improve this question
I can smell the sweet \tikzmark solution of @PeterGrill :-) –  percusse Mar 27 '12 at 6:07
Hi @percusse - wish I knew what that sweet solution is :) Cheers! –  sdaau Mar 27 '12 at 6:09
If the desired solution was to have vertical lines to delineate the separate nesting depth, than perhaps \tikzmark would be useful but that would require editing the email text. So if it was to be used just a few times that would work. But, if you want to simply incorporate an existing email from an external file and not have to edit it, then listings is probably the way to go. –  Peter Grill Mar 27 '12 at 14:52
Thanks for the comments, @PeterGrill - I indeed wanted to include an external file without further editing, so I concur about listings. However, many thanks for the \tikzmark links - those certainly point to a way of how a graphical solution (with vertical lines) would work. Cheers! –  sdaau Mar 28 '12 at 4:40
add comment

1 Answer

up vote 10 down vote accepted

This is only a partial solution, but it would be the way to go - using listings:

enter image description here

\usepackage{listings}% http://ctan.org/pkg/listings
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
Here is the message:

  morecomment=[l][\color{red!50}]{>>\ },
  morecomment=[l][\color{green!80}]{>\ },


Formatting of the respective reply-levels is done via morecomments, actually specifying that line of "code" to be a "comment". listings fails to pick up the empty line in the above example, but correctly interprets if you don't mind level-specific formatting using just


say. Note that using > elsewhere in the email might cause problems.

share|improve this answer
Many thanks for the answer, @Werner - that looks pretty good, so accepting it for now... Cheers! –  sdaau Mar 27 '12 at 8:08
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.