10

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.

  • 4
    Any reason you can't use \pagestyle{empty} in the preamble? Works for me – Au101 Aug 12 '16 at 20:01
  • @Au101, I actually found that solution just now and posted it as an answer. Thanks, though! – heather Aug 12 '16 at 20:02
7

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.

  • 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. – heather 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! – heather Aug 12 '16 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.