3

The \closing command in scrlttr2.cls is

\newcommand*{\closing}[1]{{%
    \setparsizes{\z@}{\z@}{\z@ plus 1fil}\par@updaterelative\nobreak\par%
    \nobreak\vskip\baselineskip%
    \stopbreaks\noindent%
    \setlength{\@tempdima}{0pt}%
    \expandafter\@tempdimaismaxwidthof\scr@signature@var\\\@nil
    \expandafter\@tempdimaismaxwidthof\strut\ignorespaces#1\\\@nil
    \setlength{\@tempdimb}{\hsize}%
    \addtolength{\@tempdimb}{-\useplength{sigindent}}%
    \ifdim\@tempdima>\@tempdimb\setlength{\@tempdima}{\@tempdimb}\fi%
    \hspace{\useplength{sigindent}}%
    \parbox{\@tempdima}{\raggedsignature\strut\ignorespaces%
      #1\strut\\[\useplength{sigbeforevskip}]
      \strut\usekomavar{signature}\strut}}\par
  \nobreak\vskip\baselineskip%
}

How can one lift the signature variable right next after the closing-phrase (in the same line), and add the \encl{}, \cc{} commands (from scrlttr2) right after?

The code above is somewhat complicated (for there are instructions unknown to me). Likewise, trying to follow an example for the lettr.cls, so as to renew the \closing command in How to type specifically on this part of the page?, isn't easy.

6
  • Please explain a little bit more, what you are trying to do. I mean, just leave the signature and closing empty and write whatever you wish to the bottom of your letter? Or what are you after? – Keks Dose Jan 12 '14 at 18:32
  • It would also be helpful if you could post a Minimum Working Example for people to play with. And what do you mean by adding those command right after? What exactly is the problem with that? – cfr Jan 12 '14 at 20:23
  • Why don't you just put the signature in the closing and set the signature variable to empty? That way, it will all be on one line, won't it? And the documentation doesn't mention a \signature command. What does this do and where is it defined? – cfr Jan 12 '14 at 20:46
  • @KeksDose Maybe I was wrong in isolating this "problem". The final goal is to put \closing along with \signature of course, and both the \cc & \encl in the footer of the scrlttr2 (as I use it to form an Invoice). I have partially achieved this by customising he asymTypB.lco file (by Markus Kohm). I plan to update my (directly related) question & answer: tex.stackexchange.com/q/151437/8272. Anyhow, leaving the koma variables closing & signature empty is not practical I think. I like the idea of an Invoice Template with the usual stuff already written, then fill in details. – Nikos Alexandris Jan 13 '14 at 16:31
  • @cfr Thank you for reminding the MWE. I just think, perhaps wrongly again, that it is not always required so as to keep the question as minimal as possible. Mainly my questions seeks a how-to for an output like "Sincerely your, <Signature>" (both in one line). I probably should not bother with the "right after..." at all in this question. – Nikos Alexandris Jan 13 '14 at 16:36
5

Let's start of with an minimal example - something that really helps the community, regardless of what you may think, really. The following is taken from the KOMA-script documentation (section 4.20. Closing, p 190):

\documentclass[foldmarks=true,foldmarks=blmtP,
  fromphone,fromemail,fromlogo,
  subject=titled,
  version=last]{scrlttr2}% http://ctan.org/pkg/koma-script
\usepackage[english]{babel}% http://ctan.org/pkg/babel
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\begin{document}
\setkomavar{fromname}{John Public}
\setkomavar{signature}{John Public\\
  (former chairman)}
\renewcommand*{\raggedsignature}{\raggedright}
\setkomavar{fromaddress}{Valley 2\\
  54321 Public-Village}
\setkomavar{fromphone}{0\,12\,34~56\,78}
\setkomavar{fromemail}{Peter@Public.invalid}
\setkomavar{fromlogo}{\includegraphics[height=5\baselineskip]{tiger}}
\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}

This is what the output looks like:

enter image description here

If we wish to modify the structure of the \closing, we should modify what is contained within the \parbox command. Let's do this using etoolbox in the form of a \patchcmd:

\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\closing}% <cmd>
  {\parbox}% <search>
  {\parbox{\linewidth}{\raggedsignature\strut\ignorespaces\let\\\relax%
      #1 \usekomavar{signature}}%
   \@gobbletwo}%< <replace>
  {}{}% <success><failure>
\makeatother

The above code replaces \parbox for \parbox{..}{...}\@gobbletwo. The replacement \parbox{..}{...} uses elements of the older \parbox, but doesn't insert a sigbeforevskip length that used to produce the vertical gap. Instead, \usekomavar{signature} is set with a space between the actual \closing{#1}. Also, \\ is \let to \relax (but might not be necessary) to avoid forced paragraph breaks. The latter \@gobbletwo eats the old \parbox's two arguments.

Here's an example document showing the output results (note that I've also moved a \ps below \encl and \cc, as requested):

enter image description here

\documentclass[foldmarks=true,foldmarks=blmtP,
  fromphone,fromemail,fromlogo,
  subject=titled,
  version=last]{scrlttr2}% http://ctan.org/pkg/koma-script
\usepackage[english]{babel}% http://ctan.org/pkg/babel
\usepackage{graphicx}% http://ctan.org/pkg/graphicx

\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\closing}% <cmd>
  {\parbox}% <search>
  {\parbox{\linewidth}{\raggedsignature\strut\ignorespaces\let\\\relax%
      #1 \usekomavar{signature}}%
   \@gobbletwo}%< <replace>
  {}{}% <success><failure>
\makeatother

\begin{document}
\setkomavar{fromname}{John Public}
\setkomavar{signature}{John Public\\
  (former chairman)}
\renewcommand*{\raggedsignature}{\raggedright}
\setkomavar{fromaddress}{Valley 2\\
  54321 Public-Village}
\setkomavar{fromphone}{0\,12\,34~56\,78}
\setkomavar{fromemail}{Peter@Public.invalid}
\setkomavar{fromlogo}{\includegraphics[height=5\baselineskip]{tiger}}
\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}
\setkomavar*{enclseparator}{Enclosure}
\encl{Compendium of the constitution with the
  general meeting paragraphs.}
\cc{executive board\\all members}
\ps PS: I hope you accept this as an friendly
  demand note.
\end{letter}
\end{document}

Of course, other adjustments can also be made.

0

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.