[Tex/LaTex] A specific format for nice tables

colorfontsnewtxtables

With this code:

enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage{mathtools,amssymb}
\usepackage{booktabs, isotope}
\begin{document}
\begin{center}
\begin{tabular}{lcc}
\toprule
\textbf{Osservabile} & \textbf{Simbolo} & \textbf{Operatore associato} \\
\toprule
Posizione & $\bar{r}$ & $\bar{r}$ \\
Momento & $\bar{p}$ & $-i\hslash \overline \nabla$ \\
Energia potenziale & $  \mathcal{U}$ &  $\mathcal{U}(r)$ \\
Energia cinetica & $\mathcal{K}$ &  $-\dfrac{\hslash^2}{2m}\nabla^2$ \\
Hamiltoniana & $H$ & $-\dfrac{\hslash^2}{2m}\nabla^2+\mathcal{U}(r)$\\
Energia totale & $E$ & $-i\hslash\dfrac{\partial}{\partial t}$\\
\bottomrule
\end{tabular}
\end{center}
\vskip 1cm
\begin{center}
\begin{tabular}{cccc}
\toprule
\textbf{Numeri di massa} & \textbf{Elemento chimico} & \textbf{Prodotto iniziale} & \textbf{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{center}
\end{document}

I'm finding to create two tables that they have the same structure of the below picture:

enter image description here

1. I would like to create as the upper image, the label (same color) of the table in upper case with a different character (I use into my book URW Classic as Sans Serif character (\fontfamily) and by default as normal text character is newtxtext, the clone of Times).

See this example for the figure below:

enter image description here

2. A thicker line with the same color as the image if possible;

3. The comment of the table must be with the character newtxtext;

4. A slightly larger space between rows in my second table. Precisely between one chemical element and the other below.

Thank you very much.

Best Answer

see, if the following solution is close to what you after:

\documentclass[a4paper,12pt]{article} % <---
\usepackage{mathtools,amssymb}                % <---
\usepackage{booktabs, 
            makecell}                         % <---
\setcellgapes{3pt}                            % <---
\usepackage{isotope}
\usepackage[table]{xcolor}                    % <---
\arrayrulecolor{teal}                         % <--- 

\usepackage[skip=1ex]{caption}                % <---
    \DeclareCaptionFont{teal}{\color{teal}}   % <---
    \captionsetup[table]{font=bf,             % <---
                         labelfont={teal,bf},
                         singlelinecheck=off}

\begin{document}
    \begin{table}[htb]              % <---
    \makegapedcells                 % <---
    \caption{My fancy table}        % <---
\begin{tabular}{l*{2}{>{$}c<{$}}}   % <---
    \toprule[2pt]                   % toprule thickens you can change according 
                                    % to your taste, for example to 3pt or more
\textbf{Osservabile} & \textbf{Simbolo} & \textbf{Operatore associato}  \\
    \midrule
Posizione           & \bar{r}       & \bar{r}                           \\
Momento             & \bar{p}       & -i\hslash \overline \nabla        \\
Energia potenziale  & \mathcal{U}   & \mathcal{U}(r)                    \\
Energia cinetica    & \mathcal{K}   & -\dfrac{\hslash^2}{2m}\nabla^2    \\
Hamiltoniana        & H             & -\dfrac{\hslash^2}{2m}\nabla^2+\mathcal{U}(r) \\
Energia totale      & E             & -i\hslash\dfrac{\partial}{\partial t}         \\
    \bottomrule
\end{tabular}
    \end{table}

    \begin{table}[htb]
    \caption{My another fancy table}
\makegapedcells
\begin{tabular}{cccc}
    \toprule[2pt]      % <---
\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

so far i consider only tables in your mwe (it not contain your table 13.1, if you will provide code for this table content, i will show solution example for it too)

edit: differences between above and your mwe are indicated by % <---. as you can see, above are added packages xcolor for coloring table rules as well font for tables' labels, makecell for adding more vertical spaces around cells contents and for macro \thead, which enable to write column heads in two (or more, if necessary) lines, caption for defining caption style (font family and color, positioning of caption).

in above mwe tables are not horizontally centered. if you like to have them centered, just add \centering after \begin{table}[...]. but in this case the caption will be aligned with left text border. for aligning it width beginning of table, you should use threeparttable as shown in mwe below. in it is also added a way how to select font used in caption and have upper case font in caption label (indicaed by % <===). so far i select iwona, but you can replace it with font of your wish. also the thikness of rules are defined globally.

\documentclass[a4paper,12pt,italian]{article}
\usepackage{babel}
\usepackage{mathtools,amssymb}
\usepackage{booktabs, makecell, 
            threeparttable}       % <---
\setlength\heavyrulewidth{2pt}    % <---
\setlength\lightrulewidth{1.2pt}  % <---

\setcellgapes{3pt}
\renewcommand\theadfont{\normalsize\bfseries}
\renewcommand\theadgape{}

\usepackage{isotope}
\usepackage[table]{xcolor}
\arrayrulecolor{teal}
\usepackage[skip=0.5ex]{caption}
    \DeclareCaptionLabelFormat{uc}{\MakeUppercase{#1}~#2}                % <===
    \DeclareCaptionFont{teal}{\color{teal}\fontfamily{iwona}\selectfont} % <===
    \captionsetup[table]{font={large,teal,bf},
                         labelformat=uc,                                 % <===
                         singlelinecheck=off}                               

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{table}[htb]
    \centering                  % <---
   \begin{threeparttable}       % <---
    \caption{My fancy table}
\makegapedcells
\begin{tabular}{l*{2}{>{$}c<{$}}}
    \toprule
\textbf{Osservabile} & \textbf{Simbolo} & \textbf{Operatore associato}  \\
    \midrule
Posizione           & \bar{r}       & \bar{r}                           \\
Momento             & \bar{p}       & -i\hslash \overline \nabla        \\
Energia potenziale  & \mathcal{U}   & \mathcal{U}(r)                    \\
Energia cinetica    & \mathcal{K}   & -\dfrac{\hslash^2}{2m}\nabla^2    \\
Hamiltoniana        & H             & -\dfrac{\hslash^2}{2m}\nabla^2+\mathcal{U}(r) \\
Energia totale      & E             & -i\hslash\dfrac{\partial}{\partial t}         \\
    \bottomrule
\end{tabular}
    \end{threeparttable}        % <---
    \end{table}

    \begin{table}[htb]
    \centering                  % <---
   \begin{threeparttable}       % <---
    \caption{My another fancy table}
\makegapedcells
\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{threeparttable}        % <---
    \end{table}
\end{document}

which gives:

enter image description here

(red lines indicate page borders)

Related Question