5

I would like to completely hide the contents of tcolorboxes (on non-white, non-uniform background), even all rules in equations. The latter are the only remaining things when one sets opacitytext=0.

\documentclass{scrartcl}
\usepackage[most]{tcolorbox}    
\usepackage{amsmath}

\begin{document}
\begin{tcolorbox}[enhanced, opacitytext=0]
\begin{align}
\frac{a}{b}=\underline{c}
\end{align}
\end{tcolorbox}
\end{document}

enter image description here

Is there a way to also hide the remaining lines?

11

Use the option tikz={opacity=0} in addition to opacitytext=0 in order to hide anything inside the box, since the enhanced skin style uses tikzpicture as the drawing 'machine' -- the option tikz={opacity=0} is handed over to tikzpicture and drawing is 'silenced'.

The first box shows the hidden content, the second one is the box without using tikz={opacity=0} as done by the O.P.

\documentclass{article}
\usepackage{amsmath}
\usepackage[most]{tcolorbox}    

\begin{document}
\begin{tcolorbox}[enhanced,opacitytext=0.0,tikz={opacity=0}]
\begin{align}
\frac{a}{b}=\underline{c}
\end{align}
\end{tcolorbox}

\begin{tcolorbox}[enhanced,opacitytext=0.0]
\begin{align}
\frac{a}{b}=\underline{c}
\end{align}
\end{tcolorbox}

\end{document}

enter image description here

1

I don't really get what you really need (might be an X-Y problem), but the following code hides the complete contents of your colorbox:

\documentclass{scrartcl}
\usepackage[most]{tcolorbox}
\usepackage{amsmath}

\begin{document}
    \begin{tcolorbox}[enhanced] %now optional: opacitytext=0
        \phantom{%
            \begin{minipage}{\columnwidth}%
                \begin{align}
                    \frac{a}{b}=\underline{c}
                \end{align}
        \end{minipage}%
    }%
    \end{tcolorbox}
\end{document}

Explanation:

  • \phantom occupies the space of its contents, but does not display it
  • minipage makes it possible to use align in the \phantom
  • 1
    The disadvantage of this solution is that one has to use \phantom each time explicitly for all boxes for which the content should be hidden. – user31729 Sep 28 '17 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.