我有使用 tikz 创建的网格(实际代码可以做更多的事情,这只是一个 MWE)。我想双面打印,这样,如果您用背光看纸张,线条就会对齐。换句话说,正面和背面的网格角将正好位于彼此的顶部。这可能吗?
编辑:我正在使用 XeLateX,如果这很重要的话
梅威瑟:
\documentclass{article}
\usepackage[a4paper,
left=.5cm,
right=.5cm,
top=.5cm,
bottom=.5cm,
footskip=0cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
\tikzset{cross/.style={cross out, draw=gray, minimum size=2*(#1-\pgflinewidth), inner sep=0pt, outer sep=0pt, dashed},
%default radius will be 1pt.
cross/.default={1pt}}
\pagestyle{empty}
\newcounter{col}
\newcounter{row}
\newcommand\grid[4]{%
\def\colnames{#1}%
\def\size{#2}%
\def\sep{#3}%
\def\empties{#4}%
\begin{tikzpicture}[yscale=-1]
\pgfmathsetmacro{\inc}{\size+\sep}
\setcounter{col}{0}
\setcounter{row}{0}
\foreach \colname in \colnames{
\addtocounter{col}{1}
\setcounter{row}{0}
\foreach \empt in \empties{
\addtocounter{row}{1}
\draw ({(\thecol-1)*\inc+\size*0.5 pt},{\therow*\size+\size*0.5})
node[cross=\size*0.35,rotate=45,darkgray]{};
\draw[black] ({(\thecol-1)*\inc pt},{\therow*\size})
rectangle ++ (\size,\size);
}
}
\end{tikzpicture}%
}
\begin{document}
\centering
\grid{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}{10mm}{0mm}{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
\newpage
\grid{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}{10mm}{0mm}{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
\end{document}
答案1
如果您使用页面的中心作为(0,0)
,那么您只需投资一台能够使对齐远小于线宽的打印机即可。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}[remember picture, overlay, shift=(current page.center)]
\draw (-10,-13) grid (10,13);
\draw[dashed, dash pattern=on 1mm off 1mm on 1mm off 1mm on 1mm off 0mm, shift={(0.5,0.5)}] (-10.5,-13.5) grid (9.5,12.5);
\end{tikzpicture}
\newpage
\pagestyle{empty}
\begin{tikzpicture}[remember picture, overlay, shift=(current page.center)]
\draw (-10,-13) grid (10,13);
\draw[dashed, dash pattern=on 1mm off 1mm on 1mm off 1mm on 1mm off 0mm, shift={(0.5,0.5)}] (-10.5,-13.5) grid (9.5,12.5);
\end{tikzpicture}
\end{document}