关于 TikZ 和点网格的问题

关于 TikZ 和点网格的问题

如果 a) 这个问题已经得到回答,并且 b) 这里不是发布这个问题的好地方,我深感抱歉。

我对 TeX 还很陌生,我正在尝试制作自己的笔记本纸,因为我还没能找到我喜欢的笔记本。

理想的设置是,一侧是康奈尔纸币,纸币块上有点状网格。另一侧是罗迪亚间距的点状网格。

我有以下 MWE,是根据我在线提取的片段构建的:

\documentclass[letterpaper, 10pt]{book} 
\usepackage[utf8]{inputenc}
\pagenumbering{gobble}
\usepackage[letterpaper,hmargin={0mm,3mm},vmargin=5mm]{geometry}
\usepackage{tikz, ragged2e} 

\begin{document} 

\begin{tikzpicture} 
\draw[step=.7cm,gray!20,very thin] (4.9,4.9) grid (20.5,25.8); %this is the notes box that I want a dot grid in
\draw [line width=1pt, black] (0,4.9) rectangle (20.5,0); %summary box
\draw [line width=1pt, black] (0,25.8) rectangle (20.5,0); %main box
\draw [line width=1pt, black] (4.9,4.9) rectangle (20.5,25.8); %Grid box
\node at (2,4.5){Summary:};   
\node at (4,26.6){\parbox[t][2cm][c]{4cm}{\raggedright Subject:\smallskip \\
Date:}};
\end{tikzpicture}
\newpage
\begin{tikzpicture}[ scale=.5]% copies Rhodia's dot spacing.
\foreach \x in {0,...,41} % Number of columns of dots
\foreach \y in {0,...,53} % Number of rows of dots. If you change the spacing or margins, you'll have to play with these x and y ranges to make sure you have the right amount for the page.
{
    \fill[blue!75] (\x,\y) circle (0.06cm); % this is the thickness of the dots, blue because I like blue.
}       
\end{tikzpicture}
\end{document}`

我确信有一个更简单/更好的方法来做到这一点,我只是不知道它是什么,而且我的谷歌搜索能力显然不够好。

我的问题在第 10 行,我在那里生成了网格。我希望在那个框中拥有与第 19 行相同的点网格。我不知道该怎么做...

我感激任何人能给予的帮助。

答案1

如果我理解正确的话,你正在寻找类似的东西

\documentclass[letterpaper, 10pt]{book} 
\usepackage[utf8]{inputenc}
\pagenumbering{gobble}
\usepackage[letterpaper,hmargin={0mm,3mm},vmargin=5mm]{geometry}
\usepackage{tikz, ragged2e} 

\begin{document} 

\begin{tikzpicture}
    \begin{scope}
        \clip (4.9,4.9) rectangle (20.5,25.8); %this is the notes box that I want a dot grid in
        \begin{scope}[scale=0.5]
            \foreach \x in {0,...,41} % Number of columns of dots
            \foreach \y in {0,...,53} % Number of rows of dots. If you change the spacing or margins, you'll have to play with these x and y ranges to make sure you have the right amount for the page.
            {
                \fill[blue!75] (\x,\y) circle (0.06cm); % this is the thickness of the dots, blue because I like blue.
            }
        \end{scope}
    \end{scope}
    \draw [line width=1pt, black] (0,4.9) rectangle (20.5,0); %summary box
    \draw [line width=1pt, black] (0,25.8) rectangle (20.5,0); %main box
    \draw [line width=1pt, black] (4.9,4.9) rectangle (20.5,25.8); %Grid box
    \node at (2,4.5){Summary:};   
    \node at (4,26.6){\parbox[t][2cm][c]{4cm}{\raggedright Subject:\smallskip \\ Date:}};
\end{tikzpicture}
\newpage
\begin{tikzpicture}[ scale=.5]% copies Rhodia's dot spacing.
    \foreach \x in {0,...,41} % Number of columns of dots
    \foreach \y in {0,...,53} % Number of rows of dots. If you change the spacing or margins, you'll have to play with these x and y ranges to make sure you have the right amount for the page.
    {
        \fill[blue!75] (\x,\y) circle (0.06cm); % this is the thickness of the dots, blue because I like blue.
    }       
\end{tikzpicture}
\end{document}

可能有更优雅的解决方案,我只是尝试尽可能多地重用您的代码。

相关内容