如何添加一个与页面边缘偏移 1.5 厘米的普通矩形页面边框?如果可能的话,我更喜欢使用 \TikZ。
答案1
\documentclass{article}
\usepackage{tikz}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}
\begin{document}
\tikz[overlay,remember picture]\draw($(current page.north east)+(-1.5cm,-1.5cm)$)--($(current page.north west)+(1.5cm,-1.5cm)$)--($(current page.south west)+(1.5cm,1.5cm)$)--($(current page.south east)+(-1.5cm,1.5cm)$)--cycle;
\end{document}
在所有页面设置边框:
\documentclass{article}
\usepackage{tikz}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}
\usepackage{fancyhdr}
\newcommand{\myborder}{
\tikz[overlay,remember picture]\draw($(current page.north east)+(-1.5cm,-1.5cm)$)--($(current page.north west)+(1.5cm,-1.5cm)$)--($(current page.south west)+(1.5cm,1.5cm)$)--($(current page.south east)+(-1.5cm,1.5cm)$)--cycle;}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\rhead{\myborder}
\begin{document}
content
\end{document}
答案2
答案3
您不需要用大锤来在每个页面上获取这个框架:eso-pic
只需使用相关参数的简单\framebox
命令\raisebox
就可以了:
\documentclass[11pt,svgnames, a4paper]{book}
\usepackage{eso-pic}
\usepackage{geometry}
\usepackage{xcolor}
\usepackage{etoolbox}
\usepackage{lipsum}
\dimdef{\frameheight}{\dimexpr\paperheight-3cm-\fboxsep-2\fboxrule}
\dimdef{\framewidth}{\dimexpr\paperwidth-3cm-2\fboxsep-2\fboxrule}
\title{Page Frames}
\author{My Self}
\date{}
\AddToShipoutPictureBG{%
\AtPageLowerLeft{%
\fboxrule = 1pt
\hspace*{1.5cm}\raisebox{1.5cm}{\color{DarkSeaGreen}\framebox[\framewidth]{\rule{0pt}{\frameheight}}}%
}}
\begin{document}
\maketitle
\chapter{Chapter Title}
\lipsum
\end{document}