以下 tikz 节点填满了整个 a4 页面。之后使用 crop-package 裁剪页面(仅用于演示目的,注释掉该包,似乎没有改变任何东西)。只要我不在节点周围画一个矩形或一条对角线,一切都很好。
例如,绘制一条对角线(参见以下 MWE 中的屏幕截图和注释)会出现分页符。我的 - 丑陋 - 解决方法:我稍微 (.281) 增加了纸张的高度。
我的问题:到底是什么导致了分页?您知道更好的解决方法吗?
\RequirePackage{luatex85}
\documentclass{article}
\usepackage[%
paperheight=210mm,
% paperheight=210.2812mm,%increasing the height seems to work, but ugly
paperwidth=297mm,
margin=0cm,
]{geometry}
\usepackage[cam,a3,landscape,center]{crop}
\usepackage[main=english]{babel}
\usepackage{tikz}
\setlength{\parindent}{0pt}
\begin{document}
\pagestyle{empty}%
\begin{tikzpicture}%
\coordinate (p);%
\node[%
fill=green,
minimum height=210mm,
minimum width=297mm,
anchor=west,
inner sep=0pt,
outer sep=0pt]%
(backFlap) at (p) {%
\huge Hello World!%
};%
%uncommenting any of these drawings causes a pagebreak -- why?
% \draw[thick,black]
% (backFlap.north west) rectangle (backFlap.south east) {}%
% (backFlap.north east) -- (backFlap.south west) {}%
% (backFlap.north west) -- (backFlap.south east) {}%
% ;%
\end{tikzpicture}%
\end{document}
答案1
Christan Hupfer 是对的,你的问题在于线宽。一条线向路径两侧延伸 0.5 倍线宽。在你的情况下,这将使图片的尺寸在两个方向(x 和 y)增加线宽。
但是您可以在 Tikz 中设置边界框,它基本上设置了图片的大小。此框外的内容不予考虑。请参阅 Tikz 手册 15.8 创建边界框(第 175 页,版本 3.0.1a 手册)。
\documentclass{article}
\usepackage[%
paperheight=210mm,
% paperheight=210.2812mm,%increasing the height seems to work, but ugly
paperwidth=297mm,
margin=0cm,
]{geometry}
\usepackage[cam,a3,landscape,center]{crop}
\usepackage[main=english]{babel}
\usepackage{tikz}
\setlength{\parindent}{0pt}
\begin{document}
\pagestyle{empty}%
\begin{tikzpicture}%
\coordinate (p);%
\node[%
fill=green,
minimum height=210mm,
minimum width=297mm,
anchor=west,
inner sep=0pt,
outer sep=0pt]%
(backFlap) at (p) {%
\huge Hello World!%
};%
% setting bounding box to prevent enlargement of picture by line width
\useasboundingbox (0,-0.5\paperheight) rectangle (\paperwidth,0.5\paperheight);%
\draw[thick,black]
(backFlap.north west) rectangle (backFlap.south east) {}%
(backFlap.north east) -- (backFlap.south west) {}%
(backFlap.north west) -- (backFlap.south east) {}%
;%
\end{tikzpicture}%
\end{document}