Menu

HowTo_EnclChange

How to set the enclosures to a letter without a hanging indent

By default, the enclosures for a letter set with \encl are printed with a hanging indent relative to the “encl:” top mark. In some cases, however, it is desired that the enclosures are left-aligned underneath without indent instead. For example, the 2000 version of DIN5008 requires this.

The definition of \encl in scrlttr2 and scrletter is quite simple:

\newcommand*{\encl}[1]{\par%
  \ifdim\parskip=\z@%
    \vskip\baselineskip%
  \fi\noindent%
  \begingroup
    \parbox[t]{\textwidth}{%
      \Ifkomavarempty*{enclseparator}{}{%
        \@hangfrom{%
          \strut\usekomavar*{enclseparator}\usekomavar{enclseparator}}%
        }%
      \ignorespaces #1\strut}%
    \setlength{\parfillskip}{\z@ \@plus 1fil}\par
  \endgroup
}

The hanging indent is achieved here by using \@hangfrom. It is sufficient to redefine this instruction locally to generate a separate line instead of the indent. Again, we create a separate lco file for this:

% File `enclDIN.lco'
% Copyright (c) Markus Kohm, 2025
%
% This file may be distributed under the conditions of the
% LaTeX Project Public License in the version 1.3c or later.
%
% → https://sourceforge.net/p/koma-script/wiki-de/HowTo_EnclChange or
%   https://sourceforge.net/p/koma-script/wiki-en/HowTo_EnclChange
%
\ProvidesFile{enclDIN.lco}[2025-05-30 v1.0 unsupported Letter Configuration Option]
\newcommand{\enclDIN}[1]{%
  \begingroup
    \renewcommand*{\@hangfrom}[1]{##1\\}%
    \encl{#1}%
  \endgroup
}
\endinput

and load it in an example letter:

\documentclass{scrlttr2}

\usepackage[english]{babel}
\usepackage{blindtext}

\LoadLetterOptions{DIN5008A,enclDIN}
\setkomavar{fromname}{Markus Kohm}
\setkomavar{fromaddress}{Somewhere\\Here}
\renewcaptionname{english}{\enclname}{Encl.}
\begin{document}
\begin{letter}{Peter Mustermann\\Musterhausen}
  \opening{Dear Mr.\,Mustermann,}

  \blindtext

  \closing{Best Regards}
  \enclDIN{\KOMAScript{} Flyer,\\\LaTeX{} Introduction}
\end{letter}
\end{document}

In the example, \enclname for the language english was also changed using \renewcaptionname, because babel sets “encl” here, but I prefer a capitalized “Encl.” with an abbreviation period.

Of course, other definitions are also possible. For example, you could define a \enclitemize:

% This file may be distributed under the conditions of the
% LaTeX Project Public License in the version 1.3c or later.
%
% → https://sourceforge.net/p/koma-script/wiki-de/HowTo_EnclChange or
%   https://sourceforge.net/p/koma-script/wiki-en/HowTo_EnclChange
%
\ProvidesFile{enclitemize.lco}[2025-05-30 v1.0 unsupported Letter Configuration Option]
\newcommand*{\enclitemize}[1]{\par%
  \ifdim\parskip=\z@%
    \vskip\baselineskip%
  \fi\noindent%
  \begingroup
    \parbox[t]{\textwidth}{%
      \Ifkomavarempty*{enclseparator}{}{%
        \strut\usekomavar*{enclseparator}\usekomavar{enclseparator}%
      }%
      \def\\{\item}
      \AddToHookNext{cmd/@trivlist/before}{\topsep=0pt\parskip=0pt\parsep=0pt\itemsep=0pt\leftmargin=\dimeval{\labelwidth-\labelsep}}
      \begin{itemize}
        \item #1
      \end{itemize}
    }%
    \setlength{\parfillskip}{\z@ \@plus 1fil}\par
  \endgroup
}
\endinput

The result? Try it out by using \LoadLetterOption{DIN5008A,enclitemize} in the previous example letter and replacing \enclDIN with \enclitemize.


Related

Wiki (English): HowTo_Letter

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.