如何将表格中某些列的标题拆分为两个子列?

如何将表格中某些列的标题拆分为两个子列?

让我们考虑一下我的桌子 我的表 我想以这种方式重新组织标题:对于第 3 列,我想删除破折号并将单词“id.”和“PDes”拆分到两个子列上。对于连续的列(从 4 到 7),数据的含义是它们都是函数,即 DVmin=DVmin(TOF)、TOFmin=TOFmin(DV),其他两列也是如此。我想将这些变量对(及其单位)拆分到它们的两个子列上,然后删除破折号。您认为这可读吗?如果是,您能演示如何将变量拆分到两个子列上吗?

以下是代码:

\documentclass{article}
\usepackage{siunitx}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{csvsimple}
\usepackage{graphicx}

\begin{document}
\begin{table}[h]
    \centering
    \caption{Simulation results for $\Delta V < \SI{500}{\metre\per\second}$ and $E_{\omega_{\text{S/C}}} < \SI{0.02}{degree}$.}
    \label{tab:results}
    \resizebox{\textwidth}{!}{%
    \newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}} % paragraph column with text vertically aligned at the top horizontally aligned at center
    \newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}} %  paragraph column with text vertically aligned in the middle horizontally aligned at center
    \newcolumntype{R}[1]{>{\raggedleft\arraybackslash}r{#1}}  %% right aligned
    \begin{tabular}{
    c %col1 L-point  %option [table-number-alignment = right,center,left]
    S[table-format=4.0] %col2 No. of. sol.
    S[table-format=3.0]%[table-format=2.4,input-decimal-markers=-,output-decimal-marker=-,table-number-alignment = center] %col3 Cand. NEA
    l
    S[table-format=4.0,round-mode=places,round-precision=0] %col4
    S[table-format=4.0,round-mode=places,round-precision=0] %col5
    S[table-format=4.0,round-mode=places,round-precision=0] %col6
    S[table-format=4.0,round-mode=places,round-precision=0] %col7
    S[table-format=1.2e1,scientific-notation = true,round-mode=places,round-precision=2] %col8
    S[table-format=6.0,round-mode=places,round-precision=0] %col9
    S[table-format=4.0,round-mode=places,round-precision=0] %col10
    S[table-format=1.2e1,scientific-notation = true,round-mode=places,round-precision=2] %col11
   }
   \toprule
    \textbf{L} & \multicolumn{1}{M{1cm}}{\textbf{No.of\newline sol.}} & \multicolumn{2}{M{3cm}}{\textbf{Candidate NEA (id. – PDes)}} & \multicolumn{2}{M{2.5cm}}{$\boldsymbol{\Delta V_\mathrm{min}\ –\ \textit{TOF}}$ \textbf{(m/s – day)}} & \multicolumn{2}{M{2.5cm}}{$\boldsymbol{\textit{TOF}_\mathrm{min}\ -\ \Delta V}$ \textbf{(day – m/s)}} &
    \multicolumn{2}{M{3cm}}{$\boldsymbol{E_\mathrm{min}\ – \ d}$  \hspace{0.9cm} \textbf{(deg – km)}} &
    \multicolumn{2}{M{3cm}}{$\boldsymbol{d_\mathrm{min}\ –\ E}$  \hspace{1.0cm} \textbf{(km – deg)}} \\ 
    \cmidrule(){1-2}\cmidrule(lr){3-4}\cmidrule(lr){5-6}\cmidrule(lr){7-8}\cmidrule(lr){9-10}\cmidrule(l){11-12}
     & 5 & 31 & 2018 PN22  & 495.786955408242 & 321.691007914094 & 321.691007914094 & 495.786955408242 & 0.00766274786981772 & 1304.55816893965 & 1304.55816893965 & 0.00766274786981772 \\
     & 618 & 40 & 2020 HO5 & 296.499238470772 & 563.204937799172 & 460.61389541864  & 434.673022794247 & 1.06333561065898e-06 & 13334.9589039407 & 44.1321628087056 & 0.0043440927667307 \\
     & 207 & 47 & 2021 GM1 & 321.225083304834 & 579.001176279967 & 458.977213170648 & 494.635569509203 & 8.75927739836456e-05 & 16162.8584126721 & 272.790892644318 & 0.000205574640657646 \\
    \multirow{-4}{*}{\num{1}} & 110 & 48 & 2021 LF6 & 331.415081004236 & 547.555702810118 & 426.019758493117 & 494.810189855507 & 0.000659773039856017 & 15282.6573179668 & 1635.52986610854 & 0.00604210949390045 \\ \midrule
    & 188 & 36 & 2020 CD3 & 441.087426101912 & 598.687300827277 & 560.12998365025  & 498.671715102102 & 4.00652387797866e-05 & 720.645461262528 & 226.148958936483 & 0.00124800816293013 \\
    & 150 & 37 & 2020 FA1 & 363.833486907914 & 617.815224738438 & 532.434130120624 & 477.043833738971 & 0.000151649146744098 & 4570.03421246898 & 542.710633669257 & 0.00217371251138835 \\
    & 277 & 39 & 2020 HF4 & 325.869742616378 & 620.47407865956 & 495.241518020061  & 490.112884848913 & 3.56238695777137e-05 & 9221.76907418505 & 316.676948047764 & 0.00396990356158546 \\
    & 30 & 41 & 2020 MU1  & 462.893611205412 & 597.439526870574 & 543.014823292621 & 496.958058852358 & 0.000488508198589889 & 13825.1797358252 & 1772.22939016773 & 0.00367089047771314 \\
    & 373 & 44 & 2020 WY  & 258.567622278901 & 592.325909750424 & 457.543641043238 & 486.364970362706 & 5.77400555816601e-05 & 4916.39967823924 & 12.7440192334999 & 0.000402576106298293 \\
    & 823 & 45 & 2021 AK5 & 150.275430032146 & 690.288217497001 & 553.108214337696 & 490.073643361243 & 1.7294477167511e-05 & 2102.12134797594 & 168.651739286611 & 0.000968271504982416 \\
    & 106 & 49 & 2021 RZ3 & 422.216662637048 & 503.142619476216 & 412.861217455181 & 497.744537876508 & 3.17739132722177e-05 & 15816.5130302721 & 1010.29185702609 & 0.00513171449630041 \\
    & 1161 & 50 & 2021 RG12 & 60.0534121618513 & 469.018823203997 & 310.079915873532 & 483.83013103322 & 3.9138194517227e-06 & 1211.60680842878 & 24.9984223871349 & 0.000221411870262754 \\
    \multirow{-9}{*}{\num{2}}  & 177 & 52 & 2021 VX22 & 428.923740467692 & 370.203538028964 & 346.732351012621 & 496.774800147814 & 9.50215401351551e-05 & 155.225383516442 & 155.225383516442 & 9.50215401351551e-05 \\ \bottomrule
    \end{tabular}%
    }
    \end{table}

\end{document}

答案1

像这样?

在此处输入图片描述

(红线表示文本块边框)

您只需要在放置所需列标题的地方插入新行。

编辑:
由于未知原因,第一行中复制的公式无法正常工作。我需要从头开始重新输入。

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

\usepackage{siunitx}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{amsmath}
\usepackage{graphicx}

\begin{document}
\begin{table}[ht]
    \centering
    \caption{Simulation results for $\Delta V < \SI{500}{\metre\per\second}$ and $E_{\omega_{\text{S/C}}} < \SI{0.02}{degree}$.}
    \label{tab:results}
%    \resizebox{\textwidth}{!}{%
%    \newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}} % paragraph column with text vertically aligned at the top horizontally aligned at center
%    \newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}} %  paragraph column with text vertically aligned in the middle horizontally aligned at center
%    \newcolumntype{R}[1]{>{\raggedleft\arraybackslash}r{#1}}  %% right aligned
    \setlength\tabcolsep{2.5pt}
    \scriptsize
    \begin{tabular}{@{} 
    c %col1 L-point  %option [table-number-alignment = right,center,left]
    S[table-format=4.0] %col2 No. of. sol.
    S[table-format=2.0]%[table-format=2.4,input-decimal-markers=-,output-decimal-marker=-,table-number-alignment = center] %col3 Cand. NEA
    l
    S[table-format=3.0,round-mode=places,round-precision=0] %col4
    S[table-format=3.0,round-mode=places,round-precision=0] %col5
    S[table-format=3.0,round-mode=places,round-precision=0] %col6
    S[table-format=3.0,round-mode=places,round-precision=0] %col7
    S[table-format=1.2e3,scientific-notation = true,round-mode=places,round-precision=2] %col8
    S[table-format=5.0,round-mode=places,round-precision=0] %col9
    S[table-format=4.0,round-mode=places,round-precision=0] %col10
    S[table-format=1.2e3,scientific-notation = true,round-mode=places,round-precision=2] %col11
    @{}}
   \toprule
\textbf{L}
    &   {\textbf{No.}}
        & \multicolumn{2}{c}{\textbf{Cand. NEA}} %idate
            & \multicolumn{2}{c}{$\boldsymbol{\Delta V_{\min}}-\mathit{TOF}$}
                & \multicolumn{2}{c}{$\mathit{TOF}_{\min} - \boldsymbol{\Delta V}$}
                    & \multicolumn{2}{c}{$\boldsymbol{E_{\min} - d}$}
                        & \multicolumn{2}{c}{$\boldsymbol{d_{\min} -  E_{\min}}$}     \\
    \cmidrule(lr){3-4}\cmidrule(lr){5-6}\cmidrule(lr){7-8}\cmidrule(lr){9-10}\cmidrule(l){11-12}
     & {\textbf{sol.}}
        & \textbf{id}  & \multicolumn{1}{c}{\textbf{PDes}}
            & \textbf{m/s}  & {\textbf{day}}
                & \textbf{day}  & {\textbf{m/s}}
                    & \textbf{deg}  & {\textbf{km}}
                        &   \textbf{km}  & {\textbf{deg}}     \\

    \midrule
     & 5 & 31 & 2018 PN22  & 495.786955408242 & 321.691007914094 & 321.691007914094 & 495.786955408242 & 0.00766274786981772 & 1304.55816893965 & 1304.55816893965 & 0.00766274786981772 \\
     & 618 & 40 & 2020 HO5 & 296.499238470772 & 563.204937799172 & 460.61389541864  & 434.673022794247 & 1.06333561065898e-06 & 13334.9589039407 & 44.1321628087056 & 0.0043440927667307 \\
     & 207 & 47 & 2021 GM1 & 321.225083304834 & 579.001176279967 & 458.977213170648 & 494.635569509203 & 8.75927739836456e-05 & 16162.8584126721 & 272.790892644318 & 0.000205574640657646 \\
\multirow{-4}{*}{\num{1}} & 110 & 48 & 2021 LF6 & 331.415081004236 & 547.555702810118 & 426.019758493117 & 494.810189855507 & 0.000659773039856017 & 15282.6573179668 & 1635.52986610854 & 0.00604210949390045 \\
    \midrule
    & 188 & 36 & 2020 CD3 & 441.087426101912 & 598.687300827277 & 560.12998365025  & 498.671715102102 & 4.00652387797866e-05 & 720.645461262528 & 226.148958936483 & 0.00124800816293013 \\
    & 150 & 37 & 2020 FA1 & 363.833486907914 & 617.815224738438 & 532.434130120624 & 477.043833738971 & 0.000151649146744098 & 4570.03421246898 & 542.710633669257 & 0.00217371251138835 \\
    & 277 & 39 & 2020 HF4 & 325.869742616378 & 620.47407865956 & 495.241518020061  & 490.112884848913 & 3.56238695777137e-05 & 9221.76907418505 & 316.676948047764 & 0.00396990356158546 \\
    & 30 & 41 & 2020 MU1  & 462.893611205412 & 597.439526870574 & 543.014823292621 & 496.958058852358 & 0.000488508198589889 & 13825.1797358252 & 1772.22939016773 & 0.00367089047771314 \\
    & 373 & 44 & 2020 WY  & 258.567622278901 & 592.325909750424 & 457.543641043238 & 486.364970362706 & 5.77400555816601e-05 & 4916.39967823924 & 12.7440192334999 & 0.000402576106298293 \\
    & 823 & 45 & 2021 AK5 & 150.275430032146 & 690.288217497001 & 553.108214337696 & 490.073643361243 & 1.7294477167511e-05 & 2102.12134797594 & 168.651739286611 & 0.000968271504982416 \\
    & 106 & 49 & 2021 RZ3 & 422.216662637048 & 503.142619476216 & 412.861217455181 & 497.744537876508 & 3.17739132722177e-05 & 15816.5130302721 & 1010.29185702609 & 0.00513171449630041 \\
    & 1161 & 50 & 2021 RG12 & 60.0534121618513 & 469.018823203997 & 310.079915873532 & 483.83013103322 & 3.9138194517227e-06 & 1211.60680842878 & 24.9984223871349 & 0.000221411870262754 \\
    \multirow{-9}{*}{\num{2}}  & 177 & 52 & 2021 VX22 & 428.923740467692 & 370.203538028964 & 346.732351012621 & 496.774800147814 & 9.50215401351551e-05 & 155.225383516442 & 155.225383516442 & 9.50215401351551e-05 \\ 
    \bottomrule
    \end{tabular}%
%    }
    \end{table}
\end{document}

附录:
为了练习,使用tabularraybm包编写了相同的表格:

\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\usepackage{bm}

\usepackage[skip=1ex,
            font=small, labelfont=bf
            ]{caption}

\begin{document}
\begin{table}[ht]
    \centering
    \caption{Simulation results for $\Delta V < \qty{500}{\metre\per\second}$ and $E_{\omega_{\text{S/C}}} < \qty{0.02}{degree}$.}
    \label{tab:results}
\sisetup{table-format=3.0,
         round-mode=places,
         round-precision=0,
         tight-spacing}
    \scriptsize
\begin{tblr}{%
    colsep = 3.1pt,
    colspec = {@{}
                Q[l,m] %col 1
                Q[m, si={table-format=4.0}] %col 2 No. of. sol.
                Q[m, si={table-format=2.0}] %col 3 Cand. NEA
                Q[l,m]     %col 4
                X[m, si]   %col 5
                X[m, si]   %col 6
                X[m, si]   %col 7
                X[m, si]   %col 8
                Q[m, si={table-format=1.2e3,
                         scientific-notation = true,
                         round-precision=2}] %col 9
                Q[m, si={table-format=5.0}]  %col 10
                Q[m, si]   %col 11
                Q[m, si={table-format=1.2e3,
                         scientific-notation = true,
                         round-precision=2}] %col 12
               @{}},
    rowsep = 1pt,
    row{1} = {guard, font=\bfseries, mode=math},
    row{2} = {guard, font=\bfseries, c}
            }
   \toprule
\SetCell[r=2]{mode=text}    L   
    &   \SetCell[r=2]{mode=text}      {No. \\   sol.}
        &   \SetCell[c=2]{c}   \text{Cand. NEA}
            &   &   \SetCell[c=2]{c}    \bm{\Delta V_{\min}} - \mathit{TOF}
                    &   &   \SetCell[c=2]{c}    \mathit{TOF}_{\min} - \bm{\Delta V}
                        &   &   \SetCell[c=2]{c}    \bm{E_{\min} - d}
                            &   &   \SetCell[c=2]{c}    \bm{d_{\min} -  E_{\min}}      
                                    &           \\
   \cmidrule[lr]{3-4} \cmidrule[lr]{5-6}  \cmidrule[lr]{7-8}
   \cmidrule[lr]{9-10}\cmidrule[lr]{11-12}
    &   & id    & \SetCell{c}   PDes
            & m/s   & day 
                & day   & m/s 
                    & deg   & km
                        & km    & deg           \\

    \midrule
\SetCell[r=4]{l}   1
    & 5     & 31 & 2018 PN22        & 495.786955408242      & 321.691007914094 & 321.691007914094 
                 & 495.786955408242 & 0.00766274786981772   & 1304.55816893965 & 1304.55816893965 
                 & 0.00766274786981772   \\
    & 618   & 40 & 2020 HO5         & 296.499238470772      & 563.204937799172 & 460.61389541864  
                 & 434.673022794247 & 1.06333561065898e-06  & 13334.9589039407 & 44.1321628087056 
                 & 0.0043440927667307   \\
    & 207   & 47 & 2021 GM1         & 321.225083304834      & 579.001176279967 & 458.977213170648 
                 & 494.635569509203 & 8.75927739836456e-05  & 16162.8584126721 & 272.790892644318 
                 & 0.000205574640657646 \\
    & 110 & 48   & 2021 LF6         & 331.415081004236      & 547.555702810118 & 426.019758493117 
                 & 494.810189855507 & 0.000659773039856017  & 15282.6573179668 & 1635.52986610854 
                 & 0.00604210949390045 \\
    \midrule
\SetCell[r=9]{l}   2
    & 188 & 36  & 2020 CD3          & 441.087426101912      & 598.687300827277 & 560.12998365025  
                & 498.671715102102  & 4.00652387797866e-05  & 720.645461262528 & 226.148958936483 
                & 0.00124800816293013 \\
    & 150 & 37  & 2020 FA1          & 363.833486907914      & 617.815224738438 & 532.434130120624 
                & 477.043833738971  & 0.000151649146744098  & 4570.03421246898 & 542.710633669257 
                & 0.00217371251138835 \\
    & 277 & 39  & 2020 HF4          & 325.869742616378      & 620.47407865956  & 495.241518020061  
                & 490.112884848913  & 3.56238695777137e-05  & 9221.76907418505 & 316.676948047764 
                & 0.00396990356158546 \\
    & 30 & 41   & 2020 MU1          & 462.893611205412      & 597.439526870574 & 543.014823292621 
                & 496.958058852358  & 0.000488508198589889  & 13825.1797358252 & 1772.22939016773 
                & 0.00367089047771314 \\
    & 373 & 44  & 2020 WY           & 258.567622278901      & 592.325909750424 & 457.543641043238 
                & 486.364970362706  & 5.77400555816601e-05  & 4916.39967823924 & 12.7440192334999 
                & 0.000402576106298293 \\
    & 823 & 45  & 2021 AK5          & 150.275430032146      & 690.288217497001 & 553.108214337696 
                & 490.073643361243  & 1.7294477167511e-05   & 2102.12134797594 & 168.651739286611 
                & 0.000968271504982416 \\
    & 106 & 49  & 2021 RZ3          & 422.216662637048      & 503.142619476216 & 412.861217455181 
                & 497.744537876508  & 3.17739132722177e-05  & 15816.5130302721 & 1010.29185702609
                & 0.00513171449630041 \\
    & 1161 & 50 & 2021 RG12         & 60.0534121618513      & 469.018823203997 & 310.079915873532 
                & 483.83013103322   & 3.9138194517227e-06   & 1211.60680842878 & 24.9984223871349
                & 0.000221411870262754 \\
    & 177 & 52  & 2021 VX22         & 428.923740467692      & 370.203538028964 & 346.732351012621 
                & 496.774800147814  & 9.50215401351551e-05  & 155.225383516442 & 155.225383516442
                & 9.50215401351551e-05 \\
    \bottomrule
\end{tblr}
    \end{table}
\end{document}

在此处输入图片描述

相关内容