5

I'm trying to align the signature with the destination address in a french styled letter.
I could use the very good lettre class as mentioned in my previous question but I need scrlttr2 to reuse the org-mode koma export back-end.

I tried setting the position with the following commands:

Test 0

\makeatletter
\@setplength{sigindent}{-\useplength{refhpos}+\useplength{toaddrhpos}}}
\makeatother

Test 1

\setkomavar{signature}{Chef Abraracoursix,\\Un chef à toujours bras long.}

Test 2

\setkomavar{signature}{\hspace{26em}\includegraphics[width=2.5cm]
{example-image}}

Test 3

\setkomavar{signature}{\hspace{26em}
  \begin{minipage}[t]{7cm}
    {Chef Abraracoursix,\hfill \\Un chef à toujours bras long.}
  \end{minipage}}

But the signature is stuck to the left. Here is my full code and the result I'm looking for.

% Created 2019-04-08 lun. 11:20
% Intended LaTeX compiler: pdflatex
\documentclass{scrlttr2}
\usepackage[francais]{babel}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
% \usepackage{showframe} % to show the page boundaries from https://tex.stackexchange.com/questions/298246/signatures-side-by-side

% \usepackage{geometry} 
% \geometry{verbose,a4paper,lmargin=3cm,rmargin=3cm}

\LoadLetterOption{visualize}
\showfields{head,foot,address,location,refline}
\LoadLetterOption{NF}
\renewcaptionname{french}{\subjectname}{Objet}
\renewcaptionname{french}{\ccname}{C.c.}

\KOMAoption{
  ,foldmarks=false
  ,refline=nodate
  ,subject=titled
  ,fromemail=false
  ,fromlogo=false
  ,fromphone=false
  ,fromurl=false
  ,backaddress=false
  ,foldmarks=false
}


% from name
\setkomavar{fromname}{Chef Abraracoursix}
\setkomafont{fromname}{\scshape}

%%%%%%%%%%%%%%%% HERE %%%%%%%%%%%%%%%%
% signature

%%%% test 1
% \setkomavar{signature}{Chef Abraracoursix,\\Un chef à toujours bras long.}

%%%% test 2
% \setkomavar{signature}{\hspace{26em}\includegraphics[width=2.5cm]{example-image}}% <- changed

%%%% test 3
% \setkomavar{signature}{\hspace{26em}
%   \begin{minipage}[t]{7cm}
%     {Chef Abraracoursix,\hfill \\Un chef à toujours bras long.}
%   \end{minipage}}

%%%% test 4
\setkomavar{signature}{
  \noindent \parbox[t]{0.5\linewidth}{Chef Abraracoursix,\hfill \\Un chef à toujours bras long.}
} 

%%%%%%%%%%%%%%%% above %%%%%%%%%%%%%%%%


% from adress
\setkomavar{fromaddress}{Place du village,\\Erqy,\\Armorique}
\setkomafont{fromaddress}{\small}

% place and location
\setkomavar{place}{Erqy}
\setkomavar{placeseparator}{, le }

% other komavar
\setkomavar{ccseparator}{}
\setkomavar*{ccseparator}{\llap{\ccname\quad}}
% \usepackage{setspace} \usepackage{lipsum} \setstretch{1.15}

% \setlength\parskip{\medskipamount} 
% \setlength\parindent{0pt}
% \setstretch{1.15}

\date{\today}

\makeatletter
% firsthead
\setkomavar{firsthead}{{
    \usekomafont{fromaddress}
    \parbox[b]{\useplength{firstheadwidth}}{
      {\usekomafont{fromname}\usekomavar{fromname}}
      \hfill{\usekomafont{placeanddate}
        \ifkomavarempty{place}{}{\usekomavar{place}\usekomavar{placeseparator}}
        \usekomavar{date}
      }
      \\\usekomavar{fromaddress}
      \medskip
      \if@phone\\\usekomavar*{fromphone}\usekomavar{fromphone}\fi
      \if@mobilephone\\\usekomavar*{frommobilephone}\usekomavar{frommobilephone}\fi
      \if@fax\\\usekomavar*{fromfax}\usekomavar{fromfax}\fi
      \if@email\\\usekomavar*{fromemail}\usekomavar{fromemail}\fi
      \if@www\\\usekomavar*{fromurl}\usekomavar{fromurl}\fi
    }}
}

