This is a very interesting layout. Try the following code. A boolean is hooked to the \everypar
. This means that if there is plain paragraph first it is set to false and the next subsection will have normal spacing. Note also the strange place where the \secskip
command end up, but it seems to work.
EDIT 1: Restore original \everypar
and remove vertical space of \lastskip
before moving subsection up. Remove all glue and add \raggedbottom
to prevent stretching.
EDIT 2: It looks if the additional vertical spacing is \baselineskip
\usepackage{titlesec}
\makeatletter
\newif\ifaftersec\aftersecfalse
\newcommand\setsubskip{%
\global\aftersectrue
\everypar{%
\global\aftersecfalse
\if@noskipsec
\global\@noskipsecfalse
\clubpenalty\@M
\hskip-\parindent
\begingroup
\@svsechd\unskip{\hspace{\@tempskipb}}%
\endgroup
\else
\clubpenalty\@clubpenalty\everypar{}%
\fi}}
\newcommand\subskip{%
\ifaftersec
\removelastskip% EDIT 2
\vspace{-\baselineskip}% EDIT 2 ??????????????
\fi
\global\aftersecfalse}
\titleformat{\section}[leftmargin]{\raggedright\scshape}{}{0pt}{}[\setsubskip]
\titlespacing*{\section}{2.5cm}{2.5ex}{0.5cm}
\titleformat{\subsection}{\subskip\bfseries}{}{0pt}{}[]
\titlespacing*{\subsection}{0pt}{2ex}{1ex}
\raggedbottom
\makeatother
You have made a reasonable start. scrlettr2
divides the page up in to various regions. At the top is a header region. Below that on the left is a region for the address the letter is to be sent to. At about the same level on the right-hand side is a region called location
.
The option you choose fromalign=right
moves the from address to the right, but keeps it in the header area. Instead the option fromalign=locationright
, wiil move it down in to the location region.
Now by default the date appears in the reference line, a box placed below all these addresses. The date can be removed from that position, via the option refline=nodate
. It can then be placed in the location region, by setting the koma variable location
to the value of the koma variable date
:
\setkomavar{location}{\usekomavar{date}}
Putting this together we get:
\documentclass[paper=a4,parskip=full]{scrlttr2}
\usepackage[english]{babel}
\KOMAoptions{foldmarks=off,backaddress=false,fromalign=locationright,refline=nodate}
\renewcommand*{\raggedsignature}{\raggedright}
\setkomavar{fromname}{John Public}
\setkomavar{fromaddress}{Valley 2\\
54321 Public-Village}
\setkomavar{location}{\usekomavar{date}}
\begin{document}
\begin{letter}{Addressee\\Road\\Town\\County}
\opening{Dear Sir,}
A short text that constitutes the body of the letter.
\closing{Yours sincerely}
\end{letter}
\end{document}
Should you wish to have more space before the date you can change the definition you give to location
. For example,
\setkomavar{location}{\vspace{\baselineskip}\usekomavar{date}}
produces a blank line before the date:
Best Answer
You can use
or if you want to set the KOMA length directly
However, setting directly
firstheadvpos
should be done in alco
file (letter class options).