1

I'm an MD and I have to write a lot of letters to collegues and I want to try to do this in LaTex to increase productivity. I wonder if it's possible to make a basic letter template without any names, DOB, etc. After that, define all the patients' information (in the preamble? somewhere else?) so LaTeX automatically generates the letter without fiddling too much with the code.

example letter

Automatically edit everything in italics to the patient's data.

5
  • Could you provide us with a sample of such a letter?
    – Werner
    Commented Aug 31, 2015 at 17:31
  • I don't have any right here but I googled an example: img.docstoccdn.com/thumb/orig/28126840.png Automatically edit everything in italics to the patient's data
    – g183484
    Commented Aug 31, 2015 at 17:37
  • tex.stackexchange.com/search?q=mail+merge Commented Aug 31, 2015 at 17:44
  • I added the image to the question for you …
    – Tobi
    Commented Aug 31, 2015 at 17:48
  • And welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Do us a favour and change your username to something more telling than "user1234".
    – Tobi
    Commented Aug 31, 2015 at 17:52

1 Answer 1

3

One option is to use scrlttr2 from the KOMA-Script bundle. Then you can define some variables with \newkomavar, set them with \setkomavar and use them in the letter (template) with \usekomavar. Here is a very basic example:

\documentclass{scrlttr2}

% predefined variables
\setkomavar{fromname}{Dr. House, MD}
\setkomavar{fromaddress}{%
   Sesamestreet 5532\\
   Elsewhere
}
\setkomavar{subject}{Next Examination}

% own vars
\newkomavar{nextdate}
\setkomavar{nextdate}{5th of September 2015}
\newkomavar{bodypart}
\setkomavar{bodypart}{left Arm}

\begin{document}
\begin{letter}{%
   Jon Doe\\
   Somestreet 1234\\
   Somewhere
}
   \opening{Dear Mr Doe,}

   your next examination will be on \usekomavar{nextdate}
   and we will check your \usekomavar{bodypart}.

   \closing{Regards}
\end{letter}
\end{document}

More can be found in the manual (scrguien.pdf, chapter 4).

Your own settings (address etc. and layout) can be set in a definition file that you can use with \input, an .lco file (see §4.21) or you write a wrapper class.

PS: I’m not familiar with non-german addresses so don’t mind if the example has nonsense addresses ;-)

3
  • Your welcome! The manual is quite comprehensive but explains everything you need I guess. If you com to a more specific problem don’t hesitate to ask (with positing a MWE) ;-)
    – Tobi
    Commented Aug 31, 2015 at 17:51
  • 1
    probably having lco-files might be a good idea for automation (I have no experience with this so I'm just guessing…)
    – cgnieder
    Commented Aug 31, 2015 at 18:21
  • @clemens: Indeed, good point. I didn’t had them in mind since I use the class not often. I added this to my answer.
    – Tobi
    Commented Aug 31, 2015 at 18:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .