7

I want to merge a scrlttr2 and a komacv.

I want the headers from komacv to be congruent with those of scrlttr2. So on page 1 of komacv there should be the blue line (with same length as in scrlttr2 page 1) and the name and address stuff.

Page 2 of the komacv should accordingly have the header of page 2 of scrlttr2 (with the corresponding length on page 2).

The photo from komacv needs to stay on the left side. It should align with the left side of the blue boxes (or with the left end of the header).

I need your help! Thanks!

Update: Deleted source code and graphics, because they are not necessary anymore.

1 Answer 1

7

komacv is based on the KOMA-Script class scrartcl. So it is possible to use the relatively new KOMA-Script package scrletter to set the letter and the cv in one document.

Additional I would use scrlayer to define a new page style for the first pages of both the letter and the cv.

But komacv still loads scrpage2 and this package can not be used together with scrlayer-scrpage. So first of all

\RequirePackage{scrlfile}
\PreventPackageFromLoading[\usepackage{scrlayer-scrpage}]{scrpage2}

ensures that komacv does not load scrpage2.

Then we can the define a new layer using the letter pseudolength

\DeclareNewLayer[
  background,
  area={\useplength{toaddrhpos}}{\useplength{firstheadvpos}}%
       {\dimexpr\paperwidth-2\useplength{toaddrhpos}\relax}{3cm},
  contents={\parbox[t]{\layerwidth}{\raggedleft
    \usekomavar{fromname}\strut\\[-6pt]
    \textcolor{myblue}{\rule{\linewidth}{2pt}}\\
    \usekomavar{fromaddress}}}
]{firsthead}

and declare a new page style using this layer

\DeclarePageStyleByLayers{firstpage}{firsthead}

To align the photo you can insert this directly or redefine maketitle

\renewcommand\maketitle{%
  %\hspace*{\dimexpr-.5\paperwidth+.5\textwidth+\useplength{toaddrhpos}\relax}% to align with the headsepline
  \fcolorbox{mycolor}{white}{\includegraphics[width=3cm]{jeyre}}%
}

enter image description here

enter image description here

or alternatively

enter image description here

Code:

\RequirePackage{scrlfile}
\PreventPackageFromLoading[\usepackage{scrlayer-scrpage}]{scrpage2}

\documentclass[style=classic]{komacv}
\hypersetup{hypertexnames=false}

\usepackage{scrletter}
\setkomavar{fromname}{Jane Eyre}
\setkomavar{fromaddress}{Ferndean House\\Ferndean Village}
\setkomavar{subject}{Writing a letter}
\setkomavar{firsthead}{}

\KOMAoptions{headsepline=2pt,plainheadsepline,draft=false}
\setkomafont{headsepline}{\color{mycolor}}
\renewcommand\pagemark{\usekomafont{pagenumber}Page~\thepage}
\clearpairofpagestyles
\ohead[\pagemark]{}

\DeclareNewLayer[
  background,
  area={\useplength{toaddrhpos}}{\useplength{firstheadvpos}}%
       {\dimexpr\paperwidth-2\useplength{toaddrhpos}\relax}{3cm},
  contents={\parbox[t]{\layerwidth}{\raggedleft
    \usekomavar{fromname}\strut\\[-6pt]
    \textcolor{myblue}{\rule{\linewidth}{2pt}}\\
    \usekomavar{fromaddress}}}
]{firsthead}
\DeclarePageStyleByLayers{firstpage}{firsthead}

\renewcommand\maketitle{%
  \hspace*{\dimexpr-.5\paperwidth+.5\textwidth+\useplength{toaddrhpos}\relax}%
  \fcolorbox{mycolor}{white}{\includegraphics[width=3cm]{jeyre}}%
}

\usepackage{lmodern}
\begin{document}
\begin{letter}{%
        Ernst Hemingway\\
        Main street\\
        2300 PAMPLONA%
}
\opening{}
\thispagestyle{firstpage}
\pagestyle{plain.scrheadings}

Bulls are nice, but the last general meeting was about one year ago.
I want to remind you, that the constitution of our
club advises you to make a general meeting every
six month. Because of this I expect the executive
board to detain such a meeting immediately.

\pagebreak

I want to remind you, that the constitution of our
club advises you to make a general meeting every
six month. Because of this I expect the executive
board to detain such a meeting immediately.
\closing{Thank you}
\end{letter}
%----------------------------------------------------------
\cleardoublepage
\thispagestyle{firstpage}
\pagestyle{plain.scrheadings}
\raggedbottom
\pagenumbering{arabic}
\maketitle

\section{Personal Information}
\cvitem{Date of birth}{February 15, 1828}
\cvitem{Nationality}{British}
\cvitem{Civil Status}{Married, two children}
...
\clearpage
\section{All Elements}
\subsection{cvitem}
\cvitem{header}{cvitem text
  \begin{compactenum}
    \item compactenum item one
    \item compactenum item two
  \end{compactenum}
}
\end{document}

Update (because of a comment)

If the bars in cv should be 4pt height you have to redefine \@cvbarsection to

