[Tex/LaTex] Package sclrttr2: How to use the fromlogo-variable? How to get a footer on the 2nd page

graphicsheader-footerhorizontal alignmentkoma-scriptpositioning

I am using scrlttr2 for a formal letter template. I am facing 3 problems:


(1) Logo in the header of the 1st page

I want a header logo on the first page in the top right corner above the header line, as shown on the following image:
This is how it should look like.

This is the way it looks now (the wrong way):
This is how it looks now.


(2) Logo in the footer of ALL pages

  • I want the same logo in the footer as well and on the first and on all other pages. It has to look like that:
    This is how it should look like.

Now it looks like that (the wrong way):
enter image description here


(3) Logo in the header on all following pages

On all following pages, I want the logo to be still there, but without the contact details. It has to look like that:
enter image description here

Now it's just empty.


That's the code I used now:

\documentclass%%
  [fontsize=11pt,
   parskip=half,%%
   fromalign=right,%%
   fromphone=on,%%
   fromfax=on,%%
   fromrule=aftername,%%
   fromemail=on,%%  
   fromlogo=true,%%
   foldmarks=false,%%
   firstfoot=true,%%
   subject=titled,%%
   pagenumber=botright,%%
]{scrlttr2}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{url}
\usepackage{graphicx}
\usepackage{eurosym}
\usepackage{lipsum}
\usepackage{selinput}
\usepackage{newcent}
\usepackage{lipsum}
\SelectInputMappings{
  adieresis={ä},
  germandbls={ß},
  Euro={€},
}

\setkomafont{fromname}{\scshape \LARGE}
\setkomafont{backaddress}{\mdseries}

\makeatletter
\@setplength{firstheadvpos}{7mm}
\@setplength{firstfootvpos}{265mm}%%
\makeatother

\begin{document}

\setkomavar{fromaddress}{
    my surname name\\
    my streetname 21\\
    my example city}
\setkomavar{fromphone}{+99\,(9)999)\,999\,999\,99}
\setkomavar{fromphone}{+99\,(9)999)\,999\,999\,99}
\setkomavar{fromfax}{+99\,(9)999)\,999\,999\,99}
\setkomavar{fromemail}{name@email-address.com}
\setkomavar{backaddressseparator}{ - }
\setkomavar{place}{city}
\setkomavar{signature}{example signature}
\setkomavar{frombank}{IBAN: 9999\,9999\,9999\,9999\,9999\,99\\
  BIC: 12341234ABDC\\
  example example example\vspace{0.1cm}\\
  example example example example\\
  example example example, example example example}
\setkomavar{fromlogo}{\includegraphics[scale=.2]{/home/philipp/Dropbox/briefvorlage_example_TechExchange/generic_logo.pdf}}

\setkomavar{firstfoot}{\footnotesize%
  \rule[5pt]{472pt}{.3pt}\\
  \begin{tabular}[t]{l@{}}% 
    \usekomavar{fromname}\\
    \usekomavar{fromaddress}\\
  \end{tabular}%
  \hfill
  \begin{tabular}[t]{l@{}}%
    \usekomavar{fromphone}\\
    \usekomavar{fromfax}\\
    \usekomavar{fromemail}\\
  \end{tabular}%
  \ifkomavarempty{frombank}{}{%
    \hfill
    \begin{tabular}[t]{l@{}}%
      \usekomavar{frombank}
    \end{tabular}%
    }%
}%

\renewcaptionname{ngerman}{\enclname}{Anlagen}

\begin{letter}{Mr.\\surname name\\office\\street name\\postal code and city}\vspace{0.3cm}

\setkomavar{subject}{subject: example example example example example example example example example example example example example example example example example example example example example example example example}

\opening{Dear Mr. xxxxx xxxxxxxxxx,}

\lipsum[1-4]

\closing{Regards,}
\setkomavar*{enclseparator}{Enclosure(s):}

\encl{example enclosure}
\end{letter}
\end{document}

I was researching for several hours but without any success. These were the most useful posts I checked, unfortunately without any success: Logo in Briefkopf platzieren (place logo in header), Logo in a LaTeX header, Koma-Script letter class, Header and Footer does not show on second page (scrlttr2).

Any help is highly appreciated.

Best Answer