makeatletter
%%%% TEST 0
% \@setplength{sigindent}{-\useplength{refhpos}+\useplength{toaddrhpos}}}
\makeatother
\renewcommand*{\raggedsignature}{\raggedright}


\hypersetup{
  pdfauthor={Chef Abraracoursix},
  pdftitle={Invitation pour une banquet au sanglier Roti},
  pdfcreator={Emacs 26.1 (Org mode 9.1.9)}, 
  pdflang={French}}

\begin{document}

\setkomavar{subject}{Invitation pour une banquet au sanglier Roti}

\begin{letter}{
    Capitaine Paulus Romanicus\\
    Camp de Babaorum
    Bretany}

  \opening{Le Romain,}

  Dans le cadre des rapports de bon voisinage et de notre hospitalité légendaire, nous vous invitons à festoyer avec nous sous le grand chêne, du coucher du soleil à l'aube, à la prochaine plein lune pour le mariage de la belle Fabala et de vigourix.
  \closing{À la tienne !}

\end{letter}

\end{document}

resulting letter

Idealy I would like

\makeatletter
\@setplength{sigindent}{-\useplength{refhpos}+\useplength{toaddrhpos}}
\makeatother

to work as expected with pseudo-lenght given in https://i.stack.imgur.com/D2tu3.png

  • Do not just look at the pseudo-length image from the documentation, but read the descriptions of the pseudo-lengths carefully. Some of them are set to special values by default, eg. 0pt. Then the class calculates the length of the positions of the letter elements when "opening". The rules for the calculations are described in the documentation. Especially the value of refhpos is 0pt in your example and must not be used for the calculation. – esdd May 9 at 9:11
7

Your calculation -\useplength{refhpos}+\useplength{toaddhpos} does not result in a value, that moves the signature to the middle of the text area.

In your example the value of refhpos is 0pt and the value of toaddrhpos is -10mm (given by NF.lco). Your

\@setplength{sigindent}{-\useplength{refhpos}+\useplength{toaddrhpos}}

