如何减少除第一页之外的其他页面上页面顶部和标题规则之间的空白?

如何减少除第一页之外的其他页面上页面顶部和标题规则之间的空白?

参见下图:

在此处输入图片描述

以下是代码:

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[top=6mm,includehead,headheight=60pt, left=1.5cm,bottom=2cm,right=1.5cm,headsep=0.5cm]{geometry}
\usepackage{tikz}
\usepackage{float} 
\usepackage{multicol} 
\usepackage{xcolor}
\usepackage{fancyhdr} 
\pagestyle{fancy} 
\usepackage{pbox}
\usepackage{lipsum}

\renewcommand{\headrulewidth}{1.2pt}% linha no header 
\renewcommand{\footrulewidth}{1.2pt} % linha no footer

\setlength{\headsep}{\dimexpr\headsep+1.2\baselineskip+.4pt}

\makeatletter
\def\headrule{{
  \if@fancyplain\let\headrulewidth\plainheadrulewidth\fi
  \vskip10pt% change here
  \hrule\@height\headrulewidth\@width\headwidth   
  \vskip-\headrulewidth%
}}
\makeatother


 \lfoot{\tt \today}
 \rfoot{\tt 14 de dezembro de 2018}


\fancypagestyle{firststyle}
{
\lhead{
\def\sc{0.6}
\def\rc{\sc*0.1cm} % rc = 10% de sc
\begin{tikzpicture}[scale=\sc]
\definecolor{tempcolor}{RGB}{200,25,30}
\filldraw[tempcolor][rounded corners=\rc] (2cm,0cm) rectangle (1.2cm,-0.5cm);
\filldraw[tempcolor][rounded corners=\rc] (2cm,-0.6cm) rectangle (1.1cm,-1.1cm);
\filldraw[tempcolor][rounded corners=\rc] (2cm,-0.6cm) rectangle (1.5cm,-1.1cm);
\filldraw[tempcolor][rounded corners=\rc] (1.7cm,-1.2cm) rectangle (1.2cm,-1.7cm);
\filldraw[tempcolor][rounded corners=\rc] (0.6cm,-1.2cm) rectangle (1.1cm,-1.7cm);
\filldraw[tempcolor][rounded corners=\rc] (1.6cm,-1.2cm) rectangle (1.8cm,-1.7cm);
\filldraw[tempcolor][rounded corners=\rc] (1.7cm,-1.8cm) rectangle (1.2cm,-2.3cm);
\node[scale=\sc,fill=white] at (5.92,-0.85) {\resizebox{6.7cm}{0.5cm}{\sf \textbf{ESCOLA}}};
\node[scale=\sc,fill=white] at (4.52,-1.55) {\resizebox{5cm}{0.5cm}{\sf {Construindo o Futuro}}};
\end{tikzpicture}
}     
\rhead{\tikz \node at (0,0) { \textbf{Prova de Física}};\\ 
\tikz[baseline]{\node[anchor=base, draw=black, thick, minimum width=8.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{\tt Aluno(a)}:}] { \phantom{\tt 15,0} };}   
\tikz[baseline]{\node[anchor=base, draw=black, thick, minimum width=2cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{\tt Turma}:}] {\phantom{\tt 15,0}};}   
\tikz[baseline]{\node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{\tt Valor}:}] { \tt 15,0};} 
\tikz[baseline]{\node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{\tt Nota}:}] {\phantom{\tt 15,0}};}
}
 \lfoot{\tt Prof. Lucas}
 \rfoot{\tt \today}
}

\begin{document}

\thispagestyle{firststyle}

\begin{multicols}{2} 

\lipsum[3-20]

\end{multicols}

\end{document}

有人能帮我吗?

答案1

设置页面布局以匹配文档的主体。即,对于第二页及以后的页面。然后设置第一页的页眉,并\vspace在开头添加一些内容,在multicols:之前

在此处输入图片描述

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[top=6mm,includehead,left=1.5cm,bottom=2cm,right=1.5cm,headsep=0.5cm]{geometry}
\usepackage{tikz}
\usepackage{multicol} 
\usepackage{xcolor}
\usepackage{fancyhdr} 
\usepackage{lipsum}

\renewcommand{\footrulewidth}{1.2pt} % linha no footer
\renewcommand{\headrulewidth}{1.2pt}% linha no header 

\lfoot{\ttfamily \today}
\rfoot{\ttfamily 14 de dezembro de 2018}

\pagestyle{fancy} 

\fancypagestyle{firststyle}{%
  \renewcommand{\headrulewidth}{0pt}% Remove header rule
  \lhead{%
    \def\scale{0.6}%
    \def\roundc{\scale*0.1cm}% rc = 10% de sc
    \raisebox{-2\baselineskip}[0pt][0pt]{\begin{tikzpicture}[scale=\scale]
      \definecolor{tempcolor}{RGB}{200,25,30}
      \filldraw[tempcolor][rounded corners=\roundc] (2cm,0cm) rectangle (1.2cm,-0.5cm);
      \filldraw[tempcolor][rounded corners=\roundc] (2cm,-0.6cm) rectangle (1.1cm,-1.1cm);
      \filldraw[tempcolor][rounded corners=\roundc] (2cm,-0.6cm) rectangle (1.5cm,-1.1cm);
      \filldraw[tempcolor][rounded corners=\roundc] (1.7cm,-1.2cm) rectangle (1.2cm,-1.7cm);
      \filldraw[tempcolor][rounded corners=\roundc] (0.6cm,-1.2cm) rectangle (1.1cm,-1.7cm);
      \filldraw[tempcolor][rounded corners=\roundc] (1.6cm,-1.2cm) rectangle (1.8cm,-1.7cm);
      \filldraw[tempcolor][rounded corners=\roundc] (1.7cm,-1.8cm) rectangle (1.2cm,-2.3cm);
      \node[scale=\scale,fill=white] at (5.92,-0.85) {\resizebox{6.7cm}{0.5cm}{\sffamily \textbf{ESCOLA}}};
      \node[scale=\scale,fill=white] at (4.52,-1.55) {\resizebox{5cm}{0.5cm}{\sffamily {Construindo o Futuro}}};
    \end{tikzpicture}}
  }
  \chead{\raisebox{-2\baselineskip}[0pt][0pt]{\rule[-2.5\baselineskip]{\linewidth}{1.2pt}}}
  \rhead{\raisebox{-2\baselineskip}[0pt][0pt]{\begin{tabular}{@{}r@{}}
    \tikz \node at (0,0) {\textbf{Prova de Física}};\\ 
    \tikz[baseline]{\node[anchor=base, draw=black, thick, minimum width=8.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{\ttfamily Aluno(a)}:}] {\phantom{\ttfamily 15,0}};}   
    \tikz[baseline]{\node[anchor=base, draw=black, thick, minimum width=2cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{\ttfamily Turma}:}] {\phantom{\ttfamily 15,0}};}   
    \tikz[baseline]{\node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{\ttfamily Valor}:}] {\ttfamily 15,0};} 
    \tikz[baseline]{\node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{\ttfamily Nota}:}] {\phantom{\ttfamily 15,0}};}
    \end{tabular}}
  }
  \lfoot{\ttfamily Prof. Lucas}
  \rfoot{\ttfamily \today}
}

\AtBeginDocument{
  \thispagestyle{firststyle}
  \vspace*{2\baselineskip}
}

\begin{document}

\begin{multicols}{2} 

\sloppy\lipsum[3-30]

\end{multicols}

\end{document}

为了避免第一页的页眉与文档其余部分的页眉不匹配的问题,请设置\smash内容(和/或将其移动到位\raisebox{<len>}[0pt][0pt])。

相关内容