0

I work in law, and very often for dossiers/pleadings/filings, have to compile a large amount of emails into a pdf to be printed for a file. (You may question the wisdom of this practice, but I don't make the system) I'm also the relatively rare lawyer who likes to use TeX to typeset my submissions.

Given that printing emails directly from various sources results in inconsistent, ugly, and difficult layouts that don't fit well into a consistent, nice appendix to pleadnigs, say, is there a programmatic way to process the HTML file of an e-mail into a TeX template to consistently output the position of senders, date, subject line, etc? My ideal is to have something like a traditional file of correspondence, but for e-mails.

  • 1
    This breaks down to two separate questions: (1) going from the HTML file to the TeX file, (2) going from the TeX file to the pdf. (1) is best handled by a more powerful programming language than TeX, and so is off topic for this site, but would probably be welcome on SO. (2) is definitely on topic. Could you create a sample TeX file that should become the pdf? And some description of what the pdf should look like? – Teepeemm Jun 11 '21 at 00:38
  • regex expressions may help with search and position tasks. – Cicada Jun 11 '21 at 03:56
  • 2
    Another way is: where does the html come from? If it is a download/save (i.e., a manual step), can the email be saved as pdf instead? Then a lot of them can be (auto) included with an includegraphics or includepdf command to create the bundle annex. – Cicada Jun 11 '21 at 04:01
  • If you are able to export your e-mail messages as actual e-mail files (usually .eml or .msg), you would in theory be able to parse it manually using corresponding libraries for more advanced programming languages to have greater flexibility on the exported data. But this is out of scope for this site. – epR8GaYuh Jun 11 '21 at 05:58
  • For many e-mail clients and services (e.g., Outlook, Thunderbird, Gmail etc) there are built-in functions and/or plugins that allow to save a selection of e-mails to a database, for example CSV or Excel. This will extract fields such as sender and subject. Then you can use packages such as datatool to enter the data in your LaTeX document. I'm not sure this will work very well (especially for complex HTML e-mails and/or for long exchanges where the previous messages are copied in each new message) but you could try. – Marijn Jun 12 '21 at 15:56

0 Answers0