4

I'm trying to place an image inside a table. This image should span all rows in the 3rd column. Below is the minimal working example of the code I used.

 \documentclass[a4paper]{article}

        % Additional Packages

        \usepackage{siunitx} % use this package module for SI units
        \usepackage{booktabs}
        \usepackage{enumitem}
        \usepackage{graphicx}

        % Custom commands

       \newcommand{\tn}[1]{\textsuperscript{#1}}
       \newcommand{\TN}[1]{\makebox[0pt][l]{\tn{#1}}}

       % Case in point

       \begin{table*}[!htb]% table* allows a table to spawn the entire width of the page.
       \caption{Experimentally determined spectroscopic parameters of the detected rotamer of PG}
       \label{C4-table:3} % should go after \caption
       \centering
       \sisetup{table-align-text-post=false}
       \begin{tabular*}{\textwidth}{ @{} c *{1}{S[table-format=4.5(2)]} c @{} }
       \toprule
        $ A $\tn{a}       & 3087.32319(50)\tn{b} & \multirow{10}{*}{\includegraphics[scale=1]{Chapter4/3}}\\    
        $ B $            &  738.35982(15) & \\
        $ C $            &  700.88590(16)& \\
        $ \Delta J $     &    0.0423(37)& \\
        $ \chi_{aa} $    &   -4.2633(31)& \\
        $ \chi_{bb} $    &    2.2186(36)& \\
        $ \chi_{cc} $    &    2.0447(36)& \\
        $ N $\tn{c}      &   \num{40} & \\
        $ \sigma $\tn{d} &    1.8 & \\
    \bottomrule 
    \end{tabular*}

    \raggedright\footnotesize

    \begin{enumerate}[label=\tn{\alph*},leftmargin=*]

        \item $A$, $B$, and $C$ are the rotational constants (in \si{MHz});
        $\chi_{aa}$, $\chi_{bb}$, and $\chi_{cc}$ are elements of the $^{14}$N nuclear quadrupole coupling tensor (in \si{MHz}).

        \item Standard errors indicated in parentheses in units of the last digit. 

        \item Number of fitted transitions.

        \item Root mean square of the fit (in \si{kHz}).

    \end{enumerate}
\end{table*}

While it works ok, it's not what I would call a fancy result.

enter image description here

I tried adding the \extracolsep{\fill} in tabular* but the result, whilst a bit better, doesn't appease me.

with the \extracolsep option

I understand that this a matter of 'beautification', and not so much of getting things done, but any help making this table shine would be much appreciated.

EDIT: changed 'that collumn' to 'third collumn'

5
  • 1
    I don't even understand where an image should be…
    – Bernard
    Commented Mar 6, 2018 at 19:31
  • @Bernard in that one column containing a \multirow and a \includegraphics perhaps?
    – Skillmon
    Commented Mar 6, 2018 at 19:33
  • @Strelok: Not related to the image question but you might be interested in the threeparttable package to set up table notes.
    – leandriis
    Commented Mar 6, 2018 at 19:34
  • @Bernarnd, as Skillmon pointed out, it's the 2rd collumn, spanning all rows. I've edited the text to reflect that.
    – Strelok
    Commented Mar 6, 2018 at 19:45
  • I think the footnotes appended to a variable are confusing. It looks as if you mean something like $A^{\mathrm{a}}$ as an expression, not as a footnote.
    – Skillmon
    Commented Mar 6, 2018 at 19:50

2 Answers 2

5

is this more nice/fancy?

enter image description here

i suggest to use threepartable for table notes and adjustbox for vertical centering of table

edit:

as you asked in comment below, you like to have two version of table table placement:

  • for one column document
  • for two column document, where
    • table is placed in one column
    • table span two columns. in this case threepartable had to be enclosed in table* float, which in normal circumstances put table on the top of the next page from point of table insertion. if you like to have the table on the same space where is inserted, than you can use package stfloat to help you out (if the point of insertion is in the first column and far enough from bottom of page)

above image is generated for one column document:

\renewcommand{\tnote}[1]{\textsuperscript{\textbf{#1}}}
\usepackage{enumitem}
\usepackage[demo]{graphicx}     % in real document remove "[demo]"
\usepackage[export]{adjustbox}  % for vertical align of image

\begin{document}
    \begin{threeparttable}[htb]
\caption{Experimentally determined spectroscopic parameters of the detected rotamer of PG}
\label{C4-table:3} % should go after \caption
\centering
\sisetup{table-align-text-post=false}
\begin{tabular}{@{}
                >{$}c<{$}
                    S[table-format=4.5(2)]
                    c
                @{}}
    \toprule
A \tnote{a} & 3087.32319(50)\tnote{b} & \multirow{9}{*}{
                                            \includegraphics[scale=1,valign=c]{Chapter4/3}}
                                                \\
B           &  738.35982(15)    & \\
C           &  700.88590(16)    & \\
\Delta J    &    0.0423(37)     & \\
\chi_{aa}   &   -4.2633(31)     & \\
\chi_{bb}   &    2.2186(36)     & \\
\chi_{cc}   &    2.0447(36)     & \\
N \tnote{c} &   \num{40}        & \\
\sigma \tnote{d}    &    1.8    & \\
    \bottomrule
    \end{tabular}
    \begin{tablenotes}[flushleft]\footnotesize
    \item[a] $A$, $B$, and $C$ are the rotational constants (in \si{MHz});
        $\chi_{aa}$, $\chi_{bb}$, and $\chi_{cc}$ are elements of the $^{14}$N nuclear quadrupole coupling tensor (in \si{MHz}).
    \item[b] Standard errors indicated in parentheses in units of the last digit.
    \item[c] Number of fitted transitions.
    \item[t] Root mean square of the fit (in \si{kHz}).
    \end{tablenotes}
    \end{threeparttable}
\end{document}

tables of the second case are generated by:

\documentclass[twocolumn]{article}
\usepackage{siunitx}
\usepackage{booktabs, multirow, threeparttable}
\renewcommand{\tnote}[1]{\textsuperscript{\textbf{#1}}}
\usepackage{enumitem}
\usepackage[demo]{graphicx}     % in real document remove "[demo]"
\usepackage[export]{adjustbox}  % for vertical align of image
\usepackage{stfloats}

\usepackage{lipsum}

\begin{document}
\lipsum[11]
\begin{threeparttable}[htb]
    \setlength\tabcolsep{0pt}
\caption{Experimentally determined spectroscopic parameters of the detected rotamer of PG}
\label{C4-table:3} % should go after \caption
\centering
\sisetup{table-align-text-post=false}
\begin{tabular*}{\columnwidth}{@{\extracolsep{\fill}}
                >{$}c<{$}
                    S[table-format=4.5(2)]
                    c
                }
    \toprule
A \tnote{a} & 3087.32319(50)\tnote{b} & \multirow{9}{*}{
                                        \includegraphics[width=0.58\columnwidth,valign=c]{Chapter4/3}}
                                                \\
B           &  738.35982(15)    & \\
C           &  700.88590(16)    & \\
\Delta J    &    0.0423(37)     & \\
\chi_{aa}   &   -4.2633(31)     & \\
\chi_{bb}   &    2.2186(36)     & \\
\chi_{cc}   &    2.0447(36)     & \\
N \tnote{c} &   \num{40}        & \\
\sigma \tnote{d}    &    1.8    & \\
    \bottomrule
    \end{tabular*}
    \begin{tablenotes}[flushleft]\footnotesize
    \item[a] $A$, $B$, and $C$ are the rotational constants (in \si{MHz});
        $\chi_{aa}$, $\chi_{bb}$, and $\chi_{cc}$ are elements of the $^{14}$N nuclear quadrupole coupling tensor (in \si{MHz}).
    \item[b] Standard errors indicated in parentheses in units of the last digit.
    \item[c] Number of fitted transitions.
    \item[t] Root mean square of the fit (in \si{kHz}).
    \end{tablenotes}\medskip
\end{threeparttable}
%
    \begin{table*}[b] % for table which span two columns (at bottom of page)
    \centering
\begin{threeparttable}[htb]
\caption{Experimentally determined spectroscopic parameters of the detected rotamer of PG}
\label{C4-table:3} % should go after \caption
\centering
\sisetup{table-align-text-post=false}
\begin{tabular}{>{$}c<{$}
                    S[table-format=4.5(2)]
                    c
                }
    \toprule
A \tnote{a} & 3087.32319(50)\tnote{b} & \multirow{9}{*}{
                                        \includegraphics[width=0.6\linewidth,valign=c]{Chapter4/3}}
                                                \\
B           &  738.35982(15)    & \\
C           &  700.88590(16)    & \\
\Delta J    &    0.0423(37)     & \\
\chi_{aa}   &   -4.2633(31)     & \\
\chi_{bb}   &    2.2186(36)     & \\
\chi_{cc}   &    2.0447(36)     & \\
N \tnote{c} &   \num{40}        & \\
\sigma \tnote{d}    &    1.8    & \\
    \bottomrule
    \end{tabular}
    \begin{tablenotes}[flushleft]\footnotesize
    \item[a] $A$, $B$, and $C$ are the rotational constants (in \si{MHz});
        $\chi_{aa}$, $\chi_{bb}$, and $\chi_{cc}$ are elements of the $^{14}$N nuclear quadrupole coupling tensor (in \si{MHz}).
    \item[b] Standard errors indicated in parentheses in units of the last digit.
    \item[c] Number of fitted transitions.
    \item[t] Root mean square of the fit (in \si{kHz}).
    \end{tablenotes}\medskip
\end{threeparttable}
    \end{table*}
\lipsum
\end{document}

enter image description here

4
  • yes it does have two collumns. Sorry, I didn't made it clear in the question.
    – Strelok
    Commented Mar 6, 2018 at 19:46
  • since (till now) table is wider as one column, do you like to have, that it span two columns or rather make it narrower that it can fit in one column?
    – Zarko
    Commented Mar 6, 2018 at 19:53
  • Would you be so kind as - for future reference - provide both examples?
    – Strelok
    Commented Mar 6, 2018 at 19:54
  • 1
    @Strelok, done.
    – Zarko
    Commented Mar 6, 2018 at 20:19
1

I'd nest tabulars; the additional column is for centering the image in the available space.

\documentclass[a4paper]{article}

% Additional Packages

\usepackage{siunitx} % use this package module for SI units
\usepackage{booktabs}
\usepackage{enumitem}
\usepackage{graphicx}

% Custom commands

\newcommand{\tn}[1]{\textsuperscript{#1}}
\newcommand{\TN}[1]{\makebox[0pt][l]{\tn{#1}}}

\begin{document}

\begin{table*}[!htb]

\caption{Experimentally determined spectroscopic parameters 
  of the detected rotamer of PG}
\label{C4-table:3}

\medskip

\centering
\sisetup{table-align-text-post=false}
\begin{tabular*}{\textwidth}{
  @{\hspace{\tabcolsep}\extracolsep{\fill}}
  c
  c
  c
  @{}
}
\toprule
\begin{tabular}{
  @{}
  c
  S[table-format=4.5(2),table-space-text-post=\tn{b}]
  @{}
}
$A$\tn{a}      & 3087.32319(50)\tn{b} \\
$B$            &  738.35982(15) \\
$C$            &  700.88590(16) \\
$\Delta J$     &    0.0423(37) \\
$\chi_{aa}$    &   -4.2633(31) \\
$\chi_{bb}$    &    2.2186(36) \\
$\chi_{cc}$    &    2.0447(36) \\
$N$\tn{c}      & \num{40} \\
$\sigma$\tn{d} &    1.8 \\
\end{tabular}
&
\begin{tabular}{@{}c@{}}
\includegraphics[height=8\normalbaselineskip]{example-image}
\end{tabular}
&\\
\bottomrule 
\end{tabular*}

\raggedright\footnotesize
\begin{enumerate}[label=\tn{\alph*},leftmargin=*]

\item $A$, $B$, and $C$ are the rotational constants (in \si{MHz});
      $\chi_{aa}$, $\chi_{bb}$, and $\chi_{cc}$ are elements of the
      $^{14}$N nuclear quadrupole coupling tensor (in \si{MHz}).

\item Standard errors indicated in parentheses in units of the last digit. 

\item Number of fitted transitions.

\item Root mean square of the fit (in \si{kHz}).

\end{enumerate}
\end{table*}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .