Tx · LaTeX & TikZ

How to Include a Signature Image in scrlttr2

Published By the 9to5Science editorial team

At a glance

  1. 1. Load graphicx

    Add the graphicx package so your letter can insert an image file.

  2. 2. Set the signature

    Put the image and your typed name in scrlttr2's signature variable.

  3. 3. Use closing

    Call closing with your complimentary close; KOMA-Script prints the signature variable beneath it.

  4. 4. Adjust and compile

    Set the image width, check the spacing, and compile with the image file beside your source.

To add a handwritten signature to a scrlttr2 letter, insert the image in the letter’s signature variable. The \closing command then prints that variable beneath the complimentary close. This keeps the image in the normal signature position instead of requiring manual vertical spacing in the letter body.

Minimal example

Save your signature as signature.png in the same directory as the .tex file. This example uses a framed placeholder if that image is not present, so it will still compile before you add the file.

\documentclass{scrlttr2}
\usepackage{graphicx}

\setkomavar{fromname}{Jane Doe}
\setkomavar{fromaddress}{10 Example Street\\Example City}
\setkomavar{signature}{%
  \IfFileExists{signature.png}
    {\includegraphics[width=3.5cm]{signature.png}}
    {\fbox{\parbox[c][1.2cm][c]{3.5cm}{\centering Signature image}}}\\
  Jane Doe
}

\begin{document}
\begin{letter}{Alex Smith\\20 Sample Road\\Sample Town}
\opening{Dear Alex,}

Thank you for your letter. I am writing to confirm the details we discussed.

\closing{Yours sincerely,}
\end{letter}
\end{document}

The required package is graphicx, which provides \includegraphics. The width=3.5cm option scales the image to a practical signature width while preserving its aspect ratio. Replace signature.png with the filename and extension of your own image. The \IfFileExists fallback is optional; you can remove it and use \includegraphics[width=3.5cm]{signature.png} directly once the file is available.

The line break in the signature variable places the typed name beneath the image. If you want only the handwritten signature, remove \\ Jane Doe and leave just the image command. You can also include other text or formatting in the variable.

Why this works

In KOMA-Script letters, \closing{...} supplies the complimentary close, while the signature variable supplies the content printed in the signature area below it. Set that variable with \setkomavar{signature}{...}. You generally should not insert the image into the letter body or try to position it with fixed vertical spaces; those approaches can break when the letter’s text or layout changes.

The signature image’s dimensions affect the space it occupies. If it appears too large, reduce the width; if it looks stretched, check that the original image has a suitable aspect ratio. A transparent PNG or a cropped scan usually gives a cleaner result than a photograph of a page.

Adjusting the space and position

The example puts the name on the next line immediately after the image. To add a little vertical space, change the line break to \\[1ex], for example:

\setkomavar{signature}{%
  \includegraphics[width=3.5cm]{signature.png}\\[1ex]
  Jane Doe
}

You can also change the closing indent or signature position using KOMA-Script’s letter layout settings if the whole signature block needs to move. That is separate from sizing the image: first make sure the image itself fits, then adjust the class’s layout if the block is in the wrong place.

Common mistakes

  • Forgetting graphicx: Without \usepackage{graphicx}, \includegraphics is undefined.
  • Using the wrong filename or path: LaTeX must be able to find the image. Keep it beside the .tex file or provide a relative path such as images/signature.png.
  • Putting the image in \closing: Keep the closing text in \closing{...} and put the image in the signature variable so KOMA-Script handles the signature area.
  • Using an unsupported image format: With common PDF-based LaTeX engines, PNG, JPEG, and PDF are typical supported formats. For a PNG signature, compile with an engine such as pdfLaTeX, LuaLaTeX, or XeLaTeX.
  • Expecting the image to set the layout automatically: A very tall or wide image can affect the signature block’s appearance. Crop it or set an appropriate width before changing page-layout settings.

References

  1. KOMA-Script: a bundle of versatile classes and packages for LaTeX
  2. The graphicx package documentation

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.