3

I'd like to add a shading angle (like tikz nodes: shading angle=45) to a tcolorbox environment. Is that possible?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[dvipsnames,svgnames]{xcolor}
\usepackage{lipsum}


\usepackage{tcolorbox}
\tcbuselibrary{skins}
\newtcolorbox{boxed}{enhanced,
    interior style={left color=SpringGreen,right color=Dandelion},frame hidden,width=0.8\textwidth,center,drop shadow}

%\tcbset{boxed/.style={shading angle=120}}


\begin{document}


\begin{boxed}
\lipsum[1]

\end{boxed}

\end{document}
4

Do you mean something like this:

enter image description here

If this is what you want then you just need to add shading angle=45 to the specifications for boxed:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[dvipsnames,svgnames]{xcolor}
\usepackage{lipsum}


\usepackage{tcolorbox}
\tcbuselibrary{skins}
\newtcolorbox{boxed}{
    enhanced,
    interior style={left color=SpringGreen,
                    right color=Dandelion,
                    shading angle=45},
    frame hidden,width=0.8\textwidth,center,drop shadow
}

\begin{document}

  \begin{boxed}
  \lipsum[1]
  \end{boxed}

\end{document}
  • I didn't know it was as easy as in a tiz node. I couldn't find this option in the tcolorbox manual. – Joseph Nov 2 '17 at 17:44
  • 1
    @Joseph I don't think that it is in the tcolorbox manual but tcolorbox often builds on tikz so when in doubt try adding tikz styling:) – Andrew Nov 2 '17 at 17:50

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.