我该如何修复它?
以下是代码:
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[top=1cm,left=1.5cm,bottom=2cm,right=1.5cm,headsep=0.3cm]{geometry}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{amsfonts,amssymb,amsmath}
\usepackage{xcolor}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{pbox}
\usepackage{lipsum}
\renewcommand{\headrulewidth}{1.2pt}% linha no header
\renewcommand{\footrulewidth}{1.2pt} % linha no footer
\lfoot{\tt Prof. Lucas}
\cfoot{\LaTeX}
\rfoot{\tt \today}
\fancypagestyle{firststyle}
{
\lhead{
\def\sc{0.6}
\def\rc{\sc*0.1cm} % rc = 10% de sc
\begin{tikzpicture}[scale=\sc]
\definecolor{tempcolor}{RGB}{50,160,65}
\filldraw[tempcolor][rounded corners=\rc] (0cm,0cm) rectangle (1.2cm,1cm);
\end{tikzpicture}
}
\rhead{\tikz \node at (0,0) { \textbf{2ª Prova de Física - 2º Semestre}};\\
\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}
\cfoot{\LaTeX}
\rfoot{\tt \today}
}
\setlength{\headsep}{\dimexpr\headsep+1.2\baselineskip+.4pt}
\begin{document}
\thispagestyle{firststyle}
\begin{multicols}{2}
\lipsum[3-20]
\end{multicols}
\end{document}
答案1
使用
\usepackage[top=5mm,includehead,headheight=45pt,
left=1.5cm,bottom=2cm,right=1.5cm,headsep=0.3cm]{geometry}
答案2
您的文档产生警告
Package Fancyhdr Warning: \headheight is too small (12.0pt):
Make it at least 44.28043pt.
We now make it that large for the rest of the document.
This may cause the page layout to be inconsistent, however.
所以添加
\setlength\headheight{45pt}
序言会让事情看起来更好。