# What are the miminal required environments for a KOMA-Script scrlttr2?

I want to use the KOMA-Script letter2 class for creating client invoices. I've read the user guide (version 2017-08-08) and searched the web without finding the answer.

The only way I can get the draft to compile with pdflatex (within LyX) is by including the environments such as opening, closing, signature, and a couple of others. In the preamble I include the invoice2 package which has 'customer' and 'invoice no.' environments and I want to learn how to use the invoice2 package for invoicing and sending statements. So I want to find the fewest required environments to produce an invoice using the scrlttr2 class. Are there examples available?

• No way to answer your question without an example or a minimal working example. You can make LyX export LaTeX code. – Keks Dose Nov 25 '17 at 20:17
• Rather difficult to add a minimal example when I I don't know how few environments must be included. What I want are: logo, date, client name and address, project name and number, and invoice number. Then a table with rows for each activity being invoiced. – Rich Shepard Nov 26 '17 at 21:17

Here a link for examples available.

\documentclass{scrlttr2}

\usepackage[british]{babel}

\begin{document}

\begin{letter}{Dott. Yuko Ono\\24 Street Canvas\\Last Village\\
Some Town\\Noshire\\AB1 2YZ}
\opening{Dear Mrs~Canary}

This is an imaginary letter.

This is the second paragraph of the letter.

\closing{Yours sincerely}

\ps PS: this is a postscript.

\encl{Photocopy of something interesting\\
Photocopy of something rather dull}

\cc{Prof Important Person\\
Dr Bor Ing}
\end{letter}

\end{document}

• I have looked multiple times at the examples. They all have an opening, closing, and signature. I've not been able to compile a letter without these. That's why I'm asking what environments must be in a letter. – Rich Shepard Nov 26 '17 at 21:18

There are a lot of examples for letters with scrlttr2 in the KOMA-Script manual, starting with the most simple in section 4.7, "General Structure of Letter Documents":

\documentclass[version=last]{scrlttr2}
\usepackage[english]{babel}
\begin{document}
\begin{letter}{Joana Public\\
Hillside 1\\
12345 Public-City}
\opening{Dear chairman,}
\end{letter}
\end{document}


(\opening is needed to get the elements of the first letter page, like letter head, addressee and fold marks); until a more complex one in section 4.20, "Closing":

\documentclass[foldmarks=true,foldmarks=blmtP,
fromphone,fromemail,fromlogo,
subject=titled,
version=last]{scrlttr2}
\usepackage[english]{babel}
\usepackage{graphics}
\begin{document}
\setkomavar{fromname}{John Public}
\setkomavar{signature}{John Public\\
(former chairman)}
\renewcommand*{\raggedsignature}{\raggedright}
54321 Public-Village}
\setkomavar{fromphone}{0\,12\,34~56\,78}
\setkomavar{fromemail}{Peter@Public.invalid}
\setkomavar{fromlogo}{\includegraphics{musterlogo}}
\setkomavar{location}{\raggedright
Club nember no.~4711\\
since 11.09.2001\\
chairman 2003--2005}
\setkomavar{date}{29th February 2011}
\setkomavar{place}{Public-Village}
\setkomavar{subject}{Missing general meeting}
\begin{letter}{%
Joana Public\\
Hillside 1\\
12345 Public-City%
}
\opening{Dear chairman,}
the last general meeting was about one year ago.
I want to remind you, that the constitution of our
club advises you to make a general meeting every
six month. Because of this I expect the executive
board to detain such a meeting immediately.
\closing{Expecting an invitation}
\ps PS: I hope you accept this as an friendly
demand note.
\setkomavar*{enclseparator}{Enclosure}
\encl{Compendium of the constitution with the
general meeting paragraphs.}
\cc{executive board\\all members}
\end{letter}
\end{document}


For individual designs you can find additional examples in the KOMA-Script documentation project. There are not only German examples but also some in English like: Reproducing the official header of the Washington State University.

The German KOMA-Script book has additional, interesting examples for "modern letters" (appendix/Anhang D). One of it results in:

If you want to use, class scrlttr2 (or package scrletter) for invoices, you should start with a letter, add, e.g., \setkomavar{title}{Invoice} and think about the reference line fields you need, e.g., customer. We currently do not know, what you need.