我知道我可以制作(普通)页面边框,例如,如下所示:
\documentclass{article}
\usepackage[margin=.75in,paperwidth=16cm,paperheight=24cm]{geometry}
\usepackage[a4,frame,noinfo,center]{crop}
\usepackage{lipsum}
\begin{document}
\thispagestyle{empty}
\parskip 10pt
\large
\lipsum
\end{document}
这使
然而,
我希望上面的页面边框类似于以下内容tcolorbox
,正如我们所见,它不是页面边框:
\documentclass[a4paper]{article}
\usepackage[margin=.75in,paperwidth=16cm,paperheight=24cm]{geometry}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\usepackage{lipsum}
\tcbset{
Baystyle/.style={
%sharp corners,
enhanced,
boxrule=6pt,
colframe=green!35!black,
height=\textheight,
width=\textwidth,
borderline={6pt}{-11pt}{},
}
}
\begin{document}
\large
\begin{tcolorbox}[Baystyle]
\lipsum
\end{tcolorbox}
\end{document}
问题:我如何修改第一组代码,以使其产生的页面边框类似于指示的边框tcolorbox
?
谢谢。
答案1
您可以使用该tikzpagenodes
包:
\documentclass{article}
\usepackage[margin=.75in,paperwidth=16cm,paperheight=24cm]{geometry}
%\usepackage[a4,frame,noinfo,center]{crop}
\usepackage{tikzpagenodes}
\AddToHook{shipout/background}{\begin{tikzpicture}[remember picture,overlay]
\draw[green!50!black,rounded corners,ultra thick] ([xshift=-0.3cm,yshift=-0.3cm]current page text area.south west) rectangle ([xshift=0.3cm,yshift=0.3cm]current page text area.north east);
\draw[red!50!black,rounded corners,ultra thick] ([xshift=-0.5cm,yshift=-0.5cm]current page text area.south west) rectangle ([xshift=0.5cm,yshift=0.5cm]current page text area.north east);
\end{tikzpicture}}
\usepackage{lipsum}
\begin{document}
\thispagestyle{empty}
\parskip 10pt
\large
\lipsum
\end{document}