我想创建一个加权网格纸模板。我希望它基本上看起来像一张有线条的纸,但上面有模糊的、等距的垂直线条。我研究了格子纸模板有一组模板,但我不知道如何更改垂直/水平线的属性。
答案1
我最终
%% Calligraphy Guide Lines
%% Peter Grill
%%
%% ---------------------- Note: May need to run this twice ---------------------
%%
%% --------------------------------------------------- Select Lines
%% ---------------------------------------------------------------- Horizontal Lines
\def\VerticalSkip{.75cm}% 0.10cm through 2cm
\def\UseAltStyleEveryNthHorizontalLine{2}%
%% ---------------------------------------------------------------- Vertical Slant Lines
\def\HorizontalSlantSkip{0.75cm}%
\def\SlantAngle{55}% Degrees >30, < 60
\def\UseAltStyleEveryNthSlantLine{4}%
%% ---------------------------------------------------------------- Vertical Lines
\def\HorizontalSkip{0.75cm}%
\def\UseAltStyleEveryNthVerticalLine{5}%
%% ---------------------------------------------------------------- Select Margins
\def\MarginTop{0.25cm}
\def\MarginBottom{0.25cm}
\def\MarginLeft{0.25cm}
\def\MarginRight{0.25cm}
%% ---------------------------------------------------------------- Select Paper
\def\Paper{a4paper}% letter | a4paper | a5paper, ....
\def\Orientation{portrait}%% portrait | landscape
%% -----------------------
\documentclass[\Paper, \Orientation]{article}% Version 1.1
\usepackage{tikz}
\usepackage{xstring}
\pagestyle{empty}
%% Select the line style. I prefer using the second one here and using the output underneath
%% the actual paper as guide lines. The first is better if you want to actually write on
%% top of the guide lines
%%
%% Few other options that can be applied here (last applied options override earlier ones).
%% solid
%% dotted, densely dotted, loosely dotted,
%% dashed, densely dashed, loosely dashed,
%% dash dot dot, densely dash dot dot, loosely dash dot dot,
%% loosely dashed,
%%
%% Custom line styles can be defined also be specifying the on/off patter:
%% dash pattern=on 2pt off 3pt on 4pt off 4pt
%%
%% To disable ANY lines use the draw=none as the last style.
%\tikzset{Line Style/.style={line width=1pt, densely dotted, gray, draw opacity=0.1}}
\tikzset{Line Style/.style={
line width=0.2pt,
solid,
gray,
draw opacity=0.5
}}
\tikzset{Horizontal Line Style/.style={
Line Style,
line width=0.2pt,
dashed,
draw opacity=1.0
}}
\tikzset{Horizontal Line Style Alternate/.style={
Line Style,
line width=0.2pt,
dashed,
draw opacity=1.0,
}}
\tikzset{Slant Line Style/.style={
draw=none
}}
\tikzset{Slant Line Style Alternate/.style={
draw=none
}}
\tikzset{Vertical Line Style/.style={
Line Style,
line width=0.1pt,
style=gray,
dashed,
draw opacity=0.5}}
\tikzset{Vertical Line Style Alternate/.style={
Line Style,
line width=0.1pt,
style=gray,
dashed,
draw opacity=0.5}}
\tikzset{Border Line Style/.style={Line Style, thin}}
\newlength{\DeltaY}
\newlength{\TempLength}
\pgfmathtruncatemacro{\MaxHorizontalLines}{\paperheight/\VerticalSkip}
\pgfmathsetmacro{\TanSlantAngle}{tan(\SlantAngle)}
\pgfmathsetlength{\DeltaY}{\HorizontalSlantSkip*\TanSlantAngle}
\pgfmathtruncatemacro{\MaxSlantLinesX}{\paperwidth/\HorizontalSlantSkip}
\pgfmathtruncatemacro{\MaxSlantLinesY}{\paperheight/\DeltaY}
\pgfmathtruncatemacro{\MaxVerticalLines}{\paperwidth/\HorizontalSkip}
\newcommand*{\SetLineStyle}[4]{%
%% #1 = style name to set
%% #2 = default line style
%% #3 = line number
%% #4 = which lines get the alternate line style
\pgfmathtruncatemacro{\Remainder}{mod(#3,#4)}%
\ifnum\Remainder=0\relax
\tikzset{#1/.style={#2 Alternate}}%
\else
\tikzset{#1/.style={#2}}%
\fi
}%
\begin{document}%
\begin{tikzpicture}[
remember picture,
overlay,
shift=(current page.south west),% So that (0,0) is south west of paper
]
%% Clip to create the border
\clip (\MarginLeft,\MarginBottom) rectangle
(\paperwidth-\MarginRight,\paperheight-\MarginTop);
\foreach \y in {1,...,\MaxHorizontalLines} {% Horizontal guide lines
\SetLineStyle
{This Horizontal Line Style}{Horizontal Line Style}
{\y}{\UseAltStyleEveryNthHorizontalLine}
\begin{scope}[yshift=-\MarginTop]
\draw[This Horizontal Line Style]
(0pt,\paperheight-\y*\VerticalSkip) -- (\paperwidth,\paperheight-\y*\VerticalSkip)
;
\end{scope}
}
\foreach \x in {1,...,\MaxVerticalLines} {% Vertical guide lines
\SetLineStyle
{This Vertical Line Style}{Vertical Line Style}
{\x}{\UseAltStyleEveryNthVerticalLine}
\begin{scope}[xshift=\MarginLeft]
\draw[This Vertical Line Style]
(\x*\HorizontalSkip,0pt) -- (\x*\HorizontalSkip,\paperheight)
;
\end{scope}
}
\pgfmathsetlength{\TempLength}{\paperwidth*\TanSlantAngle}
\foreach \x in {0,...,\MaxSlantLinesX} {% Slant Lines starting along bottom of page
\SetLineStyle
{This Slant Line Style}{Slant Line Style}
{\x}{\UseAltStyleEveryNthSlantLine}
\draw[This Slant Line Style]
(\x*\HorizontalSlantSkip,0pt) -- ++(\paperwidth,\TempLength)
;
}
\foreach \y in {1,...,\MaxSlantLinesY} {% Slant Lines starting along left of page
\SetLineStyle
{This Slant Line Style}{Slant Line Style}
{\y}{\UseAltStyleEveryNthSlantLine}
\draw[This Slant Line Style]
(0pt,\y*\DeltaY) -- ++(\paperwidth,\TempLength)
;
}
%% Draw border
\draw [Border Line Style]
(\MarginLeft,\MarginBottom) rectangle
(\paperwidth-\MarginRight,\paperheight-\MarginTop);
\end{tikzpicture}%
\end{document}
我认为应该清理代码(例如,我只想指定一种线条样式,而不是主线条样式和替代线条样式。
答案2
您将无法使用 gridpapers 包以单独的方式自定义垂直线和水平线,因为 - 根据包文档中给出的实现 - 开发人员使用指令rectangle
来定义网格,这样,做您想做的事情的最佳选择就是做类似 campa 的事情。