I'm trying to put a option through another macro in a tcolorbox environment like this:
\documentclass{article} \usepackage[many]{tcolorbox} \usepackage{lipsum} \newcommand{\tcboption}{colback=blue} \newcommand{\bubble}[1]{% \begin{tcolorbox}[% \tcboption] #1 \end{tcolorbox} } \begin{document} \bubble{\lipsum[1][1-2]} \end{document} that doesn't work, it says: ! Package pgfkeys Error: I do not know the key '/tcb/colback=blue' and I am going to ignore it. Perhaps you misspelled it. This might be a common mistake but so far i've found no solution, even in #latex in freenode.
UPDATE here i upgrade my example to something closer to my real macro. Following is one of the solution provided by others put in practice into it.
\usepackage{xargs} %[ ... ] \newcommand{\myoption}[1][]{% \ifthenelse{\equal{#1}{line}}{% skin=enhanced, finish={\draw[blue, thin,-] (0,0) -- +(0,-10); }, }{} } \newcommandx{\bubblex}[4][1=20em, 2=, usedefault]{% \begin{tcolorbox}[ width=#1, \myoption{#2}, title=3,fonttitle=\bfseries] #4 \end{tcolorbox} } Solution:
\tcbset{ tcboption/.style={skin=enhanced, finish={\draw[blue, thin,-] (0,0) -- +(0,-10); }}, } \newcommandx{\bubblex}[4][1=20em, 2=, usedefault]{% \begin{tcolorbox}[ width=#1, #2, title=3,fonttitle=\bfseries] #4 \end{tcolorbox} } \begin{document} \bubble[][tcboption]{\lipsum[1][1-2]} \end{document} It works even when when i leave the the second optional arg. of \bubblex empty, which is what i wanted. I though the comma after #2 in the macro definition would cause an error.
