我正在使用 classicthesis 包中的文章类。我需要自定义页眉和页脚。我非常接近所需的输出,但不知道如何在页脚行上方添加页码。下面是显示所需输出的图像。此外,我如何增加页眉大小?提前致谢。
\documentclass[11pt,a4paper,footinclude,headinclude]{article}
\usepackage[nochapters]{classicthesis}
\usepackage{graphicx}
\areaset[current]{350pt}{761pt}
\begin{document}
\clearscrheadfoot
\ihead{Header text}
\chead{}
\ohead{\includegraphics[height=10mm]{Logo.png}}
\lofoot{\footnotesize website}
\cfoot{\footnotesize\textbf{Footer Text}}
\rofoot{\footnotesize phone}
\setheadsepline{0.5pt}
\setfootsepline{0.5pt}
some dummy text
\end{document}
答案1
注意:使用classicthesis
标准类而不是KOMA-Script
类会停用 的几个功能classicthesis
。如果这不是问题,它甚至可能很好,因为它避免了 KOMA-Script 类与 等包的一些不推荐的组合titlesec
。
有几种建议可以在页面样式中添加额外的元素。因为classicthesis
使用包scrlayer-scrpage
最强大的功能是为水平线下方的文本或水平线上方的页码添加额外的层。下面是最后一个示例:
\documentclass[11pt,a4paper,footinclude,headinclude]{article}
\usepackage[nochapters]{classicthesis}
\usepackage{graphicx}
\areaset[current]{350pt}{761pt}
\clearpairofpagestyles% deprecated \clearscrheadfoot replaced
\ihead{Header text}% with single sided, this is the same like \lofoot
\chead{}
\ohead{\smash{\includegraphics[height=10mm]{example-image}}}% image replaced
% to make the example working; \smash added to
% ignore the height of the image and therefore
% avoid a warning about the height of the head
\setkomafont{pagefoot}{\footnotesize}% setting the basic font size of the page footer
\setkomafont{pagenumber}{\normalsize}% setting the font size of the page number
\KOMAoptions{headsepline=.5pt,footsepline=.5pt}% deprecated \setheadsepline
% and \setfootsepline replaced
\ifoot{website}
\cfoot{\textbf{Footer Text}}
\ofoot{phone}
\makeatletter
\DeclareLayer[%
foreground,% layer only used in foreground
foot,% basic position in the foot
hoffset=\sls@leftmargin{foot},% left position changed according to the original layers of scrlayer-scrpage
addvoffset=-\baselineskip,% move it upwards
contents={%
\raggedleft\normalfont
\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{\pagemark}}\par% the \par is needed to make \raggedleft work
}%
]{pagenumber}
\makeatother
\AddLayersToPageStyle{scrheadings}{pagenumber}% add the new layer to pagestyle scrheadings
\AddLayersToPageStyle{plain.scrheadings}{pagenumber}% and also to the plain page style plain.scrheadings
\begin{document}
some dummy text
\end{document}
但是有一个更通用、更简单的建议:使用将\raisebox
数字移动到线上方并赋予其零高度和深度:
\documentclass[11pt,a4paper,footinclude,headinclude]{article}
\usepackage[nochapters]{classicthesis}
\usepackage{graphicx}
\areaset[current]{350pt}{761pt}
\clearpairofpagestyles% deprecated \clearscrheadfoot replaced
\ihead{Header text}% with single sided, this is the same like \lofoot
\chead{}
\ohead{\smash{\includegraphics[height=10mm]{example-image}}}% image replaced
% to make the example working; \smash added to
% ignore the height of the image and therefore
% avoid a warning about the height of the head
\setkomafont{pagefoot}{\footnotesize}% setting the basic font size of the page footer
\setkomafont{pagenumber}{\normalsize}% setting the font size of the page number
\KOMAoptions{headsepline=.5pt,footsepline=.5pt}% deprecated \setheadsepline
% and \setfootsepline replaced
\ifoot{website}
\cfoot{\textbf{Footer Text}}
\ofoot{phone%
\makebox[0pt][r]{\raisebox{1.2\baselineskip}[0pt][0pt]{\pagemark}}% added
% the page number right aligned without width
% and moved upwards without height an depth.
}
\begin{document}
some dummy text
\end{document}
两个示例的结果都是:
还请注意我对弃用代码的评论。有关替换的更多信息,请参阅 KOMA-Script 手册。