指定一个表格的列宽+行高

指定一个表格的列宽+行高

我想增加行高以正确显示表格中的 N2O/SiH4 比例(见附图)。另外,我希望最后一列的宽度不要根据页面宽度增加。由于我在此报告中使用了多个表格,因此我希望能够为每个特定表格指定。如果您在看完我的 MWE 后仍不清楚这个问题,请告诉我。

\documentclass{report}        
%\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{changes}
\usepackage{caption}
\usepackage[justification=centering]{caption}
\usepackage{amssymb}
\usepackage[gen]{eurosym}  %proper euro sign
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{bm} % for \bm macro
\usepackage{mhchem}  %allows chemical formulae
\usepackage{siunitx} %allow SI units
\usepackage{cleveref} %smart referencing, automatic sorting etc.
\usepackage{nomencl}
\usepackage{pdfpages}
\makenomenclature 

\usepackage{tcolorbox}
\usepackage{tabularx}
\usepackage{array}
\usepackage{colortbl}
\tcbuselibrary{skins}
\tcbset{tab2/.style={enhanced,fonttitle=\bfseries,fontupper=\normalsize\sffamily,
colback=yellow!10!white,colframe=tudelft-sky-blue,
coltitle=black,center title}} 

\begin{document}


    \begin{tcolorbox}[tab2,tabularx={Y||Y|Y|Y}]
        \caption{Oxide fraction estimated by weighing method}
    $\bm{\frac{\ce{N2O}}{\ce{SiH4}}}$   & \textbf{Deposition time(min)} & \textbf{Stoichiometry}                & \textbf{Oxygen fraction(\%)}  \\\hline\hline
            $\frac{200}{600}$           & 90                            &  SiO$_\textrm{\scriptsize 0.72}$      & 42                            \\\hline
            $\frac{200}{600} $          & 120                           &  SiO$_\textrm{\scriptsize 0.81}$      & 45                            \\\hline
            $\frac{250}{600} $          & 90                            &  SiO$_\textrm{\scriptsize 0.71}$      & 42                            \\\hline
            $\frac{250}{600} $          & 120                           &  SiO$_\textrm{\scriptsize 0.80}$      & 44                            \\\hline
            $\frac{300}{600} $          & 90                            &  SiO$_\textrm{\scriptsize 0.52}$      & 34                            \\\hline
            $\frac{300}{600} $          & 120                           &  SiO$_\textrm{\scriptsize 0.65}$      & 39                            \\\hline
            $\frac{350}{600} $          & 90                            &  SiO$_\textrm{\scriptsize 0.71}$      & 42                            \\\hline
            $\frac{350}{600} $          & 120                           &  SiO$_\textrm{\scriptsize 0.76}$      & 43                            \\
            \label{tab:oxidefraction_weighingmethod}
            \end{tcolorbox}

\end{document}

桌子

答案1

由于不知道Y列类型和颜色tudelft-sky-blue,我建议根据\setcellgapes\thead命令使用此解决方案进行近似计算makecell。我还简化了您的序言,因为其他包已经加载了一些包。

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[dvipsnames, table]{xcolor}
\colorlet{tudelft-sky-blue}{SkyBlue}
\usepackage{changes}
\usepackage{caption}
\usepackage[justification=centering]{caption}
\usepackage{amssymb}
\usepackage[gen]{eurosym} %proper euro sign
\usepackage{mathtools, nccmath}
\usepackage{bm} % for \bm macro
\usepackage{mhchem} %allows chemical formulae
\usepackage{siunitx} %allow SI units
\usepackage{cleveref} %smart referencing, automatic sorting etc.
\usepackage{nomencl}
\usepackage{pdfpages}
\makenomenclature

\usepackage{tcolorbox}
\usepackage{tabularx}
\usepackage{makecell}
\tcbuselibrary{skins}
\tcbset{tab2/.style={enhanced,fonttitle=\bfseries,fontupper=\normalsize\sffamily,
colback=yellow!10!white,colframe=tudelft-sky-blue,
coltitle=black,center title}}

\begin{document}

\setcellgapes{3pt}\makegapedcells
\renewcommand{\theadfont}{\normalsize\bfseries}
    \begin{tcolorbox}[tab2,tabularx={>{\centering\arraybackslash}X||c|c|c}]
        \captionof{table}{Oxide fraction estimated by weighing method}
   \boldmath ${\mfrac{\ce{N2O}}{\ce{SiH4}}}$ & \thead{Deposition\\ time(min)} & \thead{Stoichiometry} & \thead{Oxygen\\ fraction(\%)} \\\hline\hline
            $\mfrac{200}{600}$ & 90 & SiO$_\textrm{\scriptsize 0.72}$ & 42 \\\hline
            $\mfrac{200}{600} $ & 120 & SiO$_\textrm{\scriptsize 0.81}$ & 45 \\\hline
            $\mfrac{250}{600} $ & 90 & SiO$_\textrm{\scriptsize 0.71}$ & 42 \\\hline
            $\mfrac{250}{600} $ & 120 & SiO$_\textrm{\scriptsize 0.80}$ & 44 \\\hline
            $\mfrac{300}{600} $ & 90 & SiO$_\textrm{\scriptsize 0.52}$ & 34 \\\hline
            $\mfrac{300}{600} $ & 120 & SiO$_\textrm{\scriptsize 0.65}$ & 39 \\\hline
            $\mfrac{350}{600} $ & 90 & SiO$_\textrm{\scriptsize 0.71}$ & 42 \\\hline
            $\mfrac{350}{600} $ & 120 & SiO$_\textrm{\scriptsize 0.76}$ & 43
            \label{tab:oxidefraction_weighingmethod}
            \end{tcolorbox}

\end{document}

在此处输入图片描述

相关内容