1

Good day! Here I want transparent background in tcolorbox, when box comes inside the box or page color applied case. Here I used yellow color background box, so I required yellow background, I can't make second box color into transparent. If any option is there to change the background color using tcolorbox. Please do the needful.

enter image description here

\documentclass[12pt]{article}

\RequirePackage[most]{tcolorbox}
\usetikzlibrary{patterns,shadows}

\newenvironment{Boxone}{\begin{tcolorbox}[colback=yellow!30,colbacklower=white,]
}{\end{tcolorbox}}

\newenvironment{Boxtwo}{\begin{tcolorbox}[colback=white,colbacklower=white]
}{\end{tcolorbox}}


\begin{document}

\begin{Boxone}
A patient asks you how many medicines they need to swallow to take all their morning medicines. They have the following medicines to take:
\begin{Boxtwo}
A patient asks you how many medicines they need to swallow to take all their morning medicines. They have the following medicines to take:
\end{Boxtwo}
\end{Boxone}

\end{document}
0

1 Answer 1

3

With enhanced jigsaw and opacityback, you can make the tcolorbox transparent. Btw I have no idea why you want to use colbacklower here...

\documentclass[12pt]{article}

\RequirePackage[most]{tcolorbox}
\usetikzlibrary{patterns,shadows}

\newenvironment{Boxone}{\begin{tcolorbox}[colback=yellow!30]
}{\end{tcolorbox}}

\newenvironment{Boxtwo}{\begin{tcolorbox}[opacityback=0,enhanced jigsaw]
}{\end{tcolorbox}}


\begin{document}

\begin{Boxone}
A patient asks you how many medicines they need to swallow to take all their morning medicines. They have the following medicines to take:
\begin{Boxtwo}
A patient asks you how many medicines they need to swallow to take all their morning medicines. They have the following medicines to take:
\end{Boxtwo}
\end{Boxone}

\begin{Boxtwo}
A patient asks you how many medicines they need to swallow to take all their morning medicines. They have the following medicines to take:
\end{Boxtwo}
\end{document}

Inside an yellow box:

enter image description here

Not inside anything:

enter image description here


However, you should not use (or at least I don't recommend you to use) \newenvironment to define a new tcolorbox. The package has a macro for it.

\documentclass[12pt]{article}
\usepackage[most]{tcolorbox}
\usetikzlibrary{patterns,shadows}
\newtcolorbox{Boxone}{colback=yellow!30}
\newtcolorbox{Boxtwo}{opacityback=0,enhanced jigsaw}
\begin{document}
\begin{Boxone}
A patient asks you how many medicines they need to swallow to take all their morning medicines. They have the following medicines to take:
\begin{Boxtwo}
A patient asks you how many medicines they need to swallow to take all their morning medicines. They have the following medicines to take:
\end{Boxtwo}
\end{Boxone}

\begin{Boxtwo}
A patient asks you how many medicines they need to swallow to take all their morning medicines. They have the following medicines to take:
\end{Boxtwo}
\end{document}
3
  • Thanks Joule for valuable, your answer exactly fulfill my requirement :). May 9, 2019 at 6:00
  • @RajeshKumar Glad to hear that. However, please see my renewed answer. I made some notes to you.
    – user156344
    May 9, 2019 at 7:58
  • Yeah I got it, surely I will follow the same in future style definition using tcolorbox May 10, 2019 at 6:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .