I have been trying to include contents of an e-mail in a latex document, similar to how there are packages to include source code, for example (using the listings package, for example). These are plain text emails, so there are no formatting problems (attachments need not be included, either). If the sender and the date/time of the email (which could be passed on as parameters) would be shown above the contents as well, that would be ideal, but anything that allows a schematic rendering of an e-mail would be perfect.

Does anyone have an idea?

I have been trying to work on this using minipages, listings, and the like, but before I delve deeper into building my own package I was wondering whether anyone had an idea.


EDIT: Thanks for the comment! The verbatim package (and listing as I've tried working with it so far) obviously used monospaced font, and the linebreaks (when [breaklines] is used) gave me an indent in the following line. This is obviously great for source code.

What I am hoping for is some type of representation that makes it immediately clear that what follows is an e-mail. So the email's contents should be italic (in order to differentiate it from the main body of text), for example, probably surrounded by a box, and the sender and recipient e-mail addresses, as well as the time and date should be visible, preferably at the top. Does that make sense?

(I understand LaTeX really wasn't made to implement huge design-endeavours, but I was simply wondering whether there's an easy way to do this, or something like this. Otherwise, I can always return to the drawing board and come up with my own package.)

  • 4
    What exactly do you mean by "schematic rendering of an e-mail"? As you say plain text would be fine, what features do you miss when you include the text with e.g the listings package?
    – siracusa
    Jun 5 '19 at 3:47
  • 1
    There is this thread. Is that what you have in mind?
    – user121799
    Jun 5 '19 at 4:42
  • 3
    Use tcolorbox. It gives you boxes with separate box titles, with your content, it will resemble the little email reading window you know from your computer GUI.
    – Johannes_B
    Jun 5 '19 at 5:14
  • 1
    You might also consider basing your new environment on the quotation environment. Jun 5 '19 at 18:23

Thanks to the comments below, I've gone with the following which is just perfect for my needs (perhaps someone else finds this useful, too):




\begin{tcolorbox}[title=\texttt{From: MacRance <some.email@address.com>\\ To: stackexchange.com Users <some.other.email@address.com>\\ Date: Wed 05/06/2019 15:00\\ Subject: Thank You}]
Dear fellow TeX-users,\\

Thanks so much for your help. This works great.\\

Best wishes,\\


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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