0

I've found answers for including graphics in every other part of a letter, but I can't seem to get a letter to compile when including a graphic in the recipient's address. I like to do this for cover letters, including the company's logo above their address.

\begin{letter}{\includegraphics[width=0.15\linewidth]{logo.png}
        \\123 Recipient Street
        \\City, State }
  • 2
    Welcome to TeX.SX! In order for people to be able to help you, please provide a MWE of what exactly you're trying to do. – KersouMan Jul 31 at 10:13
  • handrawn sketch would be helpful – js bibra Jul 31 at 11:13
0

The issue is that the value of the first line of the letter environment argument is used internally for several things, including setting headers and writing the recipient address to the .aux file as a string. If the value is something complex such as an \includegraphics command then this extra processing does not succeed.

The solution that requires the least amount of changes to the code (which will however not work properly if you actually use things like headers and return addresses) is to provide a placeholder for the recipient name, and only locally define the name as the image when it is being used for printing the recipient information, which is in the \opening macro. The macro where the name is stored is called \toname so this needs to be modified.

MWE:

\documentclass{letter}
\usepackage{graphicx}
\signature{John Smith}
\address{21 Bridge Street \\ Smallville}
\begin{document}
% provide a placeholder here
\begin{letter}{img-placeholder\\
        123 Recipient Street\\
        City, State}
\begingroup
% locally (i.e., within a group) define \toname to be an image
\def\toname{\includegraphics[width=0.15\textwidth]{example-image}}
% use the image in the opening
\opening{Dear Sir or Madam,}
% close the group, so \toname will be reset to the previous value (which is 'img-placeholder')
\endgroup
This is a letter.

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

Result:

enter image description here

| improve this answer | |

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.