[Tex/LaTex] Why can’t I put a comma in a \newtcolorbox

tcolorbox

When I try to put a "," in the mybox environment, I get the error:

! Package pgfkeys Error: I do not know the key '/tcb/FM and PM and Narrowband F
M' and I am going to ignore it. Perhaps you misspelled it.

Is there a way to put a comma "," in the tcolorbox header so that my header appears as: Angle, FM, and PM and Narrowband FM?

CODE

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage[table]{xcolor}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{amssymb,amsthm}
\usepackage{lipsum}
\usepackage{minibox}
\usepackage[most]{tcolorbox}

\advance\topmargin-1in
\advance\textheight3in
\advance\textwidth3in
\advance\oddsidemargin-1.5in
\advance\evensidemargin-1.5in
\parindent0pt
\parskip2pt
\newcommand{\hr}{\centerline{\rule{3.5in}{1pt}}}

\begin{document}

\begin{multicols*}{3}

\newtcolorbox{mybox}[2][]{text width=0.97\textwidth,fontupper=\scriptsize,
fonttitle=\bfseries\sffamily\scriptsize, colbacktitle=black,enhanced,
attach boxed title to top left={yshift=-2mm,xshift=3mm},
boxed title style={sharp corners},top=3pt,bottom=2pt,
  title=#2,colback=white}

%%------------ Angle, FM and PM and Narrowband FM ---------------
\hspace{-0.2cm}
\begin{minipage}{0.31\textwidth}
    \begin{mybox}{Angle FM and PM and Narrowband FM}

\lipsum[2]

    \end{mybox}
\end{minipage}

\end{multicols*}
\end{document}

Best Answer

Just put the title with the comma into two more { }, otherwise, I think tcolorbox thinks there is another parameter.

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage[table]{xcolor}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{amssymb,amsthm}
\usepackage{lipsum}
\usepackage{minibox}
\usepackage[most]{tcolorbox}

\advance\topmargin-1in
\advance\textheight3in
\advance\textwidth3in
\advance\oddsidemargin-1.5in
\advance\evensidemargin-1.5in
\parindent0pt
\parskip2pt
\newcommand{\hr}{\centerline{\rule{3.5in}{1pt}}}

\begin{document}

\begin{multicols*}{3}

\newtcolorbox{mybox}[2][]{text width=0.97\textwidth,fontupper=\scriptsize,
fonttitle=\bfseries\sffamily\scriptsize, colbacktitle=black,enhanced,
attach boxed title to top left={yshift=-2mm,xshift=3mm},
boxed title style={sharp corners},top=3pt,bottom=2pt,
  title=#2,colback=white}

%%------------ Angle, FM and PM and Narrowband FM ---------------
\hspace{-0.2cm}
\begin{minipage}{0.31\textwidth}
    \begin{mybox}{{Angle, FM and PM and Narrowband FM}}

\lipsum[2]

    \end{mybox}
\end{minipage}

\end{multicols*}
\end{document}

enter image description here

Related Question