在 scrlttr2 中包含签名图像

在 scrlttr2 中包含签名图像

你好:我有一个使用 scrlttr2 的信函模板,我想插入一个签名图像。我使用的是此处发布的代码文本博客并且它有点起作用了。它会抛出一个未定义序列错误,但是,如果你强制编译到最后,它实际上会生成一个看起来像它应该生成的文档。我该怎么做才能改善这种情况?MWE 如下。谢谢。

\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}

答案1

答案就是这一段代码:

\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

实际上暗示的是字母类别,而不是 KOMA 脚本。我把类别混在一起了。
这有效:

%insert the following in the preamble
\setkomavar{signature}{\includegraphics[width=3cm]{example-image-golden}\\\usekomavar{fromname}} 
%write the signature as follows 
\closing{Yours truly}

相关内容