如何在 Latex 中生成如下表格?

如何在 Latex 中生成如下表格?

我是 Latex 新手,正在写论文。有人能告诉我如何构建这个表格的代码吗?我想做和图片中一模一样的事情

在此处输入图片描述

答案1

它模仿您的表格设计,但是,您需要在单元格中填充正确的文本和数字......

在此处输入图片描述

代码非常复杂(因为您的表格并不简单),但是网站上有许多非常相似的表格:

\documentclass{article}
\usepackage{geometry}
\usepackage{siunitx}
\usepackage{booktabs, makecell}
\usepackage[referable]{threeparttablex}

\begin{document}
\begin{table}
  \centering
  \caption{my tavle}\label{tab:scoring}
  \setlength\tabcolsep{0pt}
  \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
                        l
                        S[table-format=-1.3]
                   *{2}{S[table-format= 1.3]}
                        S[table-format=-1.2]
                        S[table-format=-1.3]
                   *{2}{S[table-format= 1.3]}
                            }
    \toprule
    &   \multicolumn{4}{c}{some text}   &   \multicolumn{3}{c}{some text}   \\
    \cmidrule(r){2-5}
    \cmidrule(l){6-8}
    &   {\thead[b]{text\\ text}}
        &   {\thead[b]{text}}
            &   {\thead[b]{text}}
                &   {\thead[b]{text\\ text}}
                    &   {\thead[b]{text\\ text}}
                        &   {\thead[b]{text\\ text}}
                            &   {\thead[b]{text\\ text}}                    \\
    \midrule
text    & -1.234    & 0.123 & 0.123 & 0.12  & 0.123 & 0.123 & 1.234         \\
some longer text (with seven words)
        & -1.234    & 0.123 & 0.123 & 0.12  & -2.00 & 0.123 & 1.234         \\
    \bottomrule
  \end{tabular*}
  \begin{tablenotes}[flushleft]\small
  \note:   each variable ...
  \source:   Authors' calculations ...
  \end{tablenotes}
\end{table}
\end{document}

我强烈建议你阅读一些关于餐桌布置的介绍性文字。例如LaTeX/表格或者表格以及使用的包文档。

答案2

这只是一个小例子,可能会对你有帮助

\documentclass{article}
\usepackage{amsmath}
\usepackage{tabularx,booktabs}
\begin{document}
\begin{table}
    \centering
    \caption[Add your short title for table index.]{This title can be longer.}\label{tab:example}
    \begin{tabular}{cccccccc}
        \toprule
        &  &  &  & \multicolumn{2}{c}{Red} & \multicolumn{2}{c}{Blue} \\
        \cmidrule(lr){5-6} \cmidrule(lr){7-8}
        Case & Nomeclature & $\frac{L_\text{out}}{D}$ & $F_\text{mid}$ & Data & Nodes & Data & Nodes \\ 
        \midrule 
        1 & Case 1 & 25 & 1.00 & 3756 & 3133 & 3736 & 33983 \\
        2 & Case 2 & 35 & 1.50 & 5034 & 4209 & 5004 & 40649 \\
        3 & Case 3 & 45 & 1.80 & 6296 & 5263 & 6276 & 56513 \\
        \bottomrule 
    \end{tabular} 
\end{table}
\end{document}

答案3

这是我所拥有的(我开始输入数据,但后来我不再打扰了)另外我忘了如何画粗线所以我只是画了一条双线:

\documentclass{article}
\usepackage{geometry}
\begin{document}
\begin{table}

\caption{SCORING FACTORS AND SUMMARY STATSTICS FOR VARIABLES ENTERING THE COMPUTATION
OF THE FIRST PRINCIPAL COMPONENT}

\smallskip{}

\begin{tabular}{l>{\centering}p{1.4cm}cc>{\centering}p{2.2cm}> {\centering}p{1.3cm}>{\centering}p{1.3cm}>{\centering}p{1.3cm}}
\toprule 
& \multicolumn{4}{c}{All India} & \multicolumn{3}{c}{Means}\tabularnewline
\cmidrule(r){2-5}
\cmidrule(l){6-8}
& Scoring Factors & Mean & SD & Scoring Factor $\times$ SD & Poorest 40\% & 
Middle 40\% & Richest 20\%\tabularnewline
\midrule
\midrule 
Own Clock/Watch & 0.270 & 0.533 & 0.499 & 0.54 & 0.164 & 0.739 & 0.985\tabularnewline
Own Bicycle & 0.130 & 0.423 & 0.494 & 0.26 & 0.264 & 0.510 &         0.621\tabularnewline
Own Radio &  &  &  &  &  &  & \tabularnewline
Own Television &  &  &  &  &  &  & \tabularnewline
Own Sewing Machine &  &  &  &  &  &  & \tabularnewline
Own Motorcycle &  &  &  &  &  &  & \tabularnewline
Own Refigerator &  &  &  &  &  &  & \tabularnewline
Own Car &  &  &  &  &  &  & \tabularnewline
Drinking Water From Pump/Well &  &  &  &  &  &  & \tabularnewline
Drinking Water From Open Source &  &  &  &  &  &  & \tabularnewline
Drinking Water From Other Source &  &  &  &  &  &  & \tabularnewline
Flush Toilet &  &  &  &  &  &  & \tabularnewline
Pit Toilet/Latrine &  &  &  &  &  &  & \tabularnewline
None/Other Toilet &  &  &  &  &  &  & \tabularnewline
Main Source of Lighting Electric &  &  &  &  &  &  & \tabularnewline
Number of Rooms in Dwelling &  &  &  &  &  &  & \tabularnewline
Kitchen a Seperate Room &  &  &  &  &  &  & \tabularnewline
Main Cooking Fuel Biomass (Wood/Dung/Coal) &  &  &  &  &  &  & \tabularnewline
Dwelling All High-Quality Materials &  &  &  &  &  &  & \tabularnewline
Dwelling All Low-Quality Materials &  &  &  &  &  &  & \tabularnewline
Own >6 acres Land &  &  &  &  &  &  & \tabularnewline
Economic Status Index &  &  &  &  &  &  & \tabularnewline
\bottomrule
\end{tabular}

\emph{Note: }bla bla bla

\emph{Source: }Bla bla bla
\end{table}

\end{document}

它看起来是这样的(编辑它不再像这样,印度和手段之间存在差距): 在此处输入图片描述

相关内容