我正在尝试写一份试卷註冊號写在右上角。但发生的事情是入学编号在每个页码的右上角都显示页码,而我希望它只出现在第一页。我尝试解决这个问题,但未能成功。
非常感谢
这是我的 Latex 代码
\documentclass[12pt]{article}
\usepackage{times}
\usepackage{amsthm,amsmath,amssymb,amsmath,amsfonts,graphicx,fancyhdr,algorithmic,longtable,listings,color,epsfig}
\usepackage{mathptmx}% times is deprecated
\usepackage[scaled=.90]{helvet}
\usepackage{courier}
\usepackage{epstopdf}
\usepackage{calligra}
\usepackage{csquotes}
\usepackage{xcolor}
\usepackage{color}
%\usepackage{geometry}
\usepackage{fancyhdr}
\usepackage{geometry}
\usepackage{background}
\usepackage{lipsum}
\SetBgContents{\textbf{Enrollment No}..........}
\SetBgColor{black}
\SetBgScale{1}
\SetBgAngle{0}
\SetBgPosition{current page.north east}
\SetBgHshift{-4cm}
\SetBgVshift{-2cm}
\DeclareMathAlphabet{\mathcalligra}{T1}{calligra}{m}{n}
\textheight 9.1 truein \hoffset -1.3cm \voffset -5mm \textwidth 6.7 truein
\evensidemargin 1cm
\def\demo{%
\par\topsep6pt plus6pt
\trivlist
\item[\hskip\labelsep\it Proof.]\ignorespaces}
\def\enddemo{\qed \endtrivlist}
\expandafter\let\csname enddemo*\endcsname=\enddemo
\def\qedsymbol{\ifmmode\bgroup\else$\bgroup\aftergroup$\fi
\vcenter{\hrule\hbox{\vrule
height.6em\kern.6em\vrule}\hrule}\egroup}
\def\qed{\ifmmode\else\unskip\nobreak\fi\quad\qedsymbol}
\newtheorem{Theorem}{Theorem}[section]
%\newtheorem{Proof}{Proof}[section]
\newtheorem{prop}{Proposition}[section]
\newtheorem{Definition}{Definition}[section]
\newtheorem{Proposition}{Proposition}[section]
\newtheorem{Lemma}{Lemma}[section]
\newtheorem{Corollary}{Corollary}
\newtheorem{Example}{Example}[section]
\newtheorem{Remark}{Remark}[section]
\newtheorem{Note}{Note}[section]
\newtheorem{tab}{Table}%[section]
\newcommand{\R} {\mbox {$ I\!\!R $}}
\newcommand{\bea}{\begin{eqnarray}}
\newcommand{\eea}{\end{eqnarray}}
\newcommand{\be}{\begin{equation}}
\newcommand{\ee}{\end{equation}}
\newcommand{\nn}{\nonumber}
\newcommand{\nii}{\noindent}
\newcommand{\bee}{\begin{eqnarray*}}
\newcommand{\eee}{\end{eqnarray*}}
\def\A{{\cal{A}}}
\def\B{{\cal{B}}}
\def\C{{\cal{C}}}
\def\R{{\cal{R}}}
\def\Q{{\cal{Q}}}
\def\N{{\cal{N}}}
\def\P{{\cal{P}}}
\font\bigbf=cmbx12 \font\ssr=cmss8 \font\sst=cmtt8 \font\tt=cmtt10
\font\ssb=cmbx8 \font\srm=cmr8 \font\ssi=cmti8 \font\sar=cmss12
\font\srs=cmr6
\newcommand{\ra}[1]{\mathrm{rank}\left({#1}\right)} % rank
\newcommand{\ind}[1]{\mathrm{ind}({#1})} % index
\newcommand{\cond}[1]{\mathrm{cond}({#1})} % condition number
\newcommand{\tr}[1]{\mathrm{Tr}({#1})} % trag
\newcommand{\oo}[1]{{\overline{\overline{#1}}}}
\newcommand{\ov}[1]{{\overline{#1}}}
\newcommand{\e}{\mathcal{E}}
\newcommand{\Eff}{\mathrm{Eff}}
\newcommand{\Ind}{\mathrm{Ind}}
\newcommand{\Sp}{\mathrm{Sp}}
\newcommand{\Ef}{\mathrm{Ef}}
%\newcommand{\dim}{\mathrm{dim}}
\newcommand{\ef}{\mathrm{ef}}
\newcommand{\col}{\mathrm{col}}
\newcommand{\row}{\mathrm{row}}
\renewcommand{\O}{\mathcal{O}}
\renewcommand{\widehat}[1]{#1}
\def\Re{\,{\rm{Re}}\,}
\def\Im{\,{\rm{Im}}\,}
\pagenumbering{gobble}
\font\bigbf=cmbx12 \font\ssr=cmss8 \font\ssv=cmss10 \font\sst=cmtt8
\font\ssb=cmbx8 \font\srm=cmr8 \font\ssi=cmti8 \font\bigbf=cmbx12
\font\ssr=cmss8 \font\ssv=cmss10 \font\sst=cmtt8 \font\ssb=cmbx8
\font\srm=cmr8 \font\ssi=cmti8
\renewcommand{\theequation}{\thesection.\arabic{equation}}
\begin{document}
\begin{center}
\large{\textbf{Any university\\End Semester Examination, December 2016\\ M.Sc. \\MAT - Analysis}}
\end{center}
\begin{tabular}{p{11cm}r}
\textbf{Max. Marks: 100} & \textbf{Duration:3 hours}
\end{tabular}\\
\begin{center}
{\textbf{Part A}\\ Answer all questions. Each question carries $6$ marks. }
\end{center}
\begin{enumerate}
\item Some questions.
\begin{center}
{\textbf{Part B}\\ Answer all questions. Each question carries $8$ marks. }
\end{center}
\item Questions
\end{enumerate}
\begin{center}
\text{End}\end{center}
\end{document}
答案1
请在第一页中使用\usepackage[pages=some,placement=top]{background}
或\usepackage[some,top]{background}
选项与背景包和\BgThispage
选项,如下所示获得所需的输出:
\documentclass[12pt]{article}
\usepackage{times,lipsum}
\usepackage{amsthm,amsmath,amssymb,amsfonts,graphicx,fancyhdr,algorithmic,longtable,listings,color,epsfig}
\usepackage{mathptmx}% times is deprecated
\usepackage[scaled=.90]{helvet}
\usepackage{courier}
\usepackage{epstopdf}
\usepackage{calligra}
\usepackage{csquotes}
\usepackage{xcolor}
\usepackage{color}
%\usepackage{geometry}
\usepackage{fancyhdr}
\usepackage{geometry}
\usepackage[pages=some,placement=top]{background}
\SetBgContents{\textbf{Enrollment No}..........}
\SetBgColor{black}
\SetBgScale{1}
\SetBgAngle{0}
\SetBgPosition{current page.north east}
\SetBgHshift{-4cm}
\SetBgVshift{-2cm}
\begin{document}
\BgThispage
\begin{center}
\large{\textbf{Any university\\End Semester Examination, December 2016\\ M.Sc. \\MAT - Analysis}}
\end{center}
\begin{tabular}{p{11cm}r}
\textbf{Max. Marks: 100} & \textbf{Duration:3 hours}
\end{tabular}\\
\begin{center}
{\textbf{Part A}\\ Answer all questions. Each question carries $6$ marks. }
\end{center}
\begin{enumerate}
\item Some questions.
\begin{center}
{\textbf{Part B}\\ Answer all questions. Each question carries $8$ marks. }
\end{center}
\item Questions
\end{enumerate}
\begin{center}
\text{End}\end{center}
\lipsum[1-7]
\end{document}
输出: