将页码放在与纸张边缘接触的黑色(或灰色)填充框中是一种不错的样式。如何创建这样的书?
此外,如何创建悬挂盒以及如何放置农作物迹象在角落里(这是打印所必需的)。
答案1
titlesec/titleps
以下是纸张边缘页码的简单解决方案:
\documentclass[12pt, twoside]{book}%
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[x11names]{xcolor}
\usepackage[showframe, nomarginpar]{geometry}
\usepackage[pagestyles]{titlesec}
\usepackage{lipsum}
\newpagestyle{mine}{%
\sethead[\llap{\makebox[\dimexpr\evensidemargin +\hoffset + 1in\relax][l]{\colorbox{SlateGray4}{\textcolor{white}{\huge\bfseries\thepage}}}}][][]{}{}{\rlap{\makebox[\dimexpr\evensidemargin +\hoffset + 1in\relax][r]{\colorbox{SlateGray4}{\textcolor{white}{\huge\bfseries\thepage}}}}}
\setfoot{}{}{}
}
\pagestyle{mine}
\begin{document}
\lipsum[1-8]
\end{document}
要将页码准确地显示在纸张的角落,您可以使用以下代码:
\documentclass[12pt, a4paper, twoside]{book}%
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[x11names]{xcolor}
\usepackage[showframe, nomarginpar]{geometry}
\usepackage[pagestyles]{titlesec}
\usepackage{lipsum}
\newpagestyle{mine}{%
\sethead[{\raisebox{\dimexpr\topmargin + \voffset + 1in\relax}[\height][0pt]{\llap{\makebox[\dimexpr\evensidemargin +\hoffset + 1in\relax][l]{\colorbox{SlateGray4}{\textcolor{white}{\huge\bfseries\thepage}}}}}}][][]
{}{}{\raisebox{\dimexpr\topmargin + \voffset + 1in\relax}[\height][0pt]{\rlap{\makebox[\dimexpr\evensidemargin +\hoffset + 1in\relax][r]{\colorbox{SlateGray4}{\textcolor{white}{\huge\bfseries\thepage}}}}}}
\setfoot{}{}{}
}
\pagestyle{mine}
\setcounter{page}{121}
\begin{document}
\lipsum[1-16]
\end{document}