如何避免文本溢出底部边距以下?

如何避免文本溢出底部边距以下?

我的文档包含一个标题页,后面跟着一些文本。为了创建标题页,我必须使用 更改标题页上的页边距\newgeometry,标题页之后,我使用 恢复到通常的默认页边距\restoregeometry。它包含图形,使用 Tikz,并使用一个名为 的新环境,changemargin其代码位于 之前的代码开头\begin{document}

梅威瑟:

\documentclass[10pt, a4paper, titlepage, draft]{article}
% USING DRAFT BECAUSE WE DO NOT HAVE THE PDFs TO BE INCLUDED
\usepackage{geometry}
\usepackage{tikz}
\usepackage{graphicx}

\usetikzlibrary{calc}% ADDED !!!!!

\newenvironment{changemargin}[2]{%
\begin{list}{}{%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
}%
\item[]}
{\end{list}}

\begin{document}

\begin{titlepage}

\newgeometry{left=6.75cm, right=1.25cm, top=1.25cm, bottom=1.25cm}

\mbox{}\hfill
\begin{minipage}[c]{8cm} 
\flushright \textbf{University of ...}
\end{minipage}%
\hspace{0.5cm} % your specified distance
\begin{minipage}[c]{2.5cm}
\flushright \includegraphics[width=2.50cm]{logo.pdf}
\end{minipage}%

\begin{tikzpicture}[overlay, remember picture]

\useasboundingbox [fill=blue!20] ($ (current page.south west) + (1, 1)  $) rectangle ($ (current page.north west) + (6.75, -1) $) ;
\draw [line width=0.01mm, blue] ($ (current page.north west) + (1, -1)  $) rectangle ($ (current page.south east) + (-1, 1) $) ; 
\draw ($ (current page.north west) + (9.625, -4.00)  $) -- ($ (current page.north east) + (-1.25, -4.00)  $) ;
\draw ($ (current page.south west) + (9.625, 4.00)  $) -- ($ (current page.south east) + (-1.25, 4.00)  $) ;

\node[anchor=south west, %anchor is upper left corner of the graphic
xshift=1.125cm, %shifting around
yshift=1.125cm]  
at (current page.south west) %left upper corner of the page
{\includegraphics[width=5.25cm]{logo2.pdf}}; 

\end{tikzpicture}

\begin{changemargin}{0cm}{-0.25cm}

\centering

\vspace*{\baselineskip}
\vspace*{\baselineskip}

\rule{127mm}{1.6pt}\vspace*{-\baselineskip}\vspace*{2pt}    
\rule{127mm}{0.4pt}\\[\baselineskip]
\vspace*{\baselineskip}
{\large \textbf{Title}}\\[\baselineskip]
{ Subtitle}\\[0.2\baselineskip]
\rule{127mm}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt}
\rule{127mm}{1.6pt}\\[\baselineskip]
\vspace*{\baselineskip}

\end{changemargin}

\mbox{} \vfill \hfill
\begin{minipage}[c]{8cm}
\flushright \textbf{Faculty of Science}
\end{minipage}%
\hspace{0.5cm} % your specified distance
\begin{minipage}[c]{2.5cm}
\flushright \includegraphics[width=2.50cm]{logo3.pdf}
\end{minipage}%

\restoregeometry

\end{titlepage}

\newpage

article text

\end{document}

但是,第一页上的文本溢出到了文档的下边缘。其他页面都不会发生这种情况,只有第一页才会发生这种情况。

我做错了什么?

(我知道我的问题与这个类似:

设置几何图形 \AtBeginDocument 时边距溢出

但那里给出的答案并不能解决我的问题。)

答案1

\newgeometry影响以下页面,因此将其移动到 \begin{titlepage}将确保它影响标题页。

而且由于您可能希望标题页之后的页面具有原始几何形状,因此移动\restoregeometry到之后\end{ttilepage}和之前\newpage将使其在文档的第一页上生效。

笔记:

代码:

\documentclass[10pt, a4paper, titlepage, draft]{article}
% USING DRAFT BECAUSE WE DO NOT HAVE THE PDFs TO BE INCLUDED
\usepackage{geometry}
\usepackage{tikz}
\usepackage{graphicx}

\usetikzlibrary{calc}% ADDED !!!!!
\usepackage{showframe}% ADDED !!!!!
\usepackage{lipsum}% ADDED !!!!!

\newenvironment{changemargin}[2]{%
\begin{list}{}{%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
}%
\item[]}
{\end{list}}

\begin{document}
\newgeometry{left=6.75cm, right=1.25cm, top=1.25cm, bottom=1.25cm}
\begin{titlepage}

%\newgeometry{left=6.75cm, right=1.25cm, top=1.25cm, bottom=1.25cm}

\mbox{}\hfill
\begin{minipage}[c]{8cm} 
\flushright \textbf{University of ...}
\end{minipage}%
\hspace{0.5cm} % your specified distance
\begin{minipage}[c]{2.5cm}
\flushright \includegraphics[width=2.50cm]{logo.pdf}
\end{minipage}%

\begin{tikzpicture}[overlay, remember picture]

\useasboundingbox [fill=blue!20] ($ (current page.south west) + (1, 1)  $) rectangle ($ (current page.north west) + (6.75, -1) $) ;
\draw [line width=0.01mm, blue] ($ (current page.north west) + (1, -1)  $) rectangle ($ (current page.south east) + (-1, 1) $) ; 
\draw ($ (current page.north west) + (9.625, -4.00)  $) -- ($ (current page.north east) + (-1.25, -4.00)  $) ;
\draw ($ (current page.south west) + (9.625, 4.00)  $) -- ($ (current page.south east) + (-1.25, 4.00)  $) ;

\node[anchor=south west, %anchor is upper left corner of the graphic
xshift=1.125cm, %shifting around
yshift=1.125cm]  
at (current page.south west) %left upper corner of the page
{\includegraphics[width=5.25cm]{logo2.pdf}}; 

\end{tikzpicture}

\begin{changemargin}{0cm}{-0.25cm}

\centering

\vspace*{\baselineskip}
\vspace*{\baselineskip}

\rule{127mm}{1.6pt}\vspace*{-\baselineskip}\vspace*{2pt}    
\rule{127mm}{0.4pt}\\[\baselineskip]
\vspace*{\baselineskip}
{\large \textbf{Title}}\\[\baselineskip]
{ Subtitle}\\[0.2\baselineskip]
\rule{127mm}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt}
\rule{127mm}{1.6pt}\\[\baselineskip]
\vspace*{\baselineskip}

\end{changemargin}

\mbox{} \vfill \hfill
\begin{minipage}[c]{8cm}
\flushright \textbf{Faculty of Science}
\end{minipage}%
\hspace{0.5cm} % your specified distance
\begin{minipage}[c]{2.5cm}
\flushright \includegraphics[width=2.50cm]{logo3.pdf}
\end{minipage}%

\end{titlepage}

\restoregeometry
\newpage

\lipsum[1-12]% Added

\end{document}

相关内容