标题叠加在文本上

标题叠加在文本上

我的报告中的标题叠加在文本上。我尝试过改变 voffset 和标题高度,但没有得到满意的结果。

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{latexsym}
\usepackage{fullpage}
\usepackage{float}
\usepackage{indentfirst}
\usepackage[font=footnotesize,format=plain,labelfont=bf,up,textfont=it,up]{caption}
\usepackage{subfig}
\usepackage{booktabs}
\usepackage{appendix}
\usepackage{verbatim}
\usepackage{setspace}
\usepackage{rotating}
\usepackage{array}
\usepackage{multirow}
\usepackage{wrapfig}
\usepackage[parfill]{parskip}
\usepackage{pdfpages}
\usepackage{fancyhdr}


%to get para numbers in the margins

\usepackage{lipsum} % for dummy text
\usepackage{hyperref}

\newcounter{numpar}
\newcommand{\np}[1][]{%
  \par
  \refstepcounter{numpar}%
  \noindent
  \makebox[0pt][r]{%
    \makebox[0pt][l]{\textbf{\thenumpar}}%
    \qquad
  }%
  #1%
  \ignorespaces
}

%evidence counter
\newcounter{evidence}
\newcommand{\ev}{%
  \stepcounter{evidence}%
  \marginpar{\textbf{EV\theevidence}}%
}

\pagestyle{fancy}

\lhead{\begin{footnotesize}
Header line 1 \\Header line 2
\end{footnotesize}}

\rhead{\begin{footnotesize}
Header line 1\\Header line 2
\end{footnotesize}}

\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}


\begin{document}

\thispagestyle{empty}
\tableofcontents

\pagebreak
\pagenumbering{arabic}

\section{A Section}
\lipsum[1-20]
\end{document}

答案1

您可以使用geometry包并通过添加来调整headheight和分配headsep

\usepackage[a4paper,margin=1in,headheight=.4in,headsep=12pt,heightrounded]{geometry}

完整代码:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{latexsym}
%\usepackage{fullpage}
\usepackage{float}
\usepackage{indentfirst}
\usepackage[font=footnotesize,format=plain,labelfont=bf,up,textfont=it,up]{caption}
\usepackage{subfig}
\usepackage{booktabs}
\usepackage{appendix}
\usepackage{verbatim}
\usepackage{setspace}
\usepackage{rotating}
\usepackage{array}
\usepackage{multirow}
\usepackage{wrapfig}
\usepackage[parfill]{parskip}
\usepackage{pdfpages}
\usepackage{fancyhdr}
%% This line added ------------------------->
\usepackage[a4paper,margin=1in,headheight=.4in,headsep=12pt,heightrounded]{geometry}
%to get para numbers in the margins

\usepackage{lipsum} % for dummy text
\usepackage{hyperref}

\newcounter{numpar}
\newcommand{\np}[1][]{%
  \par
  \refstepcounter{numpar}%
  \noindent
  \makebox[0pt][r]{%
    \makebox[0pt][l]{\textbf{\thenumpar}}%
    \qquad
  }%
  #1%
  \ignorespaces
}

%evidence counter
\newcounter{evidence}
\newcommand{\ev}{%
  \stepcounter{evidence}%
  \marginpar{\textbf{EV\theevidence}}%
}

\pagestyle{fancy}

\lhead{\begin{footnotesize}
Header line 1 \\Header line 2%          %%<--- a spurious space is removed.
\end{footnotesize}}

\rhead{\begin{footnotesize}
Header line 1\\Header line 2%          %%<--- a spurious space is removed.
\end{footnotesize}}

\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}


\begin{document}

\thispagestyle{empty}
\tableofcontents

\pagebreak
\pagenumbering{arabic}

\section{A Section}
\lipsum[1-20]
\end{document}

在此处输入图片描述

相关内容