12

Hi there: I have a letter template using scrlttr2 and I am trying to insert a signature image. I was using the code posted here texblog and it sort of works. It throws an undefined sequence error, but, if you force the compilation through to the end, it actually produces a document that looks like what it is supposed to. What can I do to improve this? MWE is below. Thank you.

\documentclass[fontsize=12pt, UScommercial9,paper=letter]{scrlttr2}
\usepackage[space]{grffile} %This is necessary because the fromlogo is on a     drive with spaces in its path name
\KOMAoptions{fromlogo=on}
\usepackage{blindtext}
\usepackage{graphicx}
\setkomavar{fromlogo}{\includegraphics[width=3cm]{example-image-golden}} %In my code, this is a link to my company's logo

\renewcommand{\raggedsignature}{\raggedright} % make the signature ragged right
\setkomavar{subject}{Test}

\begin{document}
\begin{letter}{Address\\
City\\
Province
}

\opening{To Whom It May Concern}  

\blindtext

\closing{Yours truly,\\
\fromsig{\includegraphics[scale=0.5]{example-image-golden}}\\ %In my code this is a link to my signature file
\fromname{My name}
} %eg. Regards

\end{letter}
\end{document}
  • Why did you delete your answer? – cfr Jan 5 '16 at 23:56
  • I made a mistake and corrected it below. – spindoctor Jan 6 '16 at 0:18
12

The answer is that this section of the code:

\closing{Yours truly,\\
\fromsig{\includegraphics[scale=0.5]{example-image-golden}}\\ %In my code this is a link to my signature file
\fromname{My name}
} %eg. Regards

actually implies the letter class, not the KOMA-script. I was mixing classes.
This works:

%insert the following in the preamble
\setkomavar{signature}{\includegraphics[width=3cm]{example-image-golden}\\Your name} 
%write the signature as follows 
\closing{Yours truly}
  • Now: I realize that I can't find a way to put the logo at the center of the page, rather than on the right. Can anyone suggest anything? – spindoctor Jan 6 '16 at 0:24
  • 1
    You could use the KOMA variable firsthead to layout your own header on the first page: \setkomavar{firsthead}{\centering\usekomavar{fromlogo}}. Then the line \KOMAoptions{fromlogo=on} has no effect and could be removed. If that does not solve the problem in your comment please ask a new question. – esdd Jan 6 '16 at 9:47

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.