hide_answer_tcolorbox

../_images/sphx_glr_hide_answer_tcolorbox.svg
\documentclass[]{standalone}

\usepackage{amsfonts,amssymb,amsmath}
\usepackage{bm}
\usepackage[]{graphicx}

\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}


\usepackage[most]{tcolorbox}
\usepackage{tabularx}
\usepackage{array}
\usepackage{colortbl}
\tcbuselibrary{skins,breakable,raster,xparse}

\usepackage{lipsum}


\NewTColorBox[auto counter]{exercise}{+O{}}{%
        enhanced, breakable,
      	enhanced jigsaw,        
        fonttitle=\bfseries,
        title={Exercise~\thetcbcounter:},
        %coltitle=black,         
        %attach title to upper=\quad,
        before lower={\textbf{Solution~\thetcbcounter:\quad}},
        #1}

\tcbset{student/.style={lowerbox=invisible}}
%\tcbset{student/.style={lowerbox=visible}}

\begin{document}

\begin{exercise}[student,label=abc]
\lipsum[1] (see Exercise \ref{abc})
\tcblower 
\lipsum[1]
\end{exercise}


\end{document}