Page Layoutscrlttr2 - logo placement

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
erwann
Posts: 75
Joined: Thu Aug 25, 2016 2:24 am

scrlttr2 - logo placement

Post by erwann »

How to position the logo (crocodile) in the top right corner? Posts about similar topics suggest a combination of \adjustbox and \minpage, just not sure which exactly. Please help.

Code: Select all

\documentclass[
  french,
  paper=A4,
  version=last,
  NF,
  12pt
]{scrlttr2}
\KOMAoptions{
%  refline=narrow,%%wide,% nodate,%wide, %narrow, %dateright, %dateleft
  refline=nodate,
  foldmarks=false,
  backaddress=false, %%window envel
  fromalign=left,
  fromemail=true,
  fromlogo=true,
  subject=beforeopening, %%centered, %left %left-justified, %underlined
  %subject=titled,%% Concernant:
  fromrule=false
}

\RequirePackage[french]{babel}
\RequirePackage[T1]{fontenc}
\RequirePackage{graphicx}
\RequirePackage{adjustbox}
\RequirePackage{hyperref}


\makeatletter
\@setplength{sigbeforevskip}{4\baselineskip}
\makeatother

\begin{document}

\setkomavar{fromname}{Le Crocodile}
\setkomavar{fromaddress}{Ligne 1 \\ Ligne 2\\ Ligne 3\\ Ligne 4 }
\setkomavar{fromemail}{xyz@ici.fr}
\setkomavar{place}{L'\'Etang}
\setkomavar{date}{\today}
\setkomavar{fromlogo}{
%\adjincludegraphics[vspace=0cm 10cm 0cm 0cm, width=2cm]{lacoste.png}
	\adjustbox{vspace=0cm 10cm 0cm 0cm}{
%		\begin{minipage}
			\includegraphics[width=2cm]{lacoste.png}
%		\end{minipage}
	}
}		
\setkomavar{subject}{Sujet}

\begin{letter}{Destinataire}

\opening{Madame, Monsieur,}

Bla bla bla
 
\closing{Veuillez agr\'eer, Madame, Monsieur, mes sinc\`eres salutations,}

\end{letter}

\end{document}
Attachments
Screen Shot 2017-03-24 at 5.28.16 PM.png
Screen Shot 2017-03-24 at 5.28.16 PM.png (51.66 KiB) Viewed 8041 times
x_86 / Linux Mint 18.3 / texlive 2015.20160320-1ubuntu0.1 / TeXworks 0.5r1361 (Debian)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

scrlttr2 - logo placement

Post by Stefan Kottwitz »

Hi Erwann!

Instead of tweaking the embedded positioning, you could freely choose a position on the page that you want.

There are several possibilities, I usually tend to TikZ since it provides a nice interface.

This code puts the image at the top right:

Code: Select all

\usepackage{tikz}
\setkomavar{fromlogo}{\tikz[overlay,remember picture]
  \node [anchor = north east, inner sep = 0pt]
        at (current page.north east)
        {\includegraphics[width=2cm]{lacoste.png}};}
Compile two times, as it works with the .aux file for relative positioning on the page.

Stefan
LaTeX.org admin
erwann
Posts: 75
Joined: Thu Aug 25, 2016 2:24 am

scrlttr2 - logo placement

Post by erwann »

Thanks, it does put the logo in the top right corner. Now, how can I shift it by x cm towards the left?
x_86 / Linux Mint 18.3 / texlive 2015.20160320-1ubuntu0.1 / TeXworks 0.5r1361 (Debian)
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

scrlttr2 - logo placement

Post by Stefan Kottwitz »

Add an xshift option, such as:

Code: Select all

\setkomavar{fromlogo}{\tikz[overlay,remember picture]
  \node [anchor = north east, inner sep = 0pt, xshift=-1cm]
        at (current page.north east)
        {\includegraphics[width=2cm]{lacoste.png}};}
Stefan
LaTeX.org admin
erwann
Posts: 75
Joined: Thu Aug 25, 2016 2:24 am

scrlttr2 - logo placement

Post by erwann »

Thanks.
x_86 / Linux Mint 18.3 / texlive 2015.20160320-1ubuntu0.1 / TeXworks 0.5r1361 (Debian)
Post Reply