我正在使用此模板,并希望使页眉仅出现在第一页。此外,如何使其他页面的正文距顶部 1 英寸?
代码:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%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}
答案1
代替
\pagestyle{fancy}
和
\AtBeginDocument{
\thispagestyle{fancy}% First page
\pagestyle{empty}% Other pages
}
您可以根据需要更改与“其他页面”关联的页面。
答案2
@cfr 的解决方案的改编——我怎样才能只在第一页放页眉,而其余的则不放?我不想要封面。使用下面的代码,页眉会出现在每一页上
\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}