定義新頁面樣式時 scrbook 和 scrpage2 出現問題

定義新頁面樣式時 scrbook 和 scrpage2 出現問題

我正在寫一篇累積論文,其中scrbook我必須在 PDF 中嵌入多個出版物。這適用於includepdf,但我認為最好將頁眉和/或頁腳資訊保留在適當的位置,以便讀者更容易弄清楚它們在哪裡。我使用標準的「標題」頁面樣式來獲取頁眉中的章節資訊和頁腳中居中的頁碼。但這對 PDF 來說是一個問題,因為頁碼列印在出版物頁腳的頂部,導致兩者都無法讀取。因此,我嘗試將章節標題和頁碼都放入標題中。我最終定義了自己的樣式,並且效果很好,但由於某種原因,新章節第一頁的頁腳中突然出現了一個頁碼 - 通常應該是簡單的。你能告訴我這是怎麼發生的嗎?

這是我的 MWE:

\documentclass[a4paper, twoside, BCOR=15mm, 11pt, numbers=noenddot, DIV=12]{scrbook}

\usepackage[english]{babel}

% changing headers and footers
\usepackage[automark,headsepline]{scrpage2}
\defpagestyle{mystyle}{%
    (0pt, 0pt)
    {\headmark\hfill\pagemark}
    {\pagemark\hfill\headmark}
    {\pagemark\hfill\headmark}
    (\textwidth, 0.5pt)
}{%
    {\hfill}{\hfill}{\hfill}
}
\pagestyle{mystyle}
\usepackage{blindtext}

\begin{document}

\blinddocument

\end{document}

答案1

章節頁面plain預設使用頁面樣式。所以你也必須改變這個頁面樣式。此外,您也可以使用預先定義的樣式scrheadings

\documentclass[BCOR=15mm, numbers=noenddot, DIV=12]{scrbook}
\usepackage[english]{babel}

% changing headers and footers
\usepackage[automark,headsepline]{scrpage2}
\pagestyle{scrheadings}
\clearscrheadfoot% removes the default content of header and footer
\setheadsepline{.5pt}
\ohead{\headmark}
\ihead[\pagemark]{\pagemark}

\usepackage{blindtext}
\begin{document}
\blinddocument
\end{document}

如果章節頁上不應有頁碼,請刪除選用參數\ihead


請注意,這scrpage2已經過時了。我建議使用它的後繼者scrlayer-scrpage

\documentclass[BCOR=15mm, numbers=noenddot, DIV=12]{scrbook}
\usepackage[english]{babel}

% changing headers and footers
\usepackage[automark,headsepline=.5pt]{scrlayer-scrpage}
\clearpairofpagestyles% removes the default content of header and footer
\ohead{\headmark}
\ihead*{\pagemark}

\usepackage{blindtext}
\begin{document}
\blinddocument
\end{document}

如果章節頁上不應有頁碼,請使用\ihead{\pagemark}有星號的版本。

相關內容