4

I read this question scrlttr2 location positioning question and now have a follow up question.

How do I enlarge the location in KOMA-Script class scrlttr2? My added line (the one with the comment) is only a work around, but doesn't enlarge the box (?), so the warnings keep staying.

\documentclass[foldmarks=true,foldmarks=blmtP,
version=last]{scrlttr2}

\usepackage[showframe]{geometry} % just to show the frame

\usepackage[ngerman]{babel}
\usepackage{graphics}
\usepackage{lipsum}

\makeatletter
  \@setplength{lochpos}{\oddsidemargin}
  \@addtoplength{lochpos}{1in}
  \@addtoplength{lochpos}{24pt}%only moves the location, but doesn't enlange it
\makeatother

\begin{document}
\setkomavar{location}{\raggedleft
verylongline12345678901234}
\begin{letter}{%
Joana Public\\
Hillside 1\\
12345 Public-City%
}
\opening{Dear ...,}
\lipsum[1-2]
\closing{Regards}

\end{letter}
\end{document}
4

To enlarge the in KOMA-Script, class scrlttr2 called location you need to add the line

  \@addtoplength{locwidth}{6cm} % enlarges location <===================

to your code. Change the value 6cm for your needs.

To give you a better overview I deleted in the following MWE your used geometry line (because it changes the layout of the letter, better use package showframe) and added the following three lines

\LoadLetterOption{visualize} % <========================================
\showfields{address,location,refline} % <===============================
\usepackage{showframe} % just to show the frame <=======================

Now you can see the location visualized with a black frame.

With the following MWE

\documentclass[%
  foldmarks=true, foldmarks=blmtP,
  version=last
]{scrlttr2}

\LoadLetterOption{visualize} % <========================================
\showfields{address,location,refline} % <===============================
\usepackage{showframe} % just to show the frame <=======================

\usepackage[ngerman]{babel}
\usepackage{graphics}
\usepackage{lipsum}

\makeatletter
  \@setplength{lochpos}{\oddsidemargin}
  \@addtoplength{lochpos}{1in}
  \@addtoplength{locwidth}{6cm} % enlarges location <===================
\makeatother

\begin{document}
\setkomavar{location}{\raggedleft
verylongline12345678901234}
\begin{letter}{%
Joana Public\\
Hillside 1\\
12345 Public-City%
}
\opening{Dear ...,}
\lipsum[1-2]
\closing{Regards}

\end{letter}
\end{document}

you get the wanted result:

enter image description here

With KOMA-Script version 3.26 or later you can use command \addtoplength instead \@addtoplength etc. To make sure that your cade can only be compiled with the correct version or later versions add [2019/02/01 v3.26b] to scrlttr2:

\documentclass[%
  foldmarks=true, foldmarks=blmtP,
  version=last
]{scrlttr2}[2019/02/01 v3.26b] % <============== compiles only with version v3.26b or more

\LoadLetterOption{visualize} % <========================================
\showfields{address,location,refline} % <===============================
\usepackage{showframe} % just to show the frame <=======================

\usepackage[ngerman]{babel}
\usepackage{graphics}
\usepackage{lipsum}

% no @ needed with version KOMA-Script 3.26 <===========================
\setplength{lochpos}{\oddsidemargin} % <================================
\addtoplength{lochpos}{1in} % <=========================================
\addtoplength{locwidth}{6cm} % enlarges location <======================


\begin{document}
\setkomavar{location}{\raggedleft
verylongline12345678901234}
\begin{letter}{%
Joana Public\\
Hillside 1\\
12345 Public-City%
}
\opening{Dear ...,}
\lipsum[1-2]
\closing{Regards}

\end{letter}
\end{document}

with the shown result above!

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.