Elsarticle模板摘要分页失效及首页页眉页脚缺失问题求助
解决elsarticle模板的两个问题:frontmatter分页与首页页眉页脚显示
一、实现frontmatter内的分页
elsarticle模板默认会将frontmatter内的标题、作者、摘要等内容锁定在同一页,直接使用\newpage无效。解决步骤如下:
修改frontmatter环境定义,允许内部分页:
在导言区的\makeatletter和\makeatother块中添加以下代码:\renewenvironment{frontmatter}{% \clearpage \def\baselinestretch{1}% \@resetnewpage% \pagestyle{pprintTitle}% }{% \clearpage }在摘要中插入强制分页命令:
在不同语言的摘要段落之间添加\clearpage,示例:\medskip \noindent \textbf{Resumen} \lipsum[3-5] \clearpage % 此处强制分页 \medskip \noindent \textbf{Resumo} \lipsum[3-5]
二、修复首页页眉页脚显示
你自定义了firstpagestyle但首页未生效,是因为elsarticle默认对frontmatter使用pprintTitle页面样式。修改\ps@pprintTitle的定义,让它直接调用你的自定义样式:
\makeatletter \def\ps@pprintTitle{% \pagestyle{firstpagestyle}% 替换为自定义首页样式 } \makeatother
修改后首页会自动应用你定义的页眉页脚,无需在frontmatter后额外添加\thispagestyle{firstpagestyle}。
修改后的完整代码示例
\documentclass[final,5p,times,twocolumn,authoryear]{elsarticle} \usepackage{amssymb} \usepackage{lipsum} \usepackage{graphicx} \usepackage{fontawesome5} \usepackage{fancyhdr} \fancyhf{} \fancyhead{} \pagestyle{fancy} \lhead{Latin American Neurointensive Care Journal} \setlength{\footskip}{2cm} \fancyfoot[R]{Merenciano} \fancypagestyle{firstpagestyle}{ \fancyhf{} \fancyhead[L]{Latin American Neurointensive Care Journal} \fancyhead[R]{Merenciano A.} \fancyfoot[R]{Merenciano} \renewcommand{\headrulewidth}{0.5pt} % 页眉水平线 \renewcommand{\footrulewidth}{0.5pt} % 页脚水平线 } \makeatletter % 修改pprintTitle样式,应用自定义首页样式 \def\ps@pprintTitle{% \pagestyle{firstpagestyle}% } % 重新定义frontmatter环境,允许内部分页 \renewenvironment{frontmatter}{% \clearpage \def\baselinestretch{1}% \@resetnewpage% \pagestyle{pprintTitle}% }{% \clearpage } \makeatother \newcommand{\kms}{km\,s$^{-1}$} \begin{document} \begin{frontmatter} \title{Thoracic spine fracture secondary to anterior mediastinal yolk sac germ cell tumor: A case report and a brief review \\ Fractura de columna torácica secundaria a tumor de células germinativas del saco vitelino del mediastino anterior: reporte de un caso y breve revisión\\ Fratura de coluna torácica secundária a tumor de células germinativas do saco vitelino do mediastino anterior: relato de caso e breve revisão} \author[1]{Ana Carolina Merenciano Sundfeld Pereira} \author[2]{Carolina Mulet Reitor} \author[1]{José Victor Ribeiro Silva Gomes} \author[2]{Letícia Pinto Andrigheto} \author[3]{Leonardo Jardim Vaz de Mello} \author[4]{Ludmila Leite Sant`Anna Vaz de Mello} \affiliation[1]{ organization={Universidade Federal de São João DelRei (UFSJ) Campus Dom Bosco}, addressline={}, city={São João del-Rei}, postcode={}, state={}, country={Brazil}} \affiliation[2]{ organization={Centro Universitário de Valença (UNIFAA)}, city={Valença}, country={Brazil} } \affiliation[3]{ organization={profesor of Universidade Federal de Sao Joao Del Rei(UFSJ)}, city={Sao Joao del Rei}, country={Brazil} } \affiliation[4]{ organization={Plastic Surgeon of Santa Casa da Misericordia}, city={Sao Joao del Rei}, country={Brazil} } \abstracttitle{} \begin{abstract} \noindent \textbf{Abstract} \lipsum[3-5] \medskip \noindent \textbf{Resumen} \lipsum[3-5] \clearpage % 强制分页 \medskip \noindent \textbf{Resumo} \lipsum[3-5] \end{abstract} \begin{keyword} Nonseminomatous \sep germ cell tumors \sep mediastinal tumor \sep yolk sac tumor \sep vertebral fracture \end{keyword} \end{frontmatter} \end{document}
内容的提问来源于stack exchange,提问作者JuanpisGonzález
相关产品推荐
相关产品推荐