\makeatletter
\renewcommand\@cvbarsection[1]{%
  \origsection*{
    \phantomsection{}
    \addcontentsline{toc}{section}{#1}%
    \cvitem[0pt]{%
      \raggedleft\hintstyle{\color{@secbarcolor}%
        \rule{\@hintscolwidth}{4pt}}% <- defines the bar
    }{\sectionstyle{#1}}
  }
}
\makeatother

But note this is only a small change of the original komacv code. The original komacv code already breaks some of the possibilities of the current KOMA-Script version.

Result with roboto font:

enter image description here

Code:

\RequirePackage{scrlfile}
\PreventPackageFromLoading[\usepackage{scrlayer-scrpage}]{scrpage2}

\documentclass[style=classic]{komacv}
\hypersetup{hypertexnames=false}

\usepackage{scrletter}
\setkomavar{fromname}{Jane Eyre}
\setkomavar{fromaddress}{Ferndean House\\Ferndean Village}
\setkomavar{subject}{Writing a letter}
\setkomavar{firsthead}{}

\KOMAoptions{headsepline=2pt,plainheadsepline,draft=false}
\setkomafont{headsepline}{\color{mycolor}}
\renewcommand\pagemark{\usekomafont{pagenumber}Page~\thepage}
\clearpairofpagestyles
\ohead[\pagemark]{}

\DeclareNewLayer[
  background,
  area={\useplength{toaddrhpos}}{\useplength{firstheadvpos}}%
       {\dimexpr\paperwidth-2\useplength{toaddrhpos}\relax}{3cm},
  contents={\parbox[t]{\layerwidth}{\raggedleft
    \usekomavar{fromname}\strut\\[-6pt]
    \textcolor{myblue}{\rule{\linewidth}{2pt}}\\
    \usekomavar{fromaddress}}}
]{firsthead}
\DeclarePageStyleByLayers{firstpage}{firsthead}

\renewcommand\maketitle{%
  \hspace*{\dimexpr-.5\paperwidth+.5\textwidth+\useplength{toaddrhpos}\relax}%
  \fcolorbox{mycolor}{white}{\includegraphics[width=3cm]{jeyre}}%
}
\usepackage{roboto}
\makeatletter
\renewcommand\@cvbarsection[1]{%
  \origsection*{
    \phantomsection{}
    \addcontentsline{toc}{section}{#1}%
    \cvitem[0pt]{%
      \raggedleft\hintstyle{\color{@secbarcolor}%
        \rule{\@hintscolwidth}{4pt}}%
    }{\sectionstyle{#1}}
  }
}
\makeatother

\begin{document}
\begin{letter}{%
        Ernst Hemingway\\
        Main street\\
        2300 PAMPLONA%
}
\opening{}
\thispagestyle{firstpage}
\pagestyle{plain.scrheadings}

Bulls are nice, but the last general meeting was about one year ago.
I want to remind you, that the constitution of our
club advises you to make a general meeting every
six month. Because of this I expect the executive
board to detain such a meeting immediately.

\pagebreak

I want to remind you, that the constitution of our
club advises you to make a general meeting every
six month. Because of this I expect the executive
board to detain such a meeting immediately.
\closing{Thank you}
\end{letter}
%----------------------------------------------------------
\cleardoublepage
\thispagestyle{firstpage}
\pagestyle{plain.scrheadings}
\raggedbottom
\pagenumbering{arabic}
\maketitle

\section{Personal Information}
\cvitem{Date of birth}{February 15, 1828}
\cvitem{Nationality}{British}
\cvitem{Civil Status}{Married, two children}
...
\clearpage
\section{All Elements}
\subsection{cvitem}
\cvitem{header}{cvitem text
  \begin{compactenum}
    \item compactenum item one
    \item compactenum item two
  \end{compactenum}
}
\end{document}

Use the opitional argument of \rule if you want to change the vertical position of the bars.


Second update

komacv does some hacks witch break some of the possibilities of the current KOMA versions. Especially \RecdeclareSectionCommand does not work. Also the commands \beforesecvspace etc. seems to have no effect. There is a information in the komacv documentation:

Note that the section and subsection definition of komacv needs improvement, so the setting of these lengths may not produce the desired result and the result may change in future versions.

As a workaround you can insert \vspace*{...} in the redefinition of \@cvbarsection and \@cvbarsubsection but note this are only hacks:

\usepackage{roboto}
\makeatletter
\renewcommand\@cvbarsection[1]{%
  \vspace*{-1\baselineskip}% <- 
  \origsection*{
    \phantomsection{}
    \addcontentsline{toc}{section}{#1}%
    \cvitem[0pt]{%
      \raggedleft\hintstyle{\color{@secbarcolor}%
        \rule{\@hintscolwidth}{4pt}}%
    }{\sectionstyle{#1}}
  }
}
\renewcommand\@cvbarsubsection[1]{%
  \vspace*{-.5\baselineskip}% <- 
  \origsubsection*{
    \cvitem[0pt]{}{\subsectionstyle{#1}}
  }%
}
\makeatother
9
  • Thank you so much! Is there any way that I can change the spacing between the ´cv section´ elements? I tried to understand and use the explanation in ´komacv´ manual. But it did not work. Also I use ´roboto´ font, that makes the blue bars in the ´komacv´ much heigher. I wish they would be 4pt height and centered or bottom aligned with the textline. PS: How did you make that doublepage screenshot? Jul 18, 2015 at 7:58
  • BTW: I wish I could give 5 stars! Your answer is amazing and well explained. Jul 18, 2015 at 9:14
  • See my updated answer. Doublepage screenshot: in the viewer (Sumatra, Adobe Reader, ...) menu I can choose the doublepage view and then I use "Snipping Tool" that is provided by Windows.
    – esdd
    Jul 18, 2015 at 12:20
  • Thanks. Can you also mention how to adjust the vertical spacings between the cv section elements and also the cv subsection elements? Jul 18, 2015 at 12:39
  • I have added a workaround. But if there are more questions ask a new question please. I myself do not use komacv and the komacv code breaks some of the possibilities of the KOMA-Script classes.
    – esdd
    Jul 18, 2015 at 13:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .