平均能量损失

平均能量损失

我的页眉和页脚未出现在第一页上。我希望它们能出现。重复问题的解决方案不是对我来说很有效。这就是我决定发布问题的原因。一旦我知道原因,我会让这个板块更具信息性。

平均能量损失

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}
\usepackage[hidelinks]{hyperref} % hide the links
% For custom spacing
\usepackage{setspace}
\setstretch{1.2} 
% For the symbols
\usepackage{wasysym}
\usepackage{marvosym}
\usepackage[alpine]{ifsym}

\usepackage{fancyhdr}
 
\pagestyle{fancy}
\fancyhf{}
\lhead{
\Mundus\enspace \href{http://sites.google.com/site/}{http://sites.google.com/site/}
}
\rhead{
\MVAt\enspace \href{mailto:[email protected]}{[email protected]}
}
\cfoot{\thepage/2}

\usepackage{lipsum}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\newcommand{\Hrule}{\rule{\linewidth}{0.3mm}}

\makeatletter% since there's an at-sign (@) in the command name
\renewcommand{\@maketitle}{%
  \parindent=0pt% don't indent paragraphs in the title block
  \centering
  {\LARGE \bfseries\textsc{\@title}}
  \HRule\par%
  \textit{\@author \hfill \@date}
  \par
}
\makeatother% resets the meaning of the at-sign (@)

\title{Statement of Purpose}
\author{X}
\date{\today}

\begin{document}
  \maketitle% prints the title block
  \thispagestyle{empty}
  \vspace{12pt}

\lipsum
\end{document}

答案1

\maketitle将当前页面样式定义为plain。因此您必须定义plain页面样式。

\fancypagestyle{plain}{%
  \fancyhf{}
\lhead{
\Mundus\enspace \href{http://sites.google.com/site/}{http://sites.google.com/site/}
}
\rhead{
\MVAt\enspace \href{mailto:[email protected]}{[email protected]}
}
\cfoot{\thepage/2}
}

完整代码:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}
\usepackage[hidelinks]{hyperref} % hide the links
% For custom spacing
\usepackage{setspace}
\setstretch{1.2}
% For the symbols
\usepackage{wasysym}
\usepackage{marvosym}
\usepackage[alpine]{ifsym}

\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}
\lhead{
\Mundus\enspace \href{http://sites.google.com/site/}{http://sites.google.com/site/}
}
\rhead{
\MVAt\enspace \href{mailto:[email protected]}{[email protected]}
}
\cfoot{\thepage/2}

\fancypagestyle{plain}{%
  \fancyhf{}
\lhead{
\Mundus\enspace \href{http://sites.google.com/site/}{http://sites.google.com/site/}
}
\rhead{
\MVAt\enspace \href{mailto:[email protected]}{[email protected]}
}
\cfoot{\thepage/2}
}

\usepackage{lipsum}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\newcommand{\Hrule}{\rule{\linewidth}{0.3mm}}

\makeatletter% since there's an at-sign (@) in the command name
\renewcommand{\@maketitle}{%
  \parindent=0pt% don't indent paragraphs in the title block
  \centering
  {\LARGE \bfseries\textsc{\@title}}
  \HRule\par%
  \textit{\@author \hfill \@date}
  \par
}
\makeatother% resets the meaning of the at-sign (@)

\title{Statement of Purpose}
\author{X}
\date{\today}

\begin{document}
  \maketitle% prints the title block
  %\thispagestyle{empty}
  \vspace{12pt}

\lipsum
\end{document}

在此处输入图片描述

答案2

如果你想要相同的标题页上的页眉和页脚与其他页面一样,一个简单的解决方案是重新定义 -pagestyle,plain使其具有与文档其余部分使用的页面样式相同的内容(IE \pagestyle{fancy}).您可以使用 -command\let来执行此操作。

\let\ps@plain\ps@fancy

由于它包含 ,因此@您必须将其括在一\makeatletter\makeatother对中。您已经有了这样一对,您可以在其中重新定义-command,因此请在该代码的开头或结尾@\maketitle添加:\let

\makeatletter% since there's an at-sign (@) in the command name

\let\ps@plain\ps@fancy %% ---> change the headers and footer at the title-page

\renewcommand{\@maketitle}{%
  \parindent=0pt% don't indent paragraphs in the title block
  \centering
  {\LARGE \bfseries\textsc{\@title}}
  \HRule\par%
  \textit{\@author \hfill \@date}
  \par
}
\makeatother% resets the meaning of the at-sign (@)

相关内容