当我尝试创建自定义标题页时,由于要放置图像,因此必须调整页眉高度。普通页面的页眉中也会有相同的图像,但图像略小,因此我必须调整页面设置两次。此外,页脚必须有三行高。
因此我必须使用花式高清和几何学但是 fancyhdr 似乎在尺寸上玩了些花招……
第一页和第二页的页脚未对齐(分别太低和太高),所有后续页面似乎都正常。
\documentclass[11pt,a4paper]{scrartcl}
\usepackage{lipsum} %filler text
\usepackage[showframe]{geometry}
\usepackage{fancyhdr}
\fancypagestyle{maintext}
{
\lfoot{\small \textbf{address 1}\\address 2\\address 3}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
\pagestyle{maintext}
\begin{document}
\begin{titlepage}
\thispagestyle{maintext}
\voffset -54pt
\headheight 100pt
\headsep 54pt
\textheight 545pt
%summe=645
\huge \textbf{\uppercase{TITLE}}
\end{titlepage}
\voffset -49pt
\headheight 60pt
\headsep 25pt
\textheight 609pt
%summe=645
\lipsum[1-12]
\end{document}
答案1
此外这里有一个建议使用scrlayer-scrheadings
:
\documentclass[%
footheight=36pt% suggested by scrlayer-scrpage
]{scrartcl}
\usepackage{graphicx}
\newlength\logoheight
\usepackage{lipsum} %filler text
\usepackage[
showframe,
top=128pt,
height=609pt,
headheight=65pt,
headsep=20pt
]{geometry}
\usepackage{scrlayer-scrpage}
\chead{%
\setlength\logoheight{\dimexpr\headheight-5pt}%
\includegraphics[height=\logoheight]{example-image.pdf}%
}
\ifoot{\textbf{address 1}\\address 2\\address 3}
\setkomafont{pagefoot}{\normalfont\small}
\begin{document}
\begin{titlepage}
\thispagestyle{scrheadings}
\newgeometry{
top=192pt,
height =545pt,
headheight=105pt,
headsep=49pt
}
\noindent\huge \textbf{\uppercase{TITLE}}
\end{titlepage}
\restoregeometry
\lipsum[1-12]
\end{document}
如果页码应按照其他示例的方式对齐,请删除 [t]footheight=36pt[/t] 并将 [t]\ifoot[/t] 更改为
\ifoot{\smash{%
\parbox[t]{\linewidth}{\textbf{address 1}\\address 2\\address 3}}}
当然也可以定义新的页面样式
\documentclass[%
footheight=36pt% suggested by scrlayer-scrpage
]{scrartcl}
\usepackage{graphicx}
\newlength\logoheight
\usepackage{lipsum} %filler text
\usepackage[
showframe,
top=128pt,
height=609pt,
headheight=65pt,
headsep=20pt
]{geometry}
\usepackage{scrlayer-scrpage}
\chead{\includegraphics[height=60pt]{example-image.pdf}}
\ifoot*{\textbf{address 1}\\address 2\\address 3}
\setkomafont{pagefoot}{\normalfont\small}
\newpairofpagestyles[scrheadings]{titlepage}{
\ihead{\includegraphics[height=100pt]{example-image.pdf}}
\chead{}
}
\begin{document}
\begin{titlepage}
\thispagestyle{titlepage}
\newgeometry{
top=192pt,
height =545pt,
headheight=105pt,
headsep=49pt
}
\noindent\huge \textbf{\uppercase{TITLE}}
\end{titlepage}
\restoregeometry
\lipsum[1-12]
\end{document}
答案2
您有\newgeometry
和restoregeometry
命令,但您必须计算topmargin
密钥。titleps
包(来自titlesec
包)比这种情况更好用fancyhdr
。这是一个简单的代码。带有 fancyhdr 的 pagestyles 定义是注释。要尝试 fancyhdr 解决方案,请取消注释相应的行,并使用注释pagestyle
:
\documentclass[11pt,a4paper]{scrartcl}
\usepackage{lipsum} %filler text
\usepackage{array, graphicx}
\usepackage[showframe]{geometry}
\geometry{top=128pt, height=609pt, headheight=60pt, headsep=25pt}
%\usepackage{fancyhdr}
%\fancypagestyle{maintext}
%{
%\lfoot{\small \textbf{address 1}\\address 2\\address 3}
%\renewcommand{\headrulewidth}{0pt}
%\renewcommand{\footrulewidth}{0pt}
%}
%
%\fancypagestyle{titlepage}
%{
%\chead{\includegraphics[height=100pt]{Piero_di_Cosimo_1}}
%\lfoot{\small \textbf{address 1}\\address 2\\address 3}
%\renewcommand{\headrulewidth}{0pt}
%\renewcommand{\footrulewidth}{0pt}
%}
\usepackage{titleps}
\newpagestyle{titlepage}{%
\sethead{}{\includegraphics[height=100pt]{Piero_di_Cosimo_1}}{}
\setfoot{\small\begin{tabular}[t]{@{}l} \textbf{address 1}\\address 2\\address 3\end{tabular}}{}{}
}%
\newpagestyle{maintext}{%
\setfoot{\small \begin{tabular}[t]{@{}l}\textbf{address 1}\\address 2\\address 3\end{tabular}}{}{}
}%
\pagestyle{maintext}
\begin{document}
\begin{titlepage}
\thispagestyle{titlepage}
\newgeometry{top=192pt, height =545pt, headheight=100pt, headsep=54pt}
\huge \textbf{\uppercase{TITLE}}
\end{titlepage}
\restoregeometry
\lipsum[1-12]
\end{document}
Fancyhdr解决方案:
Titleps 解决方案:
答案3
如果要在标题页上放置图形,则无需更改页面几何形状和/或更改页眉尺寸。您只需使用 0pt 高度/宽度picture
环境来定位图形,然后定位标题的其余部分,例如(代码借自伯纳德):
\documentclass[11pt,a4paper]{scrartcl}
\usepackage{lipsum} %filler text
\usepackage{array, graphicx}
\usepackage[showframe]{geometry}
\geometry{top=128pt, height=609pt, headsep=25pt}
\usepackage{titleps}
\newpagestyle{maintext}{%
\setfoot{%
\small
\begin{tabular}[t]{@{}l}
\textbf{address 1}\\ address 2\\ address 3
\end{tabular}}
{}
{{\includegraphics[width=7mm,keepaspectratio]{example-image-1x1}}}
}%
\pagestyle{maintext}
\begin{document}
\begin{titlepage}
\begin{center}
\setlength{\unitlength}{1mm}%
\begin{picture}(0,0)
\put(0,8){%
\makebox(0,0)[b]{%
\includegraphics[width=20mm,keepaspectratio]{example-image-1x1}%
}%
}%
\end{picture}
\end{center}
\vspace*{2em}
\huge \textbf{TITLE}
\end{titlepage}
\lipsum[1-12]
\end{document}