【发布时间】:2021-10-19 18:13:11
【问题描述】:
我在 LaTeX 中使用以下命令添加了页眉:
\pagestyle{fancy} \fancyhead[L]{\rightmark} \fancyhead[R]{\leftmark}
这是一个最小的可重现示例:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\title{Titlepage}
\date{October 2021}
\pagestyle{fancy} \fancyhead[L]{\rightmark} \fancyhead[R]{\leftmark}
\usepackage{graphicx}
\usepackage{titlesec}
\usepackage{lipsum} %just to generate text for the example
\newcommand*\HUGE{\Huge}
\newcommand*\chapnamefont{\normalfont\LARGE\MakeUppercase CHAPTER}
\newcommand*\chapnumfont{\normalfont\HUGE}
\newcommand*\chaptitlefont{\normalfont\HUGE\bfseries}
\newlength\beforechapskip
\newlength\midchapskip
\setlength\midchapskip{\paperwidth}
\addtolength\midchapskip{-\textwidth}
\addtolength\midchapskip{-\oddsidemargin}
\addtolength\midchapskip{-1in}
\setlength\beforechapskip{18mm}
\titleformat{\section}[display]
{\normalfont\filleft}
{{\chapnamefont}%
\makebox[0pt][l]{\hspace{.8em}%
\resizebox{!}{\beforechapskip}{\chapnumfont\thesection}%
\hspace{.8em}%
\rule{\midchapskip}{\beforechapskip}%
}%
}%
{25pt}
{\chaptitlefont}
\titlespacing*{\section}
{0pt}{40pt}{40pt}
\begin{document}
\maketitle
\newpage
blank page
\newpage
\section{Introduction}
the page header should not be visible here
\newpage
\subsection{Test2}
only the section should be visible in the page header (1 INTODUCTION)
\newpage
only the subsection should be visible in the page header (1.1 Test2)
\end{document}
使用此命令存在出现在所有页面上的问题,但对于我的论文,我想从该部分第一次出现的页面中删除它
下面是它当前的外观示例:
当该部分第一次出现时,它应该是这样的:
我还希望标题根据它在哪一侧(偶数或奇数)进行调整。例如,我希望仅在左侧页面上显示部分名称(偶数页),在右侧显示小节名称(奇数页):
【问题讨论】:
-
你能做一个可编译的minimal reproducible example吗?
-
嗨@samcarter_is_at_topanswers.xyz 是的,刚刚添加了一个:)