To solve the three problems you can do:

  1. Logo in the header of the 1st page: to get the logo above the line, followed by the adress etc. the imho best way is to define an own firsthead like this:

    \setkomavar{firsthead}{\raggedleft % <==================================
      \usekomavar{fromlogo}\\[+1cm]
      \rule{\textwidth}{0.5pt}\\
      \usekomavar{fromaddress}\\
      \usekomavar{fromphone}\\
      \usekomavar{fromfax}\\
      \usekomavar{fromemail}\\% <===========================================
    }
    

    To activate this definition call the option firsthead=true, as class option.

  2. Logo in the footer of ALL pages: First you have to add the logo to the firstfoot like this:

    \setkomavar{firstfoot}{\footnotesize%
      \rule[5pt]{472pt}{.3pt}\\
      \begin{tabular}[t]{l@{}}% 
        \includegraphics[scale=.3]{generic-logo-company}\\[-5mm] % <==================
        \usekomavar{fromname}\\
        \usekomavar{fromaddress}\\
      \end{tabular}%
      \hfill
      \begin{tabular}[t]{l@{}}%
        \usekomavar{fromphone}\\
        \usekomavar{fromfax}\\
        \usekomavar{fromemail}\\
      \end{tabular}%
      \ifkomavarempty{frombank}{}{%
        \hfill
        \begin{tabular}[t]{l@{}}%
          \usekomavar{frombank}
        \end{tabular}%
        }%
    }%
    

    Then you need to define the nextfoot like this:

    % nextfoot nexthead
    \setkomavar{nextfoot}{\hspace{-1.1cm}\parbox[b]{472pt}{\usekomavar{firstfoot}}}% <=======================
    
  3. Logo in the header on all following pages: To get the line and the logo to the header you call the class option headsepline=true, and add the following code

    \pagestyle{myheadings}
    \markboth{}{\protect\includegraphics[scale=.3]{generic-logo-company}}
    

Then you get the following complete MWE:

\documentclass[%
  fontsize=11pt,
  parskip=half,%%
% fromalign=right,% right,locationright %% <============================
  firsthead=true, % <===================================================
  fromphone=on,%%
  fromfax=on,%%
  fromrule=aftername,%%
  fromemail=on,%%  
  fromlogo=true,%%
  foldmarks=false,%%
  firstfoot=true,%%
  subject=titled,%%
  pagenumber=botright,%%
  headsepline=true, % <=================================================
  DIN
]{scrlttr2}

\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{url}
\usepackage{graphicx}
\usepackage{eurosym}
\usepackage{newcent}
\usepackage{lipsum}
\usepackage{selinput}
\SelectInputMappings{
  adieresis={ä},
  germandbls={ß},
  Euro={€},
}

\setkomafont{fromname}{\scshape \LARGE}
\setkomafont{backaddress}{\mdseries}

\makeatletter
\@setplength{firstheadvpos}{7mm}
\@setplength{firstfootvpos}{265mm}%%
\makeatother
\setkomavar{firsthead}{\raggedleft % <==================================
  \usekomavar{fromlogo}\\[+1cm]
  \rule{\textwidth}{0.5pt}\\
  \usekomavar{fromaddress}\\
  \usekomavar{fromphone}\\
  \usekomavar{fromfax}\\
  \usekomavar{fromemail}\\% <===========================================
}


\begin{document}

\setkomavar{fromaddress}{
    my surname name\\
    my streetname 21\\
    my example city}
\setkomavar{fromphone}{+99\,(9)999)\,999\,999\,99}
\setkomavar{fromphone}{+99\,(9)999)\,999\,999\,99}
\setkomavar{fromfax}{+99\,(9)999)\,999\,999\,99}
\setkomavar{fromemail}{name@email-address.com}
\setkomavar{backaddressseparator}{ - }
\setkomavar{place}{city}
\setkomavar{signature}{example signature}
\setkomavar{frombank}{IBAN: 9999\,9999\,9999\,9999\,9999\,99\\
  BIC: 12341234ABDC\\
  example example example\vspace{0.1cm}\\
  example example example example\\
  example example example, example example example}
\setkomavar{fromlogo}{\includegraphics[scale=.5]{generic-logo-company}\vspace{-1.3cm}}

\pagestyle{myheadings}
\markboth{}{\protect\includegraphics[scale=.3]{generic-logo-company}}

\setkomavar{firstfoot}{\footnotesize%
  \rule[5pt]{472pt}{.3pt}\\
  \begin{tabular}[t]{l@{}}% 
    \includegraphics[scale=.3]{generic-logo-company}\\[-5mm] % <==================
    \usekomavar{fromname}\\
    \usekomavar{fromaddress}\\
  \end{tabular}%
  \hfill
  \begin{tabular}[t]{l@{}}%
    \usekomavar{fromphone}\\
    \usekomavar{fromfax}\\
    \usekomavar{fromemail}\\
  \end{tabular}%
  \ifkomavarempty{frombank}{}{%
    \hfill
    \begin{tabular}[t]{l@{}}%
      \usekomavar{frombank}
    \end{tabular}%
    }%
}%

% nextfoot nexthead
\setkomavar{nextfoot}{\hspace{-1.1cm}\parbox[b]{472pt}{\usekomavar{firstfoot}}}% <=======================

\renewcaptionname{ngerman}{\enclname}{Anlagen}

\begin{letter}{Mr.\\surname name\\office\\street name\\postal code and city}\vspace{0.3cm}

\setkomavar{subject}{subject: example example example example example 
  example example example example example example example example 
  example example example example example example example example 
  example example example}

\opening{Dear Mr. xxxxx xxxxxxxxxx,}

\lipsum[1-8]

\closing{Regards,}
\setkomavar*{enclseparator}{Enclosure(s)}

\encl{example enclosure}
\end{letter}
\end{document}

with the following resulting pages:

first page

and page 2:

page 2

BTW: in german letters the leading Betrifft: is not longer used ...