![從標題中刪除章節號--回憶錄類](https://rvso.com/image/286332/%E5%BE%9E%E6%A8%99%E9%A1%8C%E4%B8%AD%E5%88%AA%E9%99%A4%E7%AB%A0%E7%AF%80%E8%99%9F--%E5%9B%9E%E6%86%B6%E9%8C%84%E9%A1%9E.png)
我在memoir
課堂上使用 A6 進行工作。對於這種格式,我想從預設頁面標題樣式中刪除“章節”一詞memoir
以及章節號,以便標題中僅包含章節標題。刪除“chapter”一詞可以透過在後面添加以下內容來實現\begin{Document}
:
\renewcommand{\chaptername}{}
但章節號仍保留在頁首。我添加了這個命令:
\renewcommand\printchapternonum{}
但沒有效果。
從標題中刪除章節號碼的快速簡單的方法是什麼?我查看了fancyhdr
包包,發現有衝突memoir
;同樣,我嘗試更改為scrbook
但出現錯誤(已定義基線跳過)。
一定有一種簡單的方法來做到這一點。
[之後]
謝謝大家的有用回答。
答案1
memoir
執行此操作的正確方法
\addtopsmarks{headings}{}{
\createmark{chapter}{left}{nonumber}{}{}
}
\pagestyle{headings} % activate changes
沒有必要試圖弄清楚內部結構是如何運作的或諸如此類的事情。
答案2
您可以重新定義\chaptermark
:
\documentclass{memoir}
\usepackage{lipsum}% just to generate text for the example
\makeatletter
\renewcommand\chaptermark[1]{%
\markboth{\MakeUppercase{#1}}{}
}
\makeatother
\begin{document}
\chapter{Test chapter}
\lipsum[1-10]
\end{document}
第二頁標題的圖片:
大寫文字不太令人愉悅,因此也許您可以使用小寫字母代替:
\documentclass{memoir}
\usepackage{lipsum}% just to generate text for the example
\makeatletter
\renewcommand\chaptermark[1]{%
\markboth{\textsc{#1}}{}
}
\makeatother
\begin{document}
\chapter{Test chapter}
\lipsum[1-10]
\end{document}
答案3
對於twoside
樣式,\chaptermark
指令定義為
> \chaptermark=macro:
#1->\@setclcnt {chapter}{@memmarkcntra}\advance \c@@memmarkcntra \m@ne \markboth
{\memUChead {\ifnum \c@secnumdepth > \c@@memmarkcntra \if@mainmatter \@nameuse
{chaptermarksn}{\@chapapp \ \@nameuse {thechapter}. \ }\fi \fi #1}}{}.
在 中找到定義並不容易memoir.cls
,因為它在處理類別程式碼的過程中被修改了,所以我使用了\show\chaptermark
.
\chaptermarksn
透過查看僅使用其參數的定義,解決方案就很容易:
\renewcommand{\chaptermarksn}[1]{}
因為章節標籤和編號作為參數傳遞給它。
例子
\documentclass{memoir}
\renewcommand\chaptermarksn[1]{}
\begin{document}
\tableofcontents*
\chapter{Test Chapter}
\section{Test Section}
\lipsum[1-20]
\end{document}