0

I would like to create an environment having the following role: create an exercise (called "exo" in the sequel) and a grid with a prescribed number of lines. My environment exo works fine, but not with the grid. I tried

\newenvironment{exoQuadrill}[1]%
{\begin{exo}}%
{\end{exo} \smallbreak\begin{tikzpicture}[scale=0.5,gray]
\draw(0,0) grid (33.4,#1);
\end{tikzpicture}\medbreak}

It doesn't work (error : "illegal parameter number"), but it is if I don't specify the number of lines:

\newenvironment{exoQuadrill}[1]%
{\begin{exo}}%
{\end{exo} \smallbreak\begin{tikzpicture}[scale=0.5,gray]
\draw(0,0) grid (33.4,13);
\end{tikzpicture}\medbreak}
jowe_19
  • 939
  • See https://tex.stackexchange.com/a/237006/586 – Torbjørn T. May 02 '18 at 13:13
  • I closed as duplicate of the mentioned question, let me know if you really disgree with that, though using xparse as egreg suggested works fine. (\usepackage{xparse} \NewDocumentEnvironment{exoQuadrill}{m} {\begin{exo}} {\end{exo} \smallbreak\begin{tikzpicture}[scale=0.5,gray] \draw(0,0) grid (33.4,#1); \end{tikzpicture}\medbreak}) – Torbjørn T. May 13 '18 at 20:20

0 Answers0