12

I'm trying to create some custom graph paper for myself. However, I don't want page numbers on it, so I was wondering how to completely remove page numbers. My code is

\documentclass{scrartcl}
\usepackage[margin=25mm]{geometry}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{background}

\SetBgContents%
{   \begin{tikzpicture}[remember picture, overlay]
    \draw [line width=0.3pt,color=gray,step=0.5cm] (current page.south west) grid (current page.north east);
    \end{tikzpicture}
}
\SetBgScale{1}
\SetBgAngle{0}

\begin{document}

\begin{tikzpicture}
    \draw (0,0) rectangle (5,5);
\end{tikzpicture}

\end{document}

(The rectangle is just to have something on the page.)

Thanks!

Edit: I found the solution on my own and posted it as an answer. I am open to better solutions.

auden
  • 1,458

1 Answers1

9

I found this answer (of course) 5 minutes after I posted this question, even though I'd spent a while looking for it. =)

I added the line \thispagestyle{empty}

for the code

\documentclass{scrartcl}
\usepackage[margin=25mm]{geometry}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{background}

\SetBgContents%
{   \begin{tikzpicture}[remember picture, overlay]
    \draw [line width=0.3pt,color=gray,step=0.5cm] (current page.south west) grid (current page.north east);
    \end{tikzpicture}
}
\SetBgScale{1}
\SetBgAngle{0}

\begin{document}
\thispagestyle{empty}

\begin{tikzpicture}
    \draw (0,0) rectangle (5,5);
\end{tikzpicture}

\end{document}

Which worked perfectly.

As Au101 mentioned in the comments, it is probably preferable to move \thispagestyle to the preamble:

\documentclass{scrartcl}
\usepackage[margin=25mm]{geometry}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{background}

\SetBgContents%
{   \begin{tikzpicture}[remember picture, overlay]
    \draw [line width=0.3pt,color=gray,step=0.5cm] (current page.south west) grid (current page.north east);
    \end{tikzpicture}
}
\SetBgScale{1}
\SetBgAngle{0}

\thispagestyle{empty}

\begin{document}

\begin{tikzpicture}
    \draw (0,0) rectangle (5,5);
\end{tikzpicture}

\end{document}

And then put the line in the main body of the document for any special cases where you want the page numbers again.

auden
  • 1,458
  • 1
    Again, I'd set it globally in the preamble, and then use \thispagestyle to adjust as needs be in the document. Doesn't sound like you'd need to do much adjusting in this document, but as a general rule, set the default page style for your documents in the preamble – Au101 Aug 12 '16 at 20:06
  • @Au101, okay, thank you; I did so. If you post that as an answer, I will accept it. – auden Aug 12 '16 at 20:07
  • Hey, don't worry about it, your answer is close enough that I'd just edit it as a second option and get yourself "self-learner" – Au101 Aug 12 '16 at 20:25
  • @Au101, okay; thanks for your help! – auden Aug 12 '16 at 20:26