TikZ:包含多个网格的页面

TikZ:包含多个网格的页面

我想在DIN A4 纸(21厘米×29.7厘米):

在此处输入图片描述

周围的边距应该大约为 15 毫米(正负);最主要的是我在文本区域获得尽可能多的网格框。

如何正确设置页面几何和网格尺寸,以便两个网格正确适合且完整。

我目前只得到:

在此处输入图片描述

\documentclass[]{scrartcl}
\usepackage[showframe=true,
%includeheadfoot, 
%left=15mm, right=15mm, bottom=17mm, top=15mm
%textwidth=18cm, textheight=26cm,
width=18cm, height=26cm,
]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc, backgrounds}
\pagestyle{empty}

\begin{document}
%ABC

\begin{tikzpicture}[shift={(current page.center)}, overlay,remember picture,
on background layer,
nodes={inner sep=0pt,outer sep=0pt}]
\node[draw, fill=white, anchor=north west, align=left, text width=18 cm, text height=6cm] at (-0.5\textwidth, 0.5\textheight) {Text:};
% Grids
\begin{scope}[on background layer]
\draw[red, step=2cm] (-0.5\textwidth, 0.5\textheight) grid +(\textwidth, -0.5\textheight);
\draw[red, step=1cm] (-0.5\textwidth, 0) grid +(\textwidth, -0.5\textheight);
\end{scope}

% Help
\node{x};
\draw[brown, thick] (0,0) -- (0.5\textwidth,0);
\draw[blue, thick] (0,0) -- (0,0.5\textheight);
\end{tikzpicture}
\end{document}

答案1

我解决了类似这样的问题,应该大约是 99%。

在此处输入图片描述

% arara: pdflatex
% arara: pdflatex

\documentclass[]{scrartcl}
\usepackage[showframe=true,
%includeheadfoot, 
%left=15mm, right=15mm, bottom=17mm, top=15mm
%textwidth=18cm, textheight=26cm,
width=18cm, height=26cm,
]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc}
\pagestyle{empty}

\begin{document}
%ABC
%
\begin{tikzpicture}[every path/.style=red, shift={(current page.center)}, overlay,remember picture,
nodes={inner sep=0pt,outer sep=0pt}]
\node[anchor=north west, 
draw,
minimum width=1.0\textwidth,text width=1.0\textwidth-2mm,
minimum height=6cm,text depth=6cm-4mm,
align=left, 
] at (-0.5\textwidth, 0.5\textheight+0.7\baselineskip) (Textbox) {ABC};

% Grids:
\draw[step=1, dotted, help lines, shift={(Textbox.south west)}] (0,0) grid +(\textwidth,-4);
\draw[step=2, shift={(Textbox.south west)}] (0,0) coordinate(X) grid +(\textwidth,-8);

\draw[step=0.5, dotted, help lines, shift={($(Textbox.south west)+(0,-8)$)}] (0,0)  grid +(\textwidth,-4);
\draw[step=1, shift={($(Textbox.south west)+(0,-8)$)}] (0,0)  grid +(\textwidth,-12);

\end{tikzpicture}
\end{document}

相关内容