(I've remove one }, which was to much), would result in a sigindent of -10mm. This would result in a position 10mm left to the left edge of the text area. So it is not what you want.

The image you've linked (which is figure 22.1 of the current KOMA-Script manual), is about address fields at the left side. You are using an address field on the right side. So toaddrhpos is the distance from the right paper edge to the right address field edge. It is negative (as told above). The refhpos has nothing to do with the position of the address field.

Please have a look into table 22.1 in part II of the KOMA-Script manual and into the descriptions of the pseudo length in section 22.1 to see, how the values of toaddhpos, refhpos and sigindent are interpreted by scrlttr2.

You may try something like:

\setplength{sigindent}{.5\textwidth}

Or a more complicate but correct calculation:

\setplength{sigindent}{\paperwidth+\useplength{toaddrhpos}-\useplength{toaddrwidth}+\useplength{toaddrindent}-\oddsidemargin-1in}

Note: This does only work for toaddrhpos < 0.

\paperwidth+\useplenth{toaddrhpos} is the position of the right edge of the address field relative to the left edge of the paper. Subtracting \useplength{toaddrwidth} results in the left edge of the address field relative to the left edge of the paper. Adding \useplength{toaddrindent} results in the left edge of the address relative to the left edge of the paper. But sigindent is relative to the left edge of the text area not the paper. So we have to subtract the left margin, which is (in oneside documents for all pages) \oddsidemargin+1in.

Note: Since KOMA-Script 3.26 \setplength instead of \@setplength is recommended. \@setplength is an internal command now. You should not longer use it. If you are using an outdated KOMA-Script release you still have to use \@setplength. But in this case also expressions in the second argument would not be allowed. So you would have to use:

\makeatletter
\@setplength{sigindent}{\dimexpr\paperwidth+\useplength{toaddrhpos}-\useplength{toaddrwidth}+\useplength{toaddrindent}-\oddsidemargin-1in\relax}
\makeatother

or split the calculation into several \@addtoplength.

Here is an example (using KOMA-Script >= 3.26), that illustrates the calculation:

\documentclass[%
  paper=a4,
  fontsize=11pt,
  french,
]{scrlttr2}[2018/12/22]% for KOMA-Script < v3.26 see the note about \setplengt` above

\usepackage{eso-pic,picture,xcolor}% for demonstration only

\usepackage{babel}
\usepackage[T1]{fontenc} 
\usepackage[utf8]{inputenc}
\usepackage{hyperref}

%\LoadLetterOption{visualize}
%\showfields{head,foot,address,location,refline}
\LoadLetterOption{NF}
\renewcaptionname{french}{\subjectname}{Objet}
\renewcaptionname{french}{\ccname}{C.c.}

\KOMAoptions{
  ,foldmarks=false
  ,refline=nodate
  ,subject=titled
  ,fromemail=false
  ,fromlogo=false
  ,fromphone=false
  ,fromurl=false
  ,backaddress=false
  ,foldmarks=false
}

% from name
\setkomavar{fromname}{Chef Abraracoursix}
\setkomafont{fromname}{\scshape}

\setkomavar{signature}{\noindent Chef Abraracoursix,\\Un chef à toujours bras long.}
\setplength{sigindent}{\paperwidth+\useplength{toaddrhpos}-\useplength{toaddrwidth}+\useplength{toaddrindent}-\oddsidemargin-1in}
% Show the calculation (for demonstration only)
\AddToShipoutPicture{%
  \AtPageUpperLeft{%
    \color{red}%
    \footnotesize
    \put(0,-\useplength{toaddrvpos}){%
      \vector(1,0){\dimexpr\paperwidth+\useplength{toaddrhpos}\relax}%
    }%
    \put(0,-\useplength{toaddrvpos}){%
      \makebox(\dimexpr\paperwidth+\useplength{toaddrhpos}\relax,\ht\strutbox)[cb]{\ttfamily\detokenize{\paperwidth+\useplength{toaddrhpos}}}%
    }%
    \color{red!80!blue!80}%
    \put(\dimexpr\paperwidth+\useplength{toaddrhpos}\relax,-\dimexpr\useplength{toaddrvpos}+\ht\strutbox\relax){%
      \vector(-1,0){\useplength{toaddrwidth}}%
    }%
    \put(\dimexpr\paperwidth+\useplength{toaddrhpos}-\useplength{toaddrwidth}\relax,-\dimexpr\useplength{toaddrvpos}+\ht\strutbox\relax){%

      \makebox(\useplength{toaddrwidth},\ht\strutbox)[cb]{\ttfamily\detokenize{\useplength{toaddrwidth}}}%
    }%
    \color{red!60!blue!60}%
    \put(\dimexpr\paperwidth+\useplength{toaddrhpos}-\useplength{toaddrwidth}\relax,-\dimexpr\useplength{toaddrvpos}+\ht\strutbox*2\relax){%
      \vector(1,0){\useplength{toaddrindent}}%
    }%
    \put(\dimexpr\paperwidth+\useplength{toaddrhpos}-\useplength{toaddrwidth}\relax,-\dimexpr\useplength{toaddrvpos}+\ht\strutbox*2\relax){%
      \makebox(\useplength{toaddrindent},\ht\strutbox){%
        \ttfamily\detokenize{\useplength{toaddrindent}}%
      }%
    }%
    \color{green}%
    \put(\dimexpr\oddsidemargin+1in\relax,
    -\dimexpr\useplength{toaddrvpos}+2cm\relax){%
      \vector(1,0){%
        \dimexpr\paperwidth+\useplength{toaddrhpos}-\useplength{toaddrwidth}+\useplength{toaddrindent}-\oddsidemargin-1in\relax
      }%
    }%
    \put(\dimexpr\oddsidemargin+1in\relax,
    -\dimexpr\useplength{toaddrvpos}+2cm\relax){%
      \makebox(\dimexpr\paperwidth+\useplength{toaddrhpos}-\useplength{toaddrwidth}+\useplength{toaddrindent}-\oddsidemargin-1in\relax,\ht\strutbox)[lb]{%
        \detokenize{\paperwidth+\useplength{toaddrhpos}-\useplength{toaddrwidth}+\useplength{toaddrindent}-\oddsidemargin-1in}%
      }%
    }%
    \color{blue}%
    \put(\dimexpr\paperwidth+\useplength{toaddrhpos}-\useplength{toaddrwidth}+\useplength{toaddrindent}\relax,0){%
      \line(0,-1){\paperheight}%
    }%
  }%
}

% from adress
\setkomavar{fromaddress}{Place du village,\\Erqy,\\Armorique}
\setkomafont{fromaddress}{\small}

% place and location
\setkomavar{place}{Erqy}
\setkomavar{placeseparator}{, le }

% other komavar
\setkomavar{ccseparator}{}
\setkomavar*{ccseparator}{\llap{\ccname\quad}}

\date{\today}

% firsthead
\setkomavar{firsthead}{%
    \usekomafont{fromaddress}%
    \parbox[b]{\useplength{firstheadwidth}}{%
      {\usekomafont{fromname}\usekomavar{fromname}}%
      \hfill{%
        \usekomafont{placeanddate}%
        \ifkomavarempty{place}{}{\usekomavar{place}\usekomavar{placeseparator}}
        \usekomavar{date}
      }%
      \\\usekomavar{fromaddress}%
      \medskip
      \if@phone\\\usekomavar*{fromphone}\usekomavar{fromphone}\fi%
      \if@mobilephone\\\usekomavar*{frommobilephone}\usekomavar{frommobilephone}\fi%
      \if@fax\\\usekomavar*{fromfax}\usekomavar{fromfax}\fi%
      \if@email\\\usekomavar*{fromemail}\usekomavar{fromemail}\fi%
      \if@www\\\usekomavar*{fromurl}\usekomavar{fromurl}\fi%
    }%
}

\renewcommand*{\raggedsignature}{\raggedright}

\hypersetup{%
  pdfauthor={Chef Abraracoursix},
  pdftitle={Invitation pour une banquet au sanglier Roti},
  pdfcreator={Emacs 26.1 (Org mode 9.1.9)}, 
  pdflang={French}
}

\begin{document}

\setkomavar{subject}{Invitation pour une banquet au sanglier Roti}

\begin{letter}{%
    Capitaine Paulus Romanicus\\
    Camp de Babaorum
    Bretany}

\opening{Le Romain,}

Dans le cadre des rapports de bon voisinage et de notre hospitalité 
légendaire, nous vous invitons à festoyer avec nous sous le grand chêne, 
du coucher du soleil à l'aube, à la prochaine plein lune pour le mariage 
de la belle Fabala et de vigourix.
\closing{À la tienne !}

\end{letter}

\end{document}

enter image description here

Note, there were several other issues with your code:

\usepackage[francais]{babel}

is deprecated. Current babel warns:

Package francais.ldf Warning: Option `francais' for Babel is *deprecated*,
(francais.ldf)                it might be removed sooner or later. Please
(francais.ldf)                use `french' instead; reported on input line 31.
\KOMAoption{
  ,foldmarks=false
  ,refline=nodate
  ,subject=titled
  ,fromemail=false
  ,fromlogo=false
  ,fromphone=false
  ,fromurl=false
  ,backaddress=false
  ,foldmarks=false
}

is wrong. \KOMAoption has two arguments. The first one is an option key, the second is a list of option values.

To help users to find out what's wrong, the current prerelease of KOMA-Script shows the following error message with your wrong usage of \KOMAoption:

./test.tex:28: Package scrbase Error: syntax error in key ` ,foldmarks=false ,r
efline=nodate ,subject=titled ,fromemail=false ,fromlogo=false ,fromphone=false
 ,fromurl=false ,backaddress=false ,foldmarks=false '.

See the scrbase package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.28 }

You've used `\...Option' to set the key ` ,foldmarks=false ,refline=nodate ,sub
ject=titled ,fromemail=false ,fromlogo=false ,fromphone=false ,fromurl=false ,b
ackaddress=false ,foldmarks=false '
to new value(s), but `,' is not allowed in the key of an option
(and `\...Option' does not use `,' to separate several keys).
Maybe you've meant \...Options instead of \...Option.
If you'll continue, I'll give it a try, but you should expect further
and even strange error messages.

As the help text of the error message explains:

\KOMAoptions{
  ,foldmarks=false
  ,refline=nodate
  ,subject=titled
  ,fromemail=false
  ,fromlogo=false
  ,fromphone=false
  ,fromurl=false
  ,backaddress=false
  ,foldmarks=false
}

would be correct.

Your definition of firsthead adds several significant but unwanted white spaces. See What is the use of percent signs (%) at the end of lines? for more information how to avoid them.

There is also a warning message about usage of \date:

Class scrlttr2 Warning: \date changes the internal \LaTeX date only.
(scrlttr2)              You should note that this changes the default
(scrlttr2)              value of variable `date' only as long as someone
(scrlttr2)              uses `\setkomavar` to change the content of
(scrlttr2)              variable `date'.
(scrlttr2)              Therefore, usage of `\setkomavar' is recommended
(scrlttr2)              to change the letter's date on input line 59.

So for scrlttr2 you should use

\setkomavar{date}{\today}

or just remove it, because \today is already the default.

Last but not least, you have a

makeatletter

instead of

\makeatletter

in your document preamble.

  • I provided the link to the pseudo-lengths i.stack.imgur.com/D2tu3.png for a letter where what I want is clearly - refhpos + toaddhpos. What I don't understand is why all the above command have not impact on my signature's position. – Malik Koné Apr 8 at 21:19
  • 1
    As I told you: Your calculation refhpos + toaddhpos results in -10mm which is wrong. Try the two suggestions I made. The second one should be exactly what you are searching for. BTW: The picture is from the KOMA-Script manual. I know that picture. – Schweinebacke Apr 9 at 5:50
  • I may have a latex version problem because I don't see any change and I'm not able to compile your code even on overleaf. overleaf.com/7967172393zkcnhzmqsgcc at least if I could move the signature by an inch, I'm sure I would find the right calculation to place it correctly. – Malik Koné Apr 9 at 21:08
  • Thank you for all your corrections. It is helpful. – Malik Koné Apr 9 at 21:10
  • 2
    @MalikKoné Overleaf uses AFAIK an older TeX Live 2017 with a historic KOMA-Script version. So you still have to use \makeatletter\@setplength…\makeatother there. Moreover it does not provide calculation in the second argument of \@setplength. So you have to either use explicit \dimexpr or split it into several \@addtoplength. – Schweinebacke Apr 10 at 6:06
4

My suggestion is the same as in the answer of @Schweinebacke. But it is too long for a comment ... maybe the following helps to understand why refhpos is completely wrong in the calculation of the desired indent of the signature, ie the pseudolength sigindent.

First of all: Do not just look at the pseudolength-image in the documentation, but read the descriptions of all pseudolengths carefully. By default some of them are set to special values, eg. 0pt. Then the positions of these letter elements are calculated and used in a group during the excecution of \opening. The rules for these calculations are described in the documentation.

Note that pseudolength refhpos is not the distance between the left edge of the paper and the letter body! It only determines the horizontal position of the reference line if the pseudolengths refwidth is not zero. But refwidth is typically set to 0pt, eg in the NF.lco. With this special value the lengths and the position of the reference line depend only on option refline and its values narrow (default) or wide.

Examples:

\documentclass{scrlttr2}
\usepackage{blindtext}% dummy text
\LoadLetterOption{visualize}\showfields{address,location,refline}% visualize position of addresse and refline

%\KOMAoptions{refline=wide}% uncomment for the 2.image, default is refline=narrow

\begin{document}
\begin{letter}{recipient\\address}
\opening{Hello}
Pseudolength \texttt{refwidth} is set to \textbf{\the\useplength{refwidth}},
pseudolength \texttt{refhpos} is set to \textbf{\the\useplength{refhpos}} and
pseudolength \texttt{sigindent} is set to \textbf{\the\useplength{sigindent}}.
\par\bigskip
\blindtext
\closing{Bye}
\end{letter}
\end{document}

Result with default refline settings (refline=narrow):

enter image description here

Result with refline=wide (uncomment the line in the code above):

enter image description here

If you set refhpos to a different value, the layout will not change:

\setplength{refhpos}{10pt}

Result with default refline=narrow (see the first example):

enter image description here

Note that only the value in the text has changed.

But if you set pseudolength refwidth to a nonzero value, e.g.

  \setplength{refwidth}{\textwidth}

you get

enter image description here

or with

\setplength{refhpos}{10pt}
\setplength{refwidth}{\textwidth}

enter image description here

Note that this behavior is described in the KOMA-Script documentation.


To align the signature with the addresse, we have to add the pseudolengths toaddrhpos and toaddrindent and to subtract the left margin (=\oddsidemargin+1pt):

\documentclass{scrlttr2}
\usepackage{xcolor}
\LoadLetterOption{visualize}\showfields{address,location,refline}% visualize position of addresse and refline

\renewcommand\raggedsignature{\raggedright}% % signature should be raggedright as in NF.lco
\setkomavar{signature}{\color{red}\smash{\rule[-\paperheight]{.4pt}{2\paperheight}}}% to show the left margin of the signature

%\setplength{toaddrhpos}{100pt}
\setplength{sigindent}{
  \useplength{toaddrhpos}+\useplength{toaddrindent}
  -\oddsidemargin-1in% remove left margin
}

\begin{document}
\begin{letter}{recipient\\address}
\opening{Hello}
Pseudolength \texttt{refhpos} is set to \textbf{\the\useplength{refhpos}},
pseudolength \texttt{toaddrhpos} is set to \textbf{\the\useplength{toaddrhpos}},
pseudolength \texttt{toaddrindent} is set to \textbf{\the\useplength{toaddrindent}} and
pseudolength \texttt{sigindent} is set to \textbf{\the\useplength{sigindent}}.
\closing{Bye}
\end{letter}
\end{document}

Result:

enter image description here

and if you set toaddrhpos to 100pt (uncomment the line in the code above):

enter image description here

If you set toaddrhpos to the width of the left margin

\setplength{toaddrhpos}{\oddsidemargin+1in}

you get

enter image description here


Loading NF.lco the value of toaddrhpos get negative. A negative value means thattoaddrhpos is the distance from the right edge of the address field to the right edge of the paper. Therefore we have to add \paperwidth and subtract the width of the address field (toaddrwidth):

\documentclass{scrlttr2}
\usepackage{xcolor}
\LoadLetterOption{visualize}\showfields{address,location,refline}% visualize position of addresse and refline
\setkomavar{signature}{\color{red}\smash{\rule[-\paperheight]{.4pt}{2\paperheight}}}% to show the left margin of the signature

\LoadLetterOption{NF}

\setplength{sigindent}{
  \useplength{toaddrhpos}+\useplength{toaddrindent}
  -\oddsidemargin-1in
}
\ifdim\useplength{toaddrhpos}<0pt
  \addtoplength{sigindent}{\paperwidth-\useplength{toaddrwidth}}
\fi


\begin{document}
\begin{letter}{recipient\\address}
\opening{Hello}
Pseudolength \texttt{refhpos} is set to \textbf{\the\useplength{refhpos}},
pseudolength \texttt{toaddrhpos} is set to \textbf{\the\useplength{toaddrhpos}},
pseudolength \texttt{toaddrindent} is set to \textbf{\the\useplength{toaddrindent}} and
pseudolength \texttt{sigindent} is set to \textbf{\the\useplength{sigindent}}.
\closing{Bye}
\end{letter}
\end{document}

Result:

enter image description here

See also the image in the answer of @Schweinebacke.

You can change toaddrhpos before the calculation of sigindent, eg

\setplength{toaddrhpos}{-100pt}

Result:

enter image description here


So I would suggest the same as @Schweineback in his answer:

With an uptodate KOMA-Script Version (at least 3.26):

\setplength{sigindent}{
  \useplength{toaddrhpos}+\useplength{toaddrindent}
  -\oddsidemargin-1in
  }
\ifdim\useplength{toaddrhpos}<0pt
  \addtoplength{sigindent}{\paperwidth-\useplength{toaddrwidth}}
\fi

or with older versions:

\makeatletter
\@setplength{sigindent}{\dimexpr
  \useplength{toaddrhpos}+\useplength{toaddrindent}
  -\oddsidemargin-1in
  \relax}
\ifdim\useplength{toaddrhpos}<0pt
  \@addtoplength{sigindent}{\dimexpr\paperwidth-\useplength{toaddrwidth}\relax}
\fi
\makeatother
-2

The problem here is that pseudolength toaddrhpos is set in NF.lco to a negative value of -10mm with command \@setplength{toaddrhpos}{-10mm}.

That means that the value of 10mm is not the value between left paper side and address field, it is the value between the right paper side and the adress box. Usually the adress box is printed first (on the left side of the paper) and the location box follows then. With file NF-lco that changed as you already showed in your picture in your question.

sigindent is always calculated from the left side of the typing area, so you have to calculate the needed value for sigindent by yourself.

One possibility is:

\setplength{sigindent}{\paperwidth+\useplength{toaddrhpos}-\useplength{toaddrwidth}-\useplength{toaddrindent}-\useplength{toaddrindent}-\useplength{refhpos}}

That means we calculate the \paperwidth minus toaddrhpos (because its value is already minus we have to use plus here) minus toaddrwidth minus refhpos minus two times toaddrindent.

With that calculation in your corrected given code

\documentclass[%
  paper=a4,
  fontsize=11pt,
  french,
]{scrlttr2}

\usepackage{babel}
\usepackage[T1]{fontenc} 
\usepackage[utf8]{inputenc}
\usepackage{hyperref}


%\LoadLetterOption{visualize}
%\showfields{head,foot,address,location,refline}
\LoadLetterOption{NF}
\renewcaptionname{french}{\subjectname}{Objet}
\renewcaptionname{french}{\ccname}{C.c.}

\KOMAoptions{
  ,foldmarks=false
  ,refline=nodate
  ,subject=titled
  ,fromemail=false
  ,fromlogo=false
  ,fromphone=false
  ,fromurl=false
  ,backaddress=false
  ,foldmarks=false
}

% from name
\setkomavar{fromname}{Chef Abraracoursix}
\setkomafont{fromname}{\scshape}

\setkomavar{signature}{\noindent Chef Abraracoursix,\\Un chef à toujours bras long.}
\setplength{sigindent}{\paperwidth+\useplength{toaddrhpos}-\useplength{toaddrwidth}-\useplength{toaddrindent}-\useplength{toaddrindent}-\useplength{refhpos}} % <===============

% from adress
\setkomavar{fromaddress}{Place du village,\\Erqy,\\Armorique}
\setkomafont{fromaddress}{\small}

% place and location
\setkomavar{place}{Erqy}
\setkomavar{placeseparator}{, le }

% other komavar
\setkomavar{ccseparator}{}
\setkomavar*{ccseparator}{\llap{\ccname\quad}}

\date{\today}


% firsthead
\setkomavar{firsthead}{%
    \usekomafont{fromaddress}%
    \parbox[b]{\useplength{firstheadwidth}}{%
      {\usekomafont{fromname}\usekomavar{fromname}}%
      \hfill{%
        \usekomafont{placeanddate}%
        \ifkomavarempty{place}{}{\usekomavar{place}\usekomavar{placeseparator}}
        \usekomavar{date}
      }%
      \\\usekomavar{fromaddress}%
      \medskip
      \if@phone\\\usekomavar*{fromphone}\usekomavar{fromphone}\fi%
      \if@mobilephone\\\usekomavar*{frommobilephone}\usekomavar{frommobilephone}\fi%
      \if@fax\\\usekomavar*{fromfax}\usekomavar{fromfax}\fi%
      \if@email\\\usekomavar*{fromemail}\usekomavar{fromemail}\fi%
      \if@www\\\usekomavar*{fromurl}\usekomavar{fromurl}\fi%
    }%
}

\renewcommand*{\raggedsignature}{\raggedright}

\hypersetup{%
  pdfauthor={Chef Abraracoursix},
  pdftitle={Invitation pour une banquet au sanglier Roti},
  pdfcreator={Emacs 26.1 (Org mode 9.1.9)}, 
  pdflang={French}
}


\begin{document}

\setkomavar{subject}{Invitation pour une banquet au sanglier Roti}

\begin{letter}{%
    Capitaine Paulus Romanicus\\
    Camp de Babaorum
    Bretany}

\opening{Le Romain,}

Dans le cadre des rapports de bon voisinage et de notre hospitalité 
légendaire, nous vous invitons à festoyer avec nous sous le grand chêne, 
du coucher du soleil à l'aube, à la prochaine plein lune pour le mariage 
de la belle Fabala et de vigourix.
\closing{À la tienne !}

\end{letter}

\end{document}

you get the following result:

result

It seems there is a difference of 5pt too much I do not know where it comes from (rounding errors, an indent I did not saw?). In the case of this mwe you can add them to the calculation with:

\setplength{sigindent}{\paperwidth+\useplength{toaddrhpos}-\useplength{toaddrwidth}-\useplength{toaddrindent}-\useplength{toaddrindent}-\useplength{refhpos}-5pt}
  • I have removed some comments here which focus on technical aspects of the answer but which had become discursive. To summarise briefly, this answer is based on public details of the data/calculation steps in KOMA, but the KOMA author and others suggest that this does not give the correct results: see komascript.de/comment/6060#comment-6060. This may well be due to deficiencies in the documentation. – Joseph Wright May 12 at 7:34

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.