I defined my own tcolorbox as in the following MWE but I would like to put inside the tcolorbox a default title and change it a will.
For example if I write
\begin{notabene}
\lipsum[1]
\end{notabene}
the box should show the default title "Remarks", but if I write:
\begin{notabene}{NB}
\lipsum[1]
\end{notabene}
the box should have the title "NB".
I have read the tcoulorbox manual but I didn't succeed to understand how to do that!
Thanks in advance for your eventual help.
Nino
\documentclass[justified,notoc,numbers]{tufte-handout}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{color}
\usepackage[most]{tcolorbox}
%-----------FOR DEMO-----------
\usepackage{lipsum}
\definecolor{myColor}{rgb}{0.0, 0.5, 1.0}
\newtcolorbox{notabene}[2][]
{
breakable,
enhanced,
borderline west={2pt}{0pt}{myColor},
sharp corners,
boxrule=0pt,
fonttitle={\large\bfseries},
coltitle={black},
title= {\textcolor{myColor}{#2}\\},
attach title to upper,
right=0pt,
top=0pt,
bottom=0pt,
frame hidden,
#1,
}
%=======================================================
% DOCUMENT
%=======================================================
\begin{document}
\begin{notabene}
\lipsum[1]
\end{notabene}
\begin{notabene}{NB}
\lipsum[1]
\end{notabene}
\end{document}
\begin{env}[<optional arg>]{<required arg>}
. If you want to make the required argument into an optional argument, the syntax will be ambiguous. In particular, you'd have to write\begin{notabene}[][Non-Default]
if you wanted to use a non-default title but otherwise stick to the default settings, because\begin{notabene}[Non-Default]
will be interpreted as an attempt to set the keyNon-Default
. So what should the interface look like?