Graphics, Figures & TablesTitle parameter in tcolorbox

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
lrPrentice
Posts: 7
Joined: Mon Feb 26, 2018 9:05 pm

Title parameter in tcolorbox

Post by lrPrentice »

Hello,

New to tcolorbox and struggling.

Thanks to help from Paul Rubin I've defined a color box for displaying computer code as follows:

New Color Box Type cBoxA2colback=gray!25!white, colbacktitle=black, colframe=black!75!black,fonttitle=\bfseries, title=\listno\,comment, width=\textwidth

It mostly works except for two issues. Here I'll only inquire about the first issue:

Issue 1:

\listno\ is a macro I've defined to display chapter number:listing number: e.g. "Listing 2.1". That works. But rather than the hard-coded "comment," I need to insert the comment as a parameter in each new listing: e.g. Listing 2.1 <comment specific to this listing>.

But despite hours of Google search and study of tcolorbox manual, I can't figure out how to do it.

Can some kind soul point the way?

Many thanks,

Lloyd R. Prentice

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Title parameter in tcolorbox

Post by Stefan Kottwitz »

Hi Lloyd,

welcome to the forum!

Do you have some code that we can compile and test? (Infominimal working example)

Stefan
LaTeX.org admin
dmtc73
Posts: 1
Joined: Mon Dec 12, 2022 11:35 am

Title parameter in tcolorbox

Post by dmtc73 »

Hi, I am also struggling with this.

Is there a way to override the title or allow it to be defined when it is used?

The code I have is

Code: Select all

\newtcolorbox{mytcolorbox}{colback=green!10,enhanced,title=Areas to Consider are, attach boxed title to top left={xshift=-4mm}, fonttitle=\bfseries}
then later on it the document I use it as follows

Code: Select all

\begin{mytcolorbox}
        \begin{itemize}
            \item[\S] - list 1
            \item[\S] - list 2          
        \end{itemize}
\end{mytcolorbox}
As fast I know I need the title as I want it to be in the top left and so it requires a value, but I cannot override it or allow it be entered later.

Anyone have any ideas?

Thanks,

Darryl
Last edited by Stefan Kottwitz on Mon Dec 12, 2022 5:03 pm, edited 1 time in total.
Reason: code marked
Post Reply