我正在使用scrlttr2
正式信函模板。我面临 3 个问题:
(1)首页页眉处显示Logo
(2)所有页面页脚处均有 Logo
(3)所有后续页面页眉中均显示徽标
在所有后续页面上,我希望徽标仍然存在,但没有联系方式。它必须看起来像这样:
现在它只是空的。
这就是我现在使用的代码:
\documentclass%%
[fontsize=11pt,
parskip=half,%%
fromalign=right,%%
fromphone=on,%%
fromfax=on,%%
fromrule=aftername,%%
fromemail=on,%%
fromlogo=true,%%
foldmarks=false,%%
firstfoot=true,%%
subject=titled,%%
pagenumber=botright,%%
]{scrlttr2}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{url}
\usepackage{graphicx}
\usepackage{eurosym}
\usepackage{lipsum}
\usepackage{selinput}
\usepackage{newcent}
\usepackage{lipsum}
\SelectInputMappings{
adieresis={ä},
germandbls={ß},
Euro={€},
}
\setkomafont{fromname}{\scshape \LARGE}
\setkomafont{backaddress}{\mdseries}
\makeatletter
\@setplength{firstheadvpos}{7mm}
\@setplength{firstfootvpos}{265mm}%%
\makeatother
\begin{document}
\setkomavar{fromaddress}{
my surname name\\
my streetname 21\\
my example city}
\setkomavar{fromphone}{+99\,(9)999)\,999\,999\,99}
\setkomavar{fromphone}{+99\,(9)999)\,999\,999\,99}
\setkomavar{fromfax}{+99\,(9)999)\,999\,999\,99}
\setkomavar{fromemail}{[email protected]}
\setkomavar{backaddressseparator}{ - }
\setkomavar{place}{city}
\setkomavar{signature}{example signature}
\setkomavar{frombank}{IBAN: 9999\,9999\,9999\,9999\,9999\,99\\
BIC: 12341234ABDC\\
example example example\vspace{0.1cm}\\
example example example example\\
example example example, example example example}
\setkomavar{fromlogo}{\includegraphics[scale=.2]{/home/philipp/Dropbox/briefvorlage_example_TechExchange/generic_logo.pdf}}
\setkomavar{firstfoot}{\footnotesize%
\rule[5pt]{472pt}{.3pt}\\
\begin{tabular}[t]{l@{}}%
\usekomavar{fromname}\\
\usekomavar{fromaddress}\\
\end{tabular}%
\hfill
\begin{tabular}[t]{l@{}}%
\usekomavar{fromphone}\\
\usekomavar{fromfax}\\
\usekomavar{fromemail}\\
\end{tabular}%
\ifkomavarempty{frombank}{}{%
\hfill
\begin{tabular}[t]{l@{}}%
\usekomavar{frombank}
\end{tabular}%
}%
}%
\renewcaptionname{ngerman}{\enclname}{Anlagen}
\begin{letter}{Mr.\\surname name\\office\\street name\\postal code and city}\vspace{0.3cm}
\setkomavar{subject}{subject: example example example example example example example example example example example example example example example example example example example example example example example example}
\opening{Dear Mr. xxxxx xxxxxxxxxx,}
\lipsum[1-4]
\closing{Regards,}
\setkomavar*{enclseparator}{Enclosure(s):}
\encl{example enclosure}
\end{letter}
\end{document}
我研究了几个小时,但一无所获。这些是我查看过的最有用的帖子,不幸的是,没有任何成果:徽标置于标题栏中(将徽标置于标题中),LaTeX 标题中的徽标,Koma-Script 字母类,页眉和页脚未显示在第二页(scrlttr2)。
非常感谢您的帮助。
答案1
要解决这三个问题,您可以这样做:
第一页标题中的徽标:将徽标放在线上方,然后是地址等。我认为最好的方法是
firsthead
像这样定义自己的徽标:\setkomavar{firsthead}{\raggedleft % <================================== \usekomavar{fromlogo}\\[+1cm] \rule{\textwidth}{0.5pt}\\ \usekomavar{fromaddress}\\ \usekomavar{fromphone}\\ \usekomavar{fromfax}\\ \usekomavar{fromemail}\\% <=========================================== }
要激活此定义,请将该选项称为
firsthead=true,
类选项。所有页面页脚中的徽标:首先,您必须像
firstfoot
这样添加徽标:\setkomavar{firstfoot}{\footnotesize% \rule[5pt]{472pt}{.3pt}\\ \begin{tabular}[t]{l@{}}% \includegraphics[scale=.3]{generic-logo-company}\\[-5mm] % <================== \usekomavar{fromname}\\ \usekomavar{fromaddress}\\ \end{tabular}% \hfill \begin{tabular}[t]{l@{}}% \usekomavar{fromphone}\\ \usekomavar{fromfax}\\ \usekomavar{fromemail}\\ \end{tabular}% \ifkomavarempty{frombank}{}{% \hfill \begin{tabular}[t]{l@{}}% \usekomavar{frombank} \end{tabular}% }% }%
然后你需要定义
nextfoot
如下内容:% nextfoot nexthead \setkomavar{nextfoot}{\hspace{-1.1cm}\parbox[b]{472pt}{\usekomavar{firstfoot}}}% <=======================
所有后续页面的页眉中均有徽标:要将线条和徽标添加到页眉,请调用类选项
headsepline=true,
并添加以下代码\pagestyle{myheadings} \markboth{}{\protect\includegraphics[scale=.3]{generic-logo-company}}
然后你会得到以下完整的 MWE:
\documentclass[%
fontsize=11pt,
parskip=half,%%
% fromalign=right,% right,locationright %% <============================
firsthead=true, % <===================================================
fromphone=on,%%
fromfax=on,%%
fromrule=aftername,%%
fromemail=on,%%
fromlogo=true,%%
foldmarks=false,%%
firstfoot=true,%%
subject=titled,%%
pagenumber=botright,%%
headsepline=true, % <=================================================
DIN
]{scrlttr2}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{url}
\usepackage{graphicx}
\usepackage{eurosym}
\usepackage{newcent}
\usepackage{lipsum}
\usepackage{selinput}
\SelectInputMappings{
adieresis={ä},
germandbls={ß},
Euro={€},
}
\setkomafont{fromname}{\scshape \LARGE}
\setkomafont{backaddress}{\mdseries}
\makeatletter
\@setplength{firstheadvpos}{7mm}
\@setplength{firstfootvpos}{265mm}%%
\makeatother
\setkomavar{firsthead}{\raggedleft % <==================================
\usekomavar{fromlogo}\\[+1cm]
\rule{\textwidth}{0.5pt}\\
\usekomavar{fromaddress}\\
\usekomavar{fromphone}\\
\usekomavar{fromfax}\\
\usekomavar{fromemail}\\% <===========================================
}
\begin{document}
\setkomavar{fromaddress}{
my surname name\\
my streetname 21\\
my example city}
\setkomavar{fromphone}{+99\,(9)999)\,999\,999\,99}
\setkomavar{fromphone}{+99\,(9)999)\,999\,999\,99}
\setkomavar{fromfax}{+99\,(9)999)\,999\,999\,99}
\setkomavar{fromemail}{[email protected]}
\setkomavar{backaddressseparator}{ - }
\setkomavar{place}{city}
\setkomavar{signature}{example signature}
\setkomavar{frombank}{IBAN: 9999\,9999\,9999\,9999\,9999\,99\\
BIC: 12341234ABDC\\
example example example\vspace{0.1cm}\\
example example example example\\
example example example, example example example}
\setkomavar{fromlogo}{\includegraphics[scale=.5]{generic-logo-company}\vspace{-1.3cm}}
\pagestyle{myheadings}
\markboth{}{\protect\includegraphics[scale=.3]{generic-logo-company}}
\setkomavar{firstfoot}{\footnotesize%
\rule[5pt]{472pt}{.3pt}\\
\begin{tabular}[t]{l@{}}%
\includegraphics[scale=.3]{generic-logo-company}\\[-5mm] % <==================
\usekomavar{fromname}\\
\usekomavar{fromaddress}\\
\end{tabular}%
\hfill
\begin{tabular}[t]{l@{}}%
\usekomavar{fromphone}\\
\usekomavar{fromfax}\\
\usekomavar{fromemail}\\
\end{tabular}%
\ifkomavarempty{frombank}{}{%
\hfill
\begin{tabular}[t]{l@{}}%
\usekomavar{frombank}
\end{tabular}%
}%
}%
% nextfoot nexthead
\setkomavar{nextfoot}{\hspace{-1.1cm}\parbox[b]{472pt}{\usekomavar{firstfoot}}}% <=======================
\renewcaptionname{ngerman}{\enclname}{Anlagen}
\begin{letter}{Mr.\\surname name\\office\\street name\\postal code and city}\vspace{0.3cm}
\setkomavar{subject}{subject: example example example example example
example example example example example example example example
example example example example example example example example
example example example}
\opening{Dear Mr. xxxxx xxxxxxxxxx,}
\lipsum[1-8]
\closing{Regards,}
\setkomavar*{enclseparator}{Enclosure(s)}
\encl{example enclosure}
\end{letter}
\end{document}
生成页面如下:
第 2 页:
顺便说一句:在德语字母中,行距Betrifft:
不再使用...
答案2
这是一个可能有帮助的开始。
对于上面的徽标,请使用
fromalign=locationright
而不是\fromalign=right
。我发现这需要在徽标本身之后添加一些垂直负空间,而我已将其插入 中fromlogo
。您还需要调整loc...
变量来定位此块。对于页脚中的徽标,只需在需要的位置使用适当的包含图形即可
对于右侧页眉中的徽标,选择页面样式
headings
和\markboth{}{logo code}
。对于此下的规则,将其添加headsepline=true
到类选项中。
这给出
\documentclass%%
[fontsize=11pt,
parskip=half,%%
fromalign=locationright,%%
fromphone=on,%%
fromfax=on,%%
fromrule=aftername,%%
fromemail=on,%%
fromlogo=true,%%
foldmarks=false,%%
firstfoot=true,%%
subject=titled,%%
pagenumber=botright,%%
headsepline=true
]{scrlttr2}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{url}
\usepackage{graphicx}
\usepackage{eurosym}
\usepackage{lipsum}
\usepackage{selinput}
\usepackage{newcent}
\usepackage{lipsum}
\SelectInputMappings{
adieresis={ä},
germandbls={ß},
Euro={€},
}
\setkomafont{fromname}{\scshape \LARGE}
\setkomafont{backaddress}{\mdseries}
\begin{document}
\makeatletter
\@setplength{locheight}{58mm}
\@setplength{locwidth}{50mm}
\@setplength{locvpos}{10mm}
\@setplength{toaddrvpos}{24mm}
\@setplength{firstfootvpos}{265mm}%%
\makeatother
\setkomavar{fromaddress}{%
my surname name\\
my streetname 21\\
my example city}
\setkomavar{fromphone}{+99\,(9)\,999\,999\,99}
\setkomavar{fromphone}{+99\,(9)\,999\,999\,99}
\setkomavar{fromfax}{+99\,(9)\,999\,999\,99}
\setkomavar{fromemail}{[email protected]}
\setkomavar{backaddressseparator}{ - }
\setkomavar{place}{city}
\setkomavar{signature}{example signature}
\setkomavar{frombank}{IBAN: 9999\,9999\,9999\,9999\,9999\,99\\
BIC: 12341234ABDC\\
example example example\vspace{0.1cm}\\
example example example example\\
example example example, example example example}
\setkomavar{fromlogo}{\includegraphics[scale=.2]{example-image-a}\vspace{-1cm}}
\pagestyle{myheadings}
\markboth{}{\protect\includegraphics[scale=.1]{example-image-a}}
\setkomavar{firstfoot}{\footnotesize%
\rule[5pt]{472pt}{.3pt}\\
\begin{tabular}[t]{l@{}}%
\includegraphics[scale=.05]{example-image-a}\\[-5mm]
\usekomavar{fromname}\\
\usekomavar{fromaddress}\\
\end{tabular}%
\hfill
\begin{tabular}[t]{l@{}}%
\usekomavar{fromphone}\\
\usekomavar{fromfax}\\
\usekomavar{fromemail}\\
\end{tabular}%
\ifkomavarempty{frombank}{}{%
\hfill
\begin{tabular}[t]{l@{}}%
\usekomavar{frombank}
\end{tabular}%
}%
}%
\renewcaptionname{ngerman}{\enclname}{Anlagen}
\begin{letter}{Mr.\\surname name\\office\\street name\\postal code and city}\vspace{0.3cm}
\setkomavar{subject}{subject: example example example example example example example example example example example example example example example example example example example example example example example example}
\opening{Dear Mr. xxxxx xxxxxxxxxx,}
\lipsum[1-4]
\closing{Regards,}
\setkomavar*{enclseparator}{Enclosure(s):}
\encl{example enclosure}
\end{letter}
\end{document}