如何在表格中放置图像——以及如何使其发光?

如何在表格中放置图像——以及如何使其发光?

我正在尝试将图像放在表格内。此图像应跨越第 3 列的所有行。以下是我使用的代码的最小工作示例。

 \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*}

尽管它运行正常,但这并不是我所说的理想的结果。

在此处输入图片描述

我尝试添加\extracolsep{\fill}tabular*但结果虽然好一点,却不能让我满意。

使用 \extracolsep 选项

我理解这是一个“美化”的问题,而不是完成任务的问题,但如果能提供任何帮助让这张桌子焕发光彩,我将不胜感激。

编辑:将“该列”更改为“第三列”

答案1

这是否更加美观/花哨?

在此处输入图片描述

我建议用于threepartable表格注释和adjustbox表格的垂直居中

编辑:

正如您在下面的评论中询问的那样,您希望有两个版本的表格布局:

  • 对于单列文档
  • 对于两列文档,其中
    • 表格放在一列中
    • 表格跨越两列。在这种情况下,threepartable必须用table*浮动元素括起来,正常情况下,表格会从表格插入点开始,放在下一页的顶部。如果您希望将表格放在插入的相同空间中,那么您可以使用包stfloat来帮助您(如果插入点在第一列并且距离页面底部足够远)

上面的图像是为一列文档生成的:

\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}

第二种情况的表格由以下方式生成:

\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}

在此处输入图片描述

答案2

我会嵌套表格;附加列用于将图像置于可用空间的中心。

\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}

在此处输入图片描述

相关内容