# Why some commands in \tcolorbox do not work?

For example, when trying to center the title of a box, the manual says that I should use halign title = center in the options of the box, for example, like this:

\documentclass{article}
\usepackage{tcolorbox}

\newenvironment{Myblock}[1]{\tcolorbox[noparskip,colback=red!5!white,colframe=green!45!black,arc=1mm,title=#1,halign title = center]}{\endtcolorbox}

\begin{document}

\begin{Myblock}{Title}
Some text
\end{Myblock}

\end{document}


Yet, that does not work. I get the error:

Package pgfkeys Error: I do not know the key '/tcb/halign title' and I am going to ignore it. Perhaps you misspelled it. ...1 and 2: ...


However, the command center title works instead. Why does not the manual apply to me? Do I have an older version of the tcolorbox Package?

• your example generates the error ! LaTeX Error: Command \newbox already defined. and ! LaTeX Error: \begin{newblock} on input line 8 ended by \end{beamerblock3} Jul 15, 2015 at 15:48
• If I use zzz as the environment name it runs without error, we can not know if you have an old version as you have not shown the relevant line from the log file that shows the tcolorbox version. Jul 15, 2015 at 15:54
• So sorry. Now I edited the question. I was in a rush. Jul 17, 2015 at 10:40

Once you change the name, since \newbox is already defined by TeX and your document warns tou about this:

! LaTeX Error: Command \newbox already defined.
Or name \end... illegal, see p.192 of the manual.


and use the proper name for the environment in your document, as in

\begin{Newbox}{Title}
Some text
\end{Newbox}


and not with \begin{newblock} \end{beamerblock3} which your original coe had, you'll see it works:

\documentclass{article}
\usepackage{tcolorbox}

\newenvironment{Newbox}[1]
{\tcolorbox[noparskip,colback=red!5!white,colframe=green!45!black,arc=1mm,title=#1,halign title = center]}
{\endtcolorbox}

\begin{document}

\begin{Newbox}{Title}
Some text
\end{Newbox}

\end{document}


However, this part of the error message you report

I do not know the key '/tcb/halign title' and I am going to ignore it.


suggests that you are using an outdated version of tcolorbox. Update to the latest version (2015/06/12 version 3.61 at the moment of this answer).

• I updated the code so you can remove the first part of your post. You are right. I am using version 2.7. I just realized that I need to update my whole TexLive distribution! For a complete answer, you could indicate a link to a page about how to update individual packages or full distros. Jul 17, 2015 at 10:51