I've tried a few items I've found on the forum here, by using \phantom or the following code:
\newcommand\invisiblesection[1]{%
\refstepcounter{section}%
\addcontentsline{toc}{section}{\protect\numberline{\thesection}#1}%
\sectionmark{#1}}
...
\invisiblesection{Blah}
Neither compile without errors when I try to print the following invisiably - meaning leaving blank space where the solution is typed.
\phantom{
For this experiment the sample space is simple to think about and write down. We can use canonical ordering to find the sample space as seen in Table \ref{tab:samplespaceexample} which yields a sample space of
\begin{displaymath}
\Omega = \{\textrm{HHH, HHT, HTH, HTT, THH, THT, TTH, TTT}\}.
\end{displaymath}
\begin{center}
\begin{tabular} {ccc}
First Toss & Second Toss & Third Toss \\\hline
H & H & H\\
H & H & T\\
H & T & H\\
H & T & T\\
T & H & H\\
T & H & T\\
T & T & H\\
T & T & T\\
\end{tabular}
\caption{Canonical ordering used to specify a sample space.}
\label{tab:samplespaceexample}
\end{center}
It should be noted that the sample space can be represented differently for the same random experiment if the point of interest changes. If we were interested in the number of heads instead of the specific outcomes the sample space would be
\begin{displaymath}
\Omega = \{0, 1, 2, 3\}.
\end{displaymath}
}
\end{exmp}
I should note that if I only use phantom on the text at the top before the \begin{displaymath} function it does seem to work but as soon as I go into another environment it doesn't work.


tableis) is to migrate somewhere else, it's never going to behave well if you attempt to wrap\phantomaround outside of it. and using\phantomwithin the float isn't particularly useful either. you need to apply\phantomto something that is going to stay where you want it to be located. try using just\tabularand\captionofwithin a\centerenvironment. – barbara beeton Aug 23 '16 at 15:11