I've been trying to write a small package so I can show/hide solutions in some of my notes, so far I have the following non working example which I hacked by looking at some other answers and the latex wiki book https://en.wikibooks.org/wiki/LaTeX/Plain_TeX#Self_defined_conditionals
\ProvidesPackage{solutions}
\newif\ifsolutions
\solutionsfalse
\DeclareOption{solutions}{\solutionstrue}
\DeclareOption{nosolutions}{\solutionsfalse}
\newenvironment{solution}[1]{
\ifsolutions
#1 $\delta$ % I'd ideally want to write the solution in a gray box
\else
#1 $\bullet$ % I'd like to ignore all the input when solutions is false, but putting a circle will do for now.
\fi
}
and my .tex
\documentclass[reqno, 12pt, twoside, letterpaper]{memoir}
\usepackage[nosolutions]{packages/solutions}
\begin{document}
\begin{solution}
Test
\end{solution}
\end{document}
But this doesn't work at all, if I define solutions
it doesn't work and if I define nosolutions
it will fail to compile. I've been searching for a way to use an if inside the new environment with nothing that looks even remotely promising.
Any ideas on where I should look for this?
\ProcessOptions
.solution
environment to take one mandatory argument, but the sample instance of thesolution
environment does not appear to make purposeful use of this argument. What's the argument supposed to influence or achieve? Does thesolution
environment need an argument at all?