合并 scrlttr2 和 komacv 布局

合并 scrlttr2 和 komacv 布局

我想合并 ascrlttr2和 a komacv

我希望 的标题komacv与 的标题一致scrlttr2。因此, 的第 1 页komacv应该有蓝线(与 scrlttr2 第 1 页的长度相同)以及姓名和地址等内容。

因此,的第 2 页komacv应该具有的第 2 页的页眉scrlttr2(具有第 2 页的相应长度)。

照片komacv需要放在左侧。它应该与蓝色框的左侧对齐(或与标题的左端对齐)。

我需要你的帮助!谢谢!

更新:删除源代码和图形,因为它们不再需要。

答案1

komacv基于 KOMA-Script 类scrartcl。因此,可以使用相对较新的 KOMA-Script 包scrletter将信件和简历放在一个文档中。

另外,我还将scrlayer为信件和简历的第一页定义一种新的页面样式。

komacv仍然加载scrpage2,并且此包不能与一起使用scrlayer-scrpage。所以首先

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

确保komacv不会加载scrpage2

letter然后我们可以使用伪长度定义一个新层

\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}

要对齐照片,您可以直接插入或重新定义 maketitle

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

在此处输入图片描述

在此处输入图片描述

或者

在此处输入图片描述

代码:

\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}

更新(因为一条评论)

如果 cv 中的条形高度应为 4pt,则必须重新定义\@cvbarsection

\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

但请注意,这只是对原始komacv代码的一个小改动。原始komacv代码已经破坏了当前 KOMA-Script 版本的一些可能性。

带字体的结果roboto

在此处输入图片描述

代码:

\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}

\rule如果您想改变条形的垂直位置,请使用可选参数。


第二次更新

komacv有一些黑客会破坏当前 KOMA 版本的某些可能性。特别是\RecdeclareSectionCommand不起作用。命令\beforesecvspace等似乎也不起作用。komacv文档中有一条信息:

请注意,komacv 的节和小节定义需要改进,因此这些长度的设置可能不会产生预期的结果,并且结果可能会在未来的版本中发生变化。

作为一种解决方法,您可以插入\vspace*{...}重新定义\@cvbarsection和,\@cvbarsubsection但请注意,这只是黑客行为:

\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

相关内容