1

I am using this template and would like to make it so that the header is only on the first page. Additionally, how to make it so that the body of the text is 1 inch from the top for the other pages?

Code:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Do not alter this block of commands.  If you're proficient at LaTeX, you may include additional packages, create macros, etc. immediately below this block of commands, but make sure to NOT alter the header, margin, and comment settings here. 
\documentclass[12pt]{article}
 \usepackage[margin=1in]{geometry} 
\usepackage{amsmath,amsthm,amssymb,amsfonts, enumitem, fancyhdr, color, comment, graphicx, environ}
\pagestyle{fancy}
\setlength{\headheight}{65pt}
\newenvironment{problem}[2][Problem]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{sol}
    {\emph{Solution:}
    }
    {
    \qed
    }
\specialcomment{com}{ \color{blue} \textbf{Comment:} }{\color{black}} %for instructor comments while grading
\NewEnviron{probscore}{\marginpar{ \color{blue} \tiny Problem Score: \BODY \color{black} }}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%





%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Fill in the appropriate information below
\lhead{Student's name}  %replace with your name
\rhead{Math XYZ \\ Section XYZ \\ Semester XYZ} %replace XYZ with the homework course number, semester (e.g. ``Spring 2019"), and assignment number.
 \chead{\textbf{\Large Homework 0}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Do not alter this block.
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%Solutions to problems go below.  Please follow the guidelines from https://www.overleaf.com/read/sfbcjxcgsnsk/


%Copy the following block of text for each problem in the assignment.
\begin{problem}{x.y.z} 
Statement of problem goes here (write the problem exactly as it appears in the book).
\end{problem}
\begin{sol}
Write your solution here.
\end{sol}



%Copy the following block of text for each problem in the assignment.
\begin{problem}{x.y.z}
Statement of problem goes here (write the problem exactly as it appears in the book).
\end{problem}
\begin{sol}
Write your solution here.
\end{sol}





%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Do not alter anything below this line.
\end{document}
CarLaTeX
  • 62,716
Anon
  • 11

2 Answers2

1

Replace

\pagestyle{fancy}

with

\AtBeginDocument{
  \thispagestyle{fancy}% First page
  \pagestyle{empty}% Other pages
}

You can change the page associated with "other pages" however it suits your needs.

Werner
  • 603,163
0

An adaptation of the solution by @cfr-- How can I put header only in the first page and keep the rest without it? I don't want a cover. With the code below, the header appears on every page

enter image description here

\documentclass[12pt]{article}
 \usepackage[margin=1in]{geometry} 
\usepackage{amsmath,amsthm,amssymb,amsfonts, enumitem, fancyhdr, color, comment, graphicx, environ}
\usepackage{titling}
\usepackage{graphicx}
\pagestyle{fancy}
\setlength{\headheight}{65pt}
\newenvironment{problem}[2][Problem]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{sol}
    {\emph{Solution:}
    }
    {
    \qed
    }
\specialcomment{com}{ \color{blue} \textbf{Comment:} }{\color{black}} %for instructor comments while grading
\NewEnviron{probscore}{\marginpar{ \color{blue} \tiny Problem Score: \BODY \color{black} }}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand\maketitlehooka{%
  \setlength\parindent{0pt}%
  \begin{minipage}{\textwidth}
    \begin{minipage}{.3\textwidth}
    Student's name\par
    \end{minipage}%
    \begin{minipage}{.3\textwidth}
      \raggedleft
      \textbf{\Large Homework 0}
    \end{minipage}%
    \begin{minipage}{.3\textwidth}
      \raggedleft
      Math XYZ\par
      Section XYZ\par
      Semester XYZ\par
    \end{minipage}%
  \end{minipage}\vskip 2.5ex
  \par
  \hrule
}%
\title{}
\author{}
\date{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Fill in the appropriate information below
% \lhead{Student's name}  %replace with your name
% \rhead{Math XYZ \\ Section XYZ \\ Semester XYZ} %replace XYZ with the homework course number, semester (e.g. ``Spring 2019"), and assignment number.
%  \chead{\textbf{\Large Homework 0}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Do not alter this block.
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\maketitle
\vspace*{-2cm}% Insert needed vertical retraction

%Solutions to problems go below.  Please follow the guidelines from https://www.overleaf.com/read/sfbcjxcgsnsk/
%Copy the following block of text for each problem in the assignment.
\begin{problem}{x.y.z} 
Statement of problem goes here (write the problem exactly as it appears in the book).
\end{problem}
\begin{sol}
Write your solution here.
\end{sol}
%Copy the following block of text for each problem in the assignment.
\begin{problem}{x.y.z}
Statement of problem goes here (write the problem exactly as it appears in the book).
\end{problem}
\begin{sol}
Write your solution here.
\end{sol}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Do not alter anything below this line.
\end{document}
js bibra
  • 21,280