You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何让Overleaf简历模板仅首页显示fancyhdr生成的页眉?

解决方案

要实现仅第一页显示页眉、后续页面无页眉的效果,只需对_header.tex做两处关键修改:

  1. 保留原有的plain页面样式定义(这是第一页的页眉样式);
  2. 将全局页面样式设置从\pagestyle{plain}改为第一页用plain,后续页面用empty(无页眉页脚)。

修改后的完整代码如下:

\RequirePackage{fancyhdr}
    \fancypagestyle{plain}{%
    \fancyhf{}
    \lhead{
            
            \HUGE \skills \name \vspace{-.32em}
            \\ % feel free to adjust vspace to 0 
        {
                \color{highlight} \Large{\role}
            }
    } 
    \rhead{
            
            \city \\  % city 
            \phone \\ % PHONE    
            \href{mailto:\email}{\email} \\
            % \href{https://github.com/\github}{github.com/\github} \\\ Github
            \href{https://www.linkedin.com/in/\LinkedIn}{linkedin.com/in/\LinkedIn}
    } 
\renewcommand{\headrulewidth}{1pt}% 2pt header rule
\renewcommand{\headrule}{\hbox to\headwidth{%
  \color{highlight}\leaders\hrule height \headrulewidth\hfill}}
}
% 改动部分:替换原有的\pagestyle{plain}
\thispagestyle{plain} % 仅第一页应用带页眉的plain样式
\pagestyle{empty}     % 后续所有页面应用无页眉页脚的empty样式

\setlength{\headheight}{90pt}
\setlength{\headsep}{5pt}

关键说明

  • \thispagestyle{plain}:仅对当前(第一)页生效,保留你定义的姓名、联系方式等页眉内容;
  • \pagestyle{empty}:全局设置后续所有页面使用空样式,不会显示任何页眉页脚;
  • 原有的plain样式定义无需修改,它只负责第一页的页眉渲染。

如果后续页面需要保留页脚(比如页码)但去掉页眉,可以自定义一个新的页面样式,示例如下:

\fancypagestyle{noheader}{%
    \fancyhf{} % 清空所有页眉页脚
    \renewcommand{\headrulewidth}{0pt} % 去掉页眉线
    \cfoot{\thepage} % 添加居中页码(可选)
}
% 然后把\pagestyle{empty}换成\pagestyle{noheader}

内容的提问来源于stack exchange,提问作者Ashish96

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 23:25:13