有人能帮我生成如图所示的表格吗?因为我正在写一本研究书籍,以下是我的整体软件包。我希望你们有一个也适合我的软件包的解决方案。
提前非常感谢
\documentclass[12pt,listof=totoc,bibliography=totoc,numbers=noenddot]{scrartcl}
\usepackage{lmodern}
\parindent0pt
\usepackage[a4paper, left=3cm, right=2cm, top=2.5cm, bottom=2cm]{geometry}
\renewcommand{\baselinestretch}{1.20}\normalsize
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman,english]{babel}
\usepackage{textcomp}
\usepackage[intlimits]{amsmath}
\usepackage[intlimits]{mathtools}
\usepackage{mathrsfs,amssymb}
\usepackage{icomma}
\usepackage{mathtools}
\usepackage{theorem}
\numberwithin{equation}{section}
\usepackage{commath}
\usepackage{bm}
\usepackage[svgnames]{xcolor}
\definecolor{dunkelblau}{rgb}{0,0,0.5}
\definecolor{americanrose}{rgb}{1.0, 0.01, 0.24}
\definecolor{babyblue}{rgb}{0.54, 0.81, 0.94}
\definecolor{mygreen}{rgb}{0,0.6,0}
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
\definecolor{mymauve}{rgb}{0.58,0,0.82}
\definecolor{cerulean}{rgb}{0.0, 0.48, 0.65}
\numberwithin{figure}{section}
\usepackage{subfig}
\usepackage{graphicx}
%\usepackage{scrlayer-scrpage}
\usepackage[automark]{scrpage2} % Paket zur Bearbeitung der Kopf- und Fu�zeile
\pagestyle{scrheadings}
\clearscrheadfoot
\ihead[]{\headmark}
\ohead[]{\pagemark}
\cfoot[\pagemark]{}
\setheadsepline{0.4pt}
\setlength{\headheight}{1 cm}
\setlength{\footskip}{1 cm}
\usepackage[colorlinks=false,plainpages=false,pdfpagelabels]{hyperref}
\usepackage{pdfpages}
\usepackage{listings}
%\usepackage{bibgerm} % deutschsprachiges Literaturverzeichnis
\usepackage[square,numbers]{natbib}
\usepackage{leftidx}
\renewcommand{\lstlistingname}{Quellcode}
\numberwithin{table}{section}
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl}
\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc}
\DeclareRobustCommand*\cal{\@fontswitch\relax\mathcal}
\DeclareRobustCommand*\mit{\@fontswitch\relax\mathnormal}
%\usepackage{ragged2e}
%\usepackage{booktabs, makecell, multirow, tabularx}
%\setcellgapes{3pt} % due to
%\usepackage{siunitx}
%%%%%%% 我的尝试
\begin{table}[hbt]
\centering
\captionabove{Acceleration relation with Force}
\begin{tabular}{||p{2.5cm}||p{4.0cm}||p{1.5cm}||p{2cm}||p{2cm}||}\hline
para 1 \& para 2 & Standard deviation (std) of measurements data & std (exponential) & std (Parabolic) & Pearson coefficient\\\\ \hline\hline
Acceleration \& Force & 9.0916 & 8.3552& 8.9866 &0.9397 $(0.000)$\\\hline
\end{tabular}
\end{table} \label{Force}
答案1
我个人更喜欢没有垂直线的表格:
\documentclass[12pt,listof=totoc,bibliography=totoc,numbers=noenddot]{scrartcl}
\usepackage{lmodern}
\parindent0pt
\usepackage[a4paper, left=3cm, right=2cm, top=2.5cm, bottom=2cm]{geometry}
\renewcommand{\baselinestretch}{1.20}\normalsize
\usepackage{booktabs, makecell, multirow}
\usepackage{siunitx}
\begin{document}
\begin{table}[hbt]
\centering
\captionabove{Acceleration relation with Force}
\label{Force}
\begin{tabular}{p{25mm} *{4}{S[table-format=1.4,
input-symbols=()]} }
\toprule
& \multicolumn{3}{c}{Standard deviation (std)}
& {\multirow{2.4}{*}{\makecell{Pearson's\\
coefficient}}} \\
\cmidrule{2-4}
P 2 & {Data 1} & {Data 2} & {data 3} & \\
\midrule
\multirow{2}{=}{Acceleration \& Force}
& 9.0916 & 8.3552 & 8.9866 & 0.9397 \\
& & & & (0.0000) \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案2
这是一个可能的解决方案制造细胞和\diaghead{}
嵌套的tabular
:
\documentclass[DIV=12]{scrartcl}
\usepackage{array, caption, makecell}
\usepackage[table]{xcolor}
\setlength{\extrarowheight}{2pt}
\begin{document}
\begin{table}[hbt!]
\small
\centering
\captionabove{Acceleration relation with Force\label{Force}}
\begin{tabular}{|wc{3cm}|*{3}{wc{2.7cm}|}c|}
\hline
\diaghead{\hskip0.19\hsize}{\& para 2}{para1} &
\multicolumn{3}{wc{8.1cm}|}{\begin{tabular}[t]{wc{2.7cm}|wc{2.7cm}|wc{2.7cm}}
\multicolumn{3}{wc{8.1cm}}{Standard deviation (std) of measurements}\\\hline
data & std (exponential) & std (Parabolic) \end{tabular}} &
\begin{tabular}{c}
Pearson \\ coefficient
\end{tabular} \\\hline
\begin{tabular}{c}
Acceleration \\\& Force
\end{tabular} & 9.0916 & 8.3552& 8.9866 &0.9397 $(0.000)$\\\hline
\end{tabular}
\end{table}
\end{document}
答案3
一个想法是使用diagbox
如何改变 上的x{..cm}
或 内的距离width
将需要改变其中一个或另一个参数。height
\diagbox
\documentclass{article}
\usepackage{array}
\usepackage{multirow}
\usepackage{diagbox} %table split headers
\newcolumntype{x}[1]{>{\centering\arraybackslash}m{#1}}
\begin{document}
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{|x{2cm}|x{1.5cm}x{1.5cm}x{1.5cm}|x{1.5cm}|}
\hline
\multirow{2}{*}{\diagbox[width=2.4cm,height=3\line]{$P_1$}{$P_2$}} & \multicolumn{3}{c|}{Standard Deviation} & \multirow{2}{*}{\shortstack{Pearson's\\Coeff}}\\
\cline{2-4}
& Data 1 & Data 2 & Data 3 & \\
\hline
Acceleration \& Force &&&& \\
\hline
\end{tabular}
\end{document}
输出: