
在文章的第一頁上,我想創建一個比其他頁面高得多的標題。問題是,如果我使用下面的解決方案,第一頁會在底部溢出。我要怎麼解決這個問題?
\documentclass[11pt,a4paper]{article}
\usepackage{fancyhdr}
\usepackage{lipsum}
\pagestyle{fancy}
\fancypagestyle{plain}{%
\renewcommand{\headrulewidth}{3pt}%
\fancyhf{}%
\setlength{\headheight}{190pt}
\fancyhead[C]{
\hrule\hspace{0pt}\\
\vspace{3cm}
\hrule\hspace{0pt}\\
\vspace{3cm}
\hrule\hspace{0pt}\\
}
}
\begin{document}
\title{Lipsum ...}
\author{Me, Myself}
\date{}
\maketitle
\thispagestyle{plain}
\lipsum
\lipsum
\lipsum
\lipsum
\end{document}
答案1
我將使用零高度框(此處由圖像表示)作為第一頁和titling
包中的標題,以便向下移動標題。
\documentclass[11pt,a4paper]{article}
\usepackage{fancyhdr,graphicx}
\usepackage{titling}
\usepackage{lipsum}
\setlength{\headheight}{13.6pt}
\pagestyle{fancy}
\fancypagestyle{firstpage}{%
\renewcommand{\headrulewidth}{0pt}%
\fancyhf{}%
\fancyhead[C]{%
\raisebox{-\height}[0pt][0pt]{\includegraphics[width=\textwidth,height=6cm]{example-image}}%
}%
}
\pretitle{\vspace*{5cm}\begin{center}\LARGE}
\begin{document}
\title{Lipsum ...}
\author{Me, Myself}
\date{}
\maketitle
\thispagestyle{firstpage}
\lipsum
\lipsum
\lipsum
\lipsum
\end{document}
答案2
我建議將頁面樣式設定為覆蓋文件的大部分(第 2 頁以上),並將第一頁的頁首設定為主文檔的一部分,並根據需要將其移至適當的位置。這樣,文本仍會自然地從第 1-2 頁流動。
\documentclass{article}
\usepackage{fancyhdr,graphicx}
\usepackage{lipsum}
\pagestyle{fancy}% Main document page style
\title{A title}
\author{An author}
\date{}
\begin{document}
\thispagestyle{plain}% Page style of first page only
\vspace*{\dimexpr-\headheight-\headsep}%
\noindent
\includegraphics[width=\linewidth,height=7cm]{example-image}% Your first page header
{\let\newpage\relax % Avoid page break due to \maketitle
\maketitle}
\sloppy\lipsum[1-50]
\end{document}
第一頁「標題」向上移動\headsep+\headheight
,但可以調整以與後續頁面標題對齊,具體取決於第一頁「標題」的實際外觀。當然,您也可以為首頁定義不同的頁尾。
由於\maketitle
通常將標題設置在頁面頂部,因此它會發出\newpage
.為了避免這種情況(從而將第一頁“標題”與標題連接起來),我們暫時設置\newpage
為\relax
- 無操作...
答案3
您可以使用該geometry
套件來修改\textheight
第一頁的內容。geometry
有一個\newgeometry
命令,允許修改從\newgeometry
使用該命令到\restoregeometry
使用該命令的幾何形狀(邊距、文字的高度和寬度等)。請注意,該\restoregeometry
命令會觸發分頁符,因此應在最後一頁的末尾使用該命令\newgeometry
。
另外,我不確定plain
在這裡重新定義頁面樣式是否相關,因為可以定義另一種頁面樣式。這裡我定義了一個firstpage
樣式並將其用於第一頁,我還\textheight
使用\newgeometry
. 320pt 可能不是最佳值,可能可以調整得更精確。
\documentclass[11pt,a4paper]{article}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{geometry}
\pagestyle{fancy}
\setlength{\headheight}{13.6pt}
\fancypagestyle{firstpage}{%
\fancyhf{}%
\renewcommand{\headrulewidth}{3pt}%
\renewcommand{\headheight}{190pt}%
\fancyhead[C]{%
\hrule\hspace{0pt}\\[3cm]
\hrule\hspace{0pt}\\[3cm]
\hrule\hspace{0pt}\\
}
\fancyfoot[C]{\thepage}
}
\title{Lipsum ...}
\author{Me, Myself}
\date{}
\begin{document}
\newgeometry{textheight=320pt}
\maketitle
\thispagestyle{firstpage}
\lipsum*[13]
\lipsum*[2]
\restoregeometry
\lipsum*[3]
\lipsum*[4]
\end{document}