1

I have a problem with scrlttr2 and Lualatex when I use a logo and the english manual of Koma-script don't help.

I want to have it next to the sender's address, partly in the margin, and with the address wrapped on the right on it. I use wrapfig for it, but I'm unable to get the address and the logo vertically entered: the logo is always a little higher and the result seems messy.

By making this MWE, another problem occurred with it: the last line of the address is hyphenating for an unknown reason. You can see the result there [on PDF archive][1].

\documentclass{scrlttr2}
\LoadLetterOption{NF}


\KOMAoptions{fromlogo=true,backaddress=false,foldmarks=false}

\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\usepackage{wrapfig}
\usepackage{kantlipsum}
\usepackage[final]{microtype}

\setkomavar{signature}{Bibi}
\setkomavar{fromname}{Bibi}
\setkomavar{fromaddress}{
Abbey Road\newline
Moscow\newline
Mother Russia}

\setkomavar{fromlogo}{\begin{wrapfigure}
%[5] %
{i}
[6mm]
{0.115\textheight}
\includegraphics[width=0.1\textheight]{logo}
% for information, I took the logo there :
% http://upload.wikimedia.org/wikipedia/en/thumb/2/2a/CSLS_Logo.pdf/page1-600px-CSLS_Logo.pdf.jpg
\end{wrapfigure}}

\firsthead{
  \begin{minipage}[t]{10cm}
  \vspace{0pt} 
    %\setlength\intextsep{0pt} %don't seems to solve the issue
    ~\\ %I don't understand why it's there
    \usekomavar{fromlogo}\\
      \usekomavar{fromname}\\
      \usekomavar{fromaddress}\\
      [1cm]
  \end{minipage}
  }

\title{}

\begin{document}

\setkomavar{subject}{pratical reason disputatio}

\begin{letter}{%
René Descartes\newline
57200 La Flèche\newline
France}

\opening{Sir,}

\kant[1]

\closing{Kind regards,}

\encl{Dummy text.}
\end{letter}
\end{document}
1

The wrafig solution still doesn't work, but a simple minipage environnement does. The drawbacks are:

  1. I can't have an automated solution adjust the size of my image on that of my address' paragraph, like wrapfig does.

  2. When I add a third minipage on the left, I still can't top align it ({minipage}[t]) with the two others, only centering works ({minipage}[c]). >>> see edit below.

Header (detail)

Here's the new code:

\documentclass{scrlttr2}
\LoadLetterOption{NF}

\KOMAoptions{fromlogo=true,backaddress=false,foldmarks=false}

\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\usepackage{wrapfig}
\usepackage{kantlipsum}
\usepackage[final]{microtype}

\setkomavar{signature}{Bibi}
\setkomavar{fromname}{Bibi}
\setkomavar{fromaddress}{
Abbey Road\newline
Moscow\newline
Mother Russia}
\setkomavar{fromphone}{06~98~76~54~32} %pro
\setkomavar{fromemail}{gondrix@gmx.fr}

\setkomavar{fromlogo}{
    \includegraphics[width=0.1\textheight]{logo1}
}

\firsthead{
\begin{minipage}[c]{0.15\textwidth}
% \includegraphics[width=0.1\textheight]{logo}
\usekomavar{fromlogo}
\end{minipage}
\begin{minipage}[c]{0.35\textwidth}
 \usekomavar{fromname}\newline
 \usekomavar{fromaddress}%\newline
\end{minipage}
% and here is the second, right-aligned part:
\hspace{0.15\textwidth}
  \begin{minipage}[c]{0.35\textwidth}
      \usekomavar*{fromphone}\usekomavar{fromphone}\\
      \usekomavar*{fromemail}\usekomavar{fromemail}\\%
  \end{minipage}
}

\title{}

\begin{document}

\setkomavar{subject}{pratical reason disputatio}

\begin{letter}{%
René Descartes\newline
57200 La Flèche\newline
France}

\opening{Sir,}

\kant[1]

\closing{Kind regards,}

\encl{Dummy text.}
\end{letter}
\end{document}

Edit: The package adjustbox provides a solution for the first drawback. With the align options of the minipage environment, the baseline is always used as a reference point, and for an image, the baseline is at bottom. Just using the following code and tuning the width of minipages, the alignment is made between the three of it.

\adjustbox{valign=t}
{
\begin{minipage}{0.33\linewidth}
% first minipage content here
\end{minipage}
}

\adjustbox{valign=t}
{
\begin{minipage}{0.33\linewidth}
% second minipage content here
\end{minipage}
}

\adjustbox{valign=t}
{
\begin{minipage}{0.33\linewidth}
% third minipage content here
\end{minipage}
}

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.