0

I would like to write a KOMA letter with a logo towards the top right corner of the first page. (See the attached image.) enter image description here

I'm using LuaLaTeX in TeXLive on Win10.

So far, my efforts to setkomavar{firsthead} and setkomavar{fromlogo} do not produce an image.

Using documentclass{scrartcl} and scrletter, I was able to set the logo using firsthead, but my attempts to move it up failed.

A MWE:

\documentclass[
 a4paper,
 11pt,
 backaddress=off,
 pagenumber=no,
 fromalign=locationright,
 enlargefirstpage=false,
 foldmarks=off]{scrlttr2}
\usepackage[margin=2cm]{geometry}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{mwe}

%\makeatletter
%  \@setplength{firstheadvpos}{-20mm} % doesn't seem to move logo up
%  \@addtoplength[-]{firstheadvpos}{40mm} % also seems to do nothing
%\makeatother

\setkomavar{fromaddress}{Santa Claus\\ North Pole H0H 0H0\\ Canada}
% \setkomavar{firsthead}{\hfill\includegraphics[height=3cm]{example-image}}
\setkomavar{fromlogo}{\includegraphics[width=3cm]{example-image}}
  
\begin{document}
\begin{letter}{Colin Rowat \\ South Pole}
\opening{Dear Colin,}
\lipsum
\closing{Ho Ho Ho,}
\end{letter}
\end{document}
1
  • 1
    you need fromlogo=on, to see the picture. Jul 3, 2020 at 12:55

1 Answer 1

1

You could add fromlogo=true to the options and then

\setkomavar{fromlogo}{\smash{\raisebox{1cm}{\includegraphics[width=3cm]{example-image}}}}

to move the logo up:

enter image description here

\documentclass[
 a4paper,
 11pt,
 backaddress=off,
 pagenumber=no,
 fromalign=locationright,
 fromlogo=true,% <- added
 enlargefirstpage=false,
 foldmarks=off
]{scrlttr2}
\usepackage[margin=2cm]{geometry}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{mwe}

\setkomavar{fromaddress}{Santa Claus\\ North Pole H0H 0H0\\ Canada}
\setkomavar{fromlogo}{\smash{\raisebox{1cm}{\includegraphics[width=3cm]{example-image}}}}
  
\begin{document}
\begin{letter}{Colin Rowat \\ South Pole}
\opening{Dear Colin,}
\lipsum
\closing{Ho Ho Ho,}
\end{letter}
\end{document}

Or you can remove the fromalign option and add

\setkomavar{fromaddress}{Santa Claus\\ North Pole H0H 0H0\\ Canada}
\setkomavar{fromlogo}{\includegraphics[width=3cm]{example-image}}
\setkomavar{location}{\raggedleft\usekomavar{fromaddress}}
\setkomavar{firsthead}{\hfill\usekomavar{fromlogo}}

enter image description here

\documentclass[
 a4paper,
 11pt,
 backaddress=off,
 pagenumber=no,
 %fromalign=locationright,% <- removed
 enlargefirstpage=false,
 foldmarks=off
]{scrlttr2}
\usepackage[margin=2cm]{geometry}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{mwe}

\setkomavar{fromaddress}{Santa Claus\\ North Pole H0H 0H0\\ Canada}
\setkomavar{fromlogo}{\includegraphics[width=3cm]{example-image}}
\setkomavar{location}{\raggedleft\usekomavar{fromaddress}}
\setkomavar{firsthead}{\hfill\usekomavar{fromlogo}}

\begin{document}
\begin{letter}{Colin Rowat \\ South Pole}
\opening{Dear Colin,}
\lipsum
\closing{Ho Ho Ho,}
\end{letter}
\end{document}
2
  • Beautiful: thank you. In practice, is there any difference between your two solutions? Jul 3, 2020 at 13:56
  • In the first solution the logo is raised up from the location and \smash hiddes the height of the raised logo. In the second solution the logo is positioned in page header.
    – esdd
    Jul 7, 2020 at 18:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .