Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using tcolorbox and using pgfkeys to set some of the tikz options. But they do not seem to be working. Consider the MWE given below. If I set draw color using \pgfkeys{/tikz/.cd, fill=red, draw=green, color=blue} the color is not set and the overlay has black color, as if no color is set. Neither the \tikzset nor the \pgfkeys seems to be working. If I set color in \draw command, it is working. What's missing ?

\documentclass{book}
\usepackage{tcolorbox}
\usepackage{lipsum}
\usepackage{hyperref}

\tcbuselibrary{breakable}
\tcbuselibrary{skins}
\tcbuselibrary{listings}

\begin{document}
\tikzset{fill=red, draw=brown}
\begin{tcolorbox}[enhanced,
  overlay={%
    \begin{tcbclipinterior}%
      \pgfkeys{/tikz/.cd, fill=red, draw=green, color=blue}
      \draw[line width=0.5cm] (interior.north west) -- (interior.south east);%
      \draw[line width=0.5cm] (interior.south west) -- (interior.north east);%
    \end{tcbclipinterior}%
}]
\lipsum[1]
\end{tcolorbox}

\end{document}
share|improve this question
    
Do you want to do \tikzset{every path/.append style={fill=red, draw=green, color=blue}}? Are you aware that the color option overwrites any previous set fill and draw color and that a straight line will not have any area to fill? –  Qrrbrbirlbel Aug 24 '13 at 5:31
    
I'm aware color option overwrites previous set fill and draw color. What I was expecting is some color to show up instead of black. If I remove color=blue, draw color is still defined and I want to see the green color lines in the interior. –  Surya Aug 24 '13 at 5:39
    
Well, the options only apply to the current path and not to following paths (hence the every path style). Could you elaborate what you want to achieve? I don’t know the tcolorbox package but I assume that they are styles, settings or macros to change the visual outcome of the box. –  Qrrbrbirlbel Aug 24 '13 at 5:47
    
I'm trying to give user an option to set color and hence trying to set the color through pgfkeys. every path answered my question. Thx –  Surya Aug 24 '13 at 5:59
add comment

1 Answer

I'm not sure about the exact question, but I don't see any problem defining a style which can be later used inside overlay.

\documentclass{book}
\usepackage{tcolorbox}
\usepackage{lipsum}
\usepackage{hyperref}

\tcbuselibrary{breakable}
\tcbuselibrary{skins}
\tcbuselibrary{listings}

\begin{document}

\tikzset{mystyle/.style={fill=red, draw=brown}}

\begin{tcolorbox}[enhanced,
  overlay={%
    \begin{tcbclipinterior}%
%      \pgfkeys{/tikz/.cd, fill=red, draw=green, color=blue}
      \draw[mystyle,line width=0.5cm] (interior.north west) -- (interior.south east);%
      \draw[mystyle,line width=0.5cm] (interior.south west) -- (interior.north east);%
    \end{tcbclipinterior}%
}]
\lipsum[1]
\end{tcolorbox}

\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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