1

With reference to two previous questions A specific format for nice tables and Some adjustments of a nice table of mine to which I had an excellent answer from all users, I for example used a combination of the code of @Zarko and @marmot.
I obviously chose a part of my very long code to be used to create a compilable MWE. If I compile this extract I already have errors:

LaTeX Error: Option clash for package xcolor. [\definecolor]

Undefined control sequence. [\arrayrulecolor]

LaTeX Error: Missing \begin{document}. [\arrayrulecolor{t]

\documentclass[a4paper,12pt,italian]{article}
\usepackage{babel,newtxtext}
\usepackage{mathtools,amssymb,isotope,tikz}
\usepackage[svgnames,dvipsnames,table,x11names]{xcolor} 
\definecolor{mgreen}{RGB}{150,196,95}
\definecolor{nteal}{RGB}{60,172,147}
\usepackage[labelformat=simple]{caption}
\usepackage[labelformat=simple]{subcaption}
\definecolor{nteal}{RGB}{60,172,147}
%%%%%%%%%%%%%%% @Zarko code %%%%%%%%%%%%%%%

\usepackage{booktabs, makecell, threeparttable}       % <---
\setlength\heavyrulewidth{2pt}    % <---
\setlength\lightrulewidth{1.2pt}  % <---
\setcellgapes{3pt}
\renewcommand\theadfont{\normalsize\bfseries}
\renewcommand\theadgape{}
\arrayrulecolor{teal}
\usepackage[skip=0.5ex]{caption}
\DeclareCaptionLabelFormat{uc}{\MakeUppercase{#1}~#2} 
\DeclareCaptionFont{cond}{\color{nteal}\fontfamily{CabinCondensed-TLF}\selectfont}
\DeclareCaptionFont{teal}{\color{black}\fontfamily{ptm}\selectfont}
\captionsetup[table]{font={small},
                     labelformat=uc,
                     labelfont={cond,bf},
                     textfont=teal,
                     singlelinecheck=off}

%%%%%%%%%%%%%%% @marmot code %%%%%%%%%%%%%%%


\DeclareCaptionFormat{Sebastiano}{%#1#2\par
{\tikz[remember picture,baseline=-0.5ex]{%
\node[fill=mgreen,text=white,font=\bfseries\sffamily\large,rounded
corners=0.2em,minimum width=1.8em,minimum height=1.8em](M){#1};
\draw[very thick,mgreen] (M.west) -- ++ (-1,0);}}%
\hfill\hfill{\tikz[remember picture,overlay]{\coordinate(R);
\draw[very thick,mgreen] (M.east) -- (M.east-|R);
}}\par
#3} 
\DeclareCaptionFormat{Incredibile}{%#1#2\par
{\tikz{%
\node[text width=\linewidth-4pt,outer xsep=1.6pt,align=justify](MI){\textbf{\sffamily#1#2}#3};
\draw[very thick,mgreen] (MI.north west) -- (MI.south west)
(MI.north east) -- (MI.south east);
}}\par
} 
\captionsetup{format=Incredibile}
\captionsetup[sub]{format=Sebastiano}
\newcommand{\IncludeClippedGraphics}[2][]{\begin{tikzpicture} 
\node[rounded corners=5pt,clip,preaction={draw=mgreen,very thick},inner sep=-2pt]{%
\includegraphics[#1]{#2}}; 
\end{tikzpicture}}


\begin{document}
\begin{table}[htb]
\captionsetup{justification=centering}
\caption{Le quattro serie radioattive con $n\in \mathbb{N}$.}
\makegapedcells
\centering
\begin{tabular}{cccc}
\toprule
\thead{Numeri\\ di massa}
        & \thead{Elemento\\ chimico}
                        & \thead{Prodotto\\ iniziale}
                                                    & \thead{Prodotto\\ finale}\\
    \midrule
$4n$    &  Torio        &   \isotope[232][90]{Th}   &   \isotope[208][82]{Pb}   \\
$4n+1$  &  Neptunio     &   \isotope[237][93]{Np}   &   \isotope[209][83]{Bi}   \\
$4n+2$  &  Uranio       &   \isotope[238][92]{U}    &   \isotope[206][82]{Pb}   \\
$4n+3$  &  Attinio      &   \isotope[235][92]{U}    &   \isotope[207][82]{Pb}   \\
    \bottomrule
\end{tabular}
\end{table}
\end{document}

At this moment I do not understand how to fix the errors and if I have forgotten to insert some package or macro indispensable. It is no coincidence that the rows are not colored.

enter image description here

The thing I don't understand is that in my structure.tex file where there are all the packages and macros, during the compilation of my book, I observed that not loaded the font CabinCondensed-TLF,

enter image description here using this extract

\DeclareCaptionLabelFormat{uc}{\MakeUppercase{#1}~#2} 
\DeclareCaptionFont{cond}{\color{nteal}\fontfamily{CabinCondensed-TLF}\selectfont}
\DeclareCaptionFont{teal}{\color{black}\fontfamily{ptm}\selectfont}
\captionsetup[table]{font={small},
                     labelformat=uc,
                     labelfont={cond,bf},
                     textfont=teal,
                     singlelinecheck=off}

A month ago everything worked perfectly but now I don't understand the motivation and how to solve the problem.

  • LaTeX Error: Option clash for package xcolor. [\definecolor] that is not the format of a latex error message. show the error from the log file (the help text for that messgae tells you what the clashing options are). Undefined control sequence. [\arrayrulecolor] that is also not the format of a tex error message but if you mean that arrayrulecolor is undefined you need colortbl package. – David Carlisle Jul 1 at 20:44
  • Is cabin your default sans font, or do you want to set it so? – Bernard Jul 1 at 21:36
  • @Bernard Kind Bernard for the text I use newtxtext, for the caption of the images I use urw-classico (clone of Optima font). For example: Fig. 1 (Optima) text (newtxtext). For tables there was CabinCondensed-TLF + newxtext. I currently I have not understand because this font no works as before (see my answer for @David where I have added the screenshots). For me another different font but nice is fine, the important thing is that it is different. – Sebastiano Jul 1 at 21:43
  • I asked the question, because I can make the label with Cabin Condensed (which is a nice font I sometimes use, b.t.w.), but I have to load the cabin package, which makes Cabin the default sans font. – Bernard Jul 1 at 21:58
  • I've posted a simple solution for the label font and the option clash, which doesn't require loading cabin. Is it what you want? – Bernard Jul 1 at 22:17
1

Here a solution for the label font and the options clash:

    \documentclass[a4paper, 12pt ,italian]{article}
    \usepackage{babel,newtxtext}
    \PassOptionsToPackage{svgnames, dvipsnames, table, x11names}{xcolor}
    \usepackage{mathtools, amssymb, isotope, tikz}

    \definecolor{mgreen}{RGB}{150,196,95}
    \definecolor{nteal}{RGB}{60,172,147}
    \usepackage[labelformat=simple]{caption}
    \usepackage[labelformat=simple]{subcaption}
    \definecolor{nteal}{RGB}{60,172,147}
    %%%%%%%%%%%%%%% @Zarko code %%%%%%%%%%%%%%%

    \usepackage{booktabs, makecell, threeparttable} % <---
    \setlength\heavyrulewidth{2pt} % <---
    \setlength\lightrulewidth{1.2pt} % <---
    \setcellgapes{3pt}
    \renewcommand\theadfont{\normalsize\bfseries}
    \renewcommand\theadgape{}
    \arrayrulecolor{teal}
    \usepackage[skip=0.5ex]{caption}
    \DeclareCaptionLabelFormat{uc}{\MakeUppercase{#1}~#2}
    %\DeclareCaptionFont{cond}{\color{nteal}\fontfamily{CabinCondensed-TLF}\selectfont}
    \DeclareCaptionFont{cond}{\color{nteal}\usefont{T1}{Cabin-TLF}{condensed}{sc}}
    \DeclareCaptionFont{teal}{\color{black}\fontfamily{ptm}\selectfont}
    \captionsetup[table]{font={small},
                         labelformat=uc,
                         labelfont={cond,bf},
                         textfont=teal,
                         singlelinecheck=off}

    %%%%%%%%%%%%%%% @marmot code %%%%%%%%%%%%%%%


    \DeclareCaptionFormat{Sebastiano}{%#1#2\par
    {\tikz[remember picture,baseline=-0.5ex]{%
    \node[fill=mgreen,text=white,font=\bfseries\sffamily\large,rounded
    corners=0.2em,minimum width=1.8em,minimum height=1.8em](M){#1};
    \draw[very thick,mgreen] (M.west) -- ++ (-1,0);}}%
    \hfill\hfill{\tikz[remember picture,overlay]{\coordinate(R);
    \draw[very thick,mgreen] (M.east) -- (M.east-|R);
    }}\par
    #3}
    \DeclareCaptionFormat{Incredibile}{%#1#2\par
    {\tikz{%
    \node[text width=\linewidth-4pt,outer xsep=1.6pt,align=justify](MI){\textbf{\sffamily#1#2}#3};
    \draw[very thick,mgreen] (MI.north west) -- (MI.south west)
    (MI.north east) -- (MI.south east);
    }}\par
    }
    \captionsetup{format=Incredibile}
    \captionsetup[sub]{format=Sebastiano}
    \newcommand{\IncludeClippedGraphics}[2][]{\begin{tikzpicture}
    \node[rounded corners=5pt,clip,preaction={draw=mgreen,very thick},inner sep=-2pt]{%
    \includegraphics[#1]{#2}};
    \end{tikzpicture}}

    \begin{document}

    \begin{table}[htb]
    \captionsetup{justification=centering}
    %\caption{\fontfamily{CabinCondensed-TLF}\selectfont Le quattro serie radioattive con $n ∈ \mathbb{N}$.}
    \caption{Le quattro serie radioattive con $n ∈ \mathbb{N}$.}
    \makegapedcells
    %\caption{\fontfamily{CabinCondensed-TLF}\selectfont Le quattro serie radioattive con $n ∈ \mathbb{N}$.}
    \centering
    \begin{tabular}{cccc}
    \toprule
    \thead{Numeri\\ di massa}
            & \thead{Elemento\\ chimico}
                            & \thead{Prodotto\\ iniziale}
                                                        & \thead{Prodotto\\ finale}\\
        \midrule
    $4n$ & Torio & \isotope[232][90]{Th} & \isotope[208][82]{Pb} \\
    $4n+1$ & Neptunio & \isotope[237][93]{Np} & \isotope[209][83]{Bi} \\
    $4n+2$ & Uranio & \isotope[238][92]{U} & \isotope[206][82]{Pb} \\
    $4n+3$ & Attinio & \isotope[235][92]{U} & \isotope[207][82]{Pb} \\
        \bottomrule
    \end{tabular}
    \end{table}

    \end{document} 

enter image description here

3

The first error message is

l.5 \definecolor
                {mgreen}{RGB}{150,196,95}
? h
The package xcolor has already been loaded with options:
  []
There has now been an attempt to load it with options
  [svgnames,dvipsnames,table,x11names]
Adding the global options:
  ,svgnames,dvipsnames,table,x11names
to your \documentclass declaration may fix this.
Try typing  <return>  to proceed.
? 

actually the issue is that xcolor is loaded by tikz so you can't load it later with different options, load it earlier:

\usepackage[svgnames,dvipsnames,table,x11names]{xcolor} 
\usepackage{mathtools,amssymb,isotope,tikz}

The document then runs without error.

  • Thank you very much for your support. But do you get the character CabinCondensed-TLF back in the table? +1 for the previous answer. – Sebastiano Jul 1 at 21:05
  • Using Papeeria TeX-Live 2019(new) I have the same problem of the unloaded character CabinCondensed-TLF: LaTeX Font Warning: Font shape T1/CabinCondensed-TLF/bx/n' undefined(Font) using T1/cmr/m/n' instead on input line 59. – Sebastiano Jul 1 at 21:10
  • I get LaTeX Font Warning: Font shape T1/CabinCondensed-TLF/bx/n' undefined` which isn't surprising as I have neither the font nor a latex fd file for it. You presumably had the font if you had it working – David Carlisle Jul 1 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.