答案1
tikz
这可以通过自定义样式来实现mdframed
(而不是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}
答案2
这可以通过 tcolorbox 的自定义样式(而不是框架)来实现
\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}