# Set line spacing in tcolorbox

My entire document is double spaced. But I want the content in my \tcolorbox to be single spaced. Is this possible? I am not seeing anything in the documentation regarding line spacing.

• How did you set double space? – a user Nov 12 '14 at 23:59
• A global \doublespacing command, part of the setspace package (i think) – Robin Donatello Nov 17 '14 at 0:47

You can use code key provided by tcolorbox

\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{kantlipsum}
\usepackage{setspace}
\doublespacing
\begin{document}
\kant[1]
\noindent
\begin{tcolorbox}[enhanced,boxsep=3pt,code={\singlespacing}]
\kant[2]
\end{tcolorbox}
\kant[3]
\end{document}


Regarding comment, the following works for me

\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{kantlipsum}
\usepackage{setspace}
\newtcolorbox{mybox}[1][]{
enhanced,
boxsep=3pt,
code={\singlespacing},
#1}
\doublespacing
\begin{document}
\kant[1]
\noindent
\begin{mybox}
\kant[2]
\end{mybox}
\kant[3]
\end{document}

• Great, this works. At least I can reproduce your example. Now to try to piece this into my current document and find out what it's conflicting with. (I put just the code= piece in and it wouldn't compile) – Robin Donatello Nov 17 '14 at 0:48
• Ah, i see. I want the singlespacing definition in the \newtcolorbox statement, so I don't have to define it each time. Simply copying boxsep and code= into the \newtcolorbox [] options is what's throwing the error. -How can I specify singlespace as a default option in \newtcolorbox? – Robin Donatello Nov 17 '14 at 0:51
• @RobinJ Please see the update. – user11232 Nov 17 '14 at 4:18
• Yes! I see the correlation between adding options at the time the box is called and the initial definition. Thanks tons! Worked exactly the way I want. – Robin Donatello Nov 18 '14 at 20:09