# How can I create framed boxes with graph paper as background

How can I add a graph paper background for my framed boxes?

Example:

\documentclass{article}
\usepackage{framed}

\begin{document}
Calculate the Solution of $5+3$

\begin{framed}
\vspace{5cm}
\end{framed}

\end{document}


This can be accomplished with a custom tikz based style for mdframed (instead of framed)

\documentclass{article}

\usepackage[framemethod=tikz]{mdframed}
\usetikzlibrary{backgrounds}

\mdfdefinestyle{graphpaper}{%
apptotikzsetting={\tikzset{mdfbackground/.style={}}},
singleextra={%
\scoped[on background layer,yshift=\mdfboundingboxheight]{\draw[step=5mm, line width=0.2mm, black!20!white] (0,0) grid (\mdfboundingboxwidth,-\mdfboundingboxheight);}
},
}

\begin{document}
Calculate the Solution of $5+3$

\begin{mdframed}[style=graphpaper]
\vspace{5cm}
\end{mdframed}

\end{document}


This can be accomplished with a custom style for tcolorbox (instead of framed)

\documentclass{article}

\usepackage{tcolorbox}
\tcbuselibrary{hooks,breakable,skins}

\newtcolorbox{graphpaperBox}[1][]{
enhanced,
sharp corners,
breakable,
colback=white,
underlay={%
\begin{tcbclipinterior}
\draw[step=5mm, line width=0.2mm, black!20!white, shift={(interior.north west)}] (0,0)  grid (interior.south east);
\end{tcbclipinterior}
}
#1}

\begin{document}
Calculate the Solution of $5+3$

\begin{graphpaperBox}
\vspace{5cm}
\end{graphpaperBox}

\end{document}