我想在文件 ( scrbook
) 的右上角或右下角添加活頁簿。我已經設法在所有頁面上插入文件名中數量不斷增加的圖片。只是提一下:Komaclasses 抱怨fancyhdr
這就是我不想使用它的原因。這同樣適用於自行flipbook
載入的套件fancyhdr
。
我很難找到正確的位置。考慮遵循 MWE 並查看編譯結果:
\documentclass{scrbook}
\usepackage{graphicx}
\usepackage{showframe}
\usepackage{picture}
\usepackage{scrlayer-scrpage}
\makeatletter
\rohead*{%
\if@mainmatter
\begin{picture}(-\marginparsep,\headheight)
\put(0,-\headsep){\includegraphics[width=\marginparwidth,height=37.4pt]{example-image-a}}
\end{picture}
\else\fi
}
\makeatother
\begin{document}
\mainmatter
\chapter{title}
\begin{description}
\item[headheight] \the\headheight
\item[headsep] \the\headsep
\item[marginparwidth] \the\marginparwidth
\item[marginparsep] \the\marginparsep
\end{description}
\paragraph{Intended size and placement of flipbook image:}
\begin{itemize}
\item width of image = marginparwidth
\item height of image = headsep + headheight
\item lower left corner of image should be at the top left corner of the margin notes
box (compare showframe)
\item Alternative placement: top left corner of image should be at the lower
left corner of the margin notes box
\end{itemize}
\end{document}
我剩下的問題是如何在不迭代圖片環境和 put 命令的值的情況下放置圖像。作為獎勵,我怎樣才能避免Package scrlayer-scrpage Warning: \headheight too low
.
答案1
我會為活頁簿聲明一個自己的圖層,可以將其添加到頁面樣式scrheadings
和plain.scrheadings
.然後您仍然可以將\ohead
和\rohead
用於其他內容。
\documentclass{scrbook}
\usepackage{graphicx}
\usepackage{showframe}
\usepackage{picture}
\usepackage{scrlayer-scrpage}
\makeatletter
\DeclareNewLayer[
background,
oddpage,
textarea,
addhoffset=\textwidth+\marginparsep,
width=\marginparwidth,
height=\headsep+\headheight,
align=b,
mode=picture,
contents={%
\if@mainmatter
\putLL{\includegraphics[width=\layerwidth,height=\layerheight]{example-image-a}}%
\fi
}
]{flipbook.odd}
\makeatother
\AddLayersToPageStyle{plain.scrheadings}{flipbook.odd}
\AddLayersToPageStyle{scrheadings}{flipbook.odd}
\begin{document}
\mainmatter
\chapter{title}
\begin{description}
\item[headheight] \the\headheight
\item[headsep] \the\headsep
\item[marginparwidth] \the\marginparwidth
\item[marginparsep] \the\marginparsep
\end{description}
\paragraph{Intended size and placement of flipbook image:}
\begin{itemize}
\item width of image = marginparwidth
\item height of image = headsep + headheight
\item lower left corner of image should be at the top left corner of the margin notes
box (compare showframe)
\item Alternative placement: top right corner of image should be at the lower
left corner of the margin notes box
\end{itemize}
\end{document}