對不包含章節的章節進行排版 fancyhdr 時出現問題

對不包含章節的章節進行排版 fancyhdr 時出現問題

我正在撰寫論文報告,並使用當前部分在每一頁上\uppercase進行設定\lhead(單面列印)。目前章節不用於標題。

我有一章沒有章節,跨越兩頁,我希望目前章節名稱為\lheadin \uppercase。 Latex 在章節的第二頁正確排版當前章節,但大小寫較小。如何將此處的章節名稱更正為大寫?

這是一些重現該現象的程式碼。所以我希望第 4 頁的標題是“2. 發展現狀「。我已閱讀 fancyhdr 包文檔,但發現很難理解標記是如何生成的。

\documentclass[a4paper,12pt]{report}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{}{\thechapter. \ #1}}
\lhead{\uppercase{\slshape \rightmark}}

\usepackage{blindtext}

\begin{document}
    \chapter{Introduction}
    \blindtext[2]
    \section{Goals}
    \blindtext[2]
    \section{Approach}
    \blindtext
    \chapter{Development Status}
    \blindtext[4]
\end{document}

先感謝您 :)

答案1

你應該使用\MakeUppercase.

\documentclass[a4paper,12pt]{report}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{}{\thechapter. \ #1}}
\lhead{\MakeUppercase{\slshape \rightmark}}

\setlength{\headheight}{14.5pt}


\usepackage{blindtext}

\begin{document}
    \chapter{Introduction}
    \blindtext[2]
    \section{Goals}
    \blindtext[2]
    \section{Approach}
    \blindtext
    \chapter{Development Status}
    \blindtext[4]
\end{document}

我還添加了所需的設定\headheight

在此輸入影像描述

相關內容