我目前正在写一篇科学论文,我需要一些指导,让我的表格尽可能好。我刚刚开始探索 LaTex 的奇妙之处,因此在如何避免常见陷阱方面经验有限。
表 1 所需的帮助(本文下提供的第一个代码)
- 我首先需要帮助的是如何将标题文字置于表格上方
- 我还需要一些关于表格布局的帮助。更具体地说,我需要帮助减少表格最后一行与表格注释正上方行之间的间距。
- 有人可以帮我稍微增加一下标题下方线条之间的空间,这样它看起来就不会像现在这么挤了。
需要第二个表格(表3)的帮助,(代码在表1的代码下提供)
- 有人可以帮我对齐标题下的数字吗?
谨致问候 Svein
\documentclass[10pt]{article}
%
\usepackage{babel}
\usepackage{mathtools,amssymb}
\usepackage{booktabs, makecell,
threeparttable} % <---
\setlength\heavyrulewidth{2pt} % <---
\setlength\lightrulewidth{1.2pt} % <---
\setcellgapes{3pt}
\renewcommand\theadfont{\normalsize\bfseries}
\renewcommand\theadgape{}
\usepackage{isotope}
\usepackage[table]{xcolor}
\arrayrulecolor{teal}
\usepackage[skip=0.5ex]{caption}
\DeclareCaptionLabelFormat{uc}{\MakeUppercase{#1}~#2} % <===
\DeclareCaptionFont{teal}{\color{teal}\fontfamily{iwona}\selectfont} % <===
%
\usepackage{longtable}
\usepackage[hmargin=1in,a4paper]{geometry}
\usepackage{threeparttablex}
\usepackage{booktabs}
\renewcommand{\arraystretch}{1.1}
\begin{document}
\begin{center}
\begin{ThreePartTable}
\begin{TableNotes}
\footnotesize
\item {\footnotesize XX = XXXXXXX XXXXX}
\item \(^a\){\footnotesize XXXX XXXXX XX}
\item \(^c\){\footnotesize XXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXX}
\item \(^d\){\footnotesize XXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXX}
\item \(^f\){\footnotesize XXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXX}
\item \(^h\){\footnotesize XXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXX}
\end{TableNotes}
\begin{longtable}{p{5.5cm} p{1.5cm} p{2cm}}
\caption{XXXXX XXX XXXXX XXXXX XXXXX XXXXXX XXXXX XXXX XXXX (\textit{n}=115)}\\
\hline\hline
\textbf{Demographic characteristics} & \textbf{N(\%)} & \textbf{Mean(SD)}\\[1pt]
\hline
\endfirsthead
\multicolumn{3}{c}%
{\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
\hline
\textbf{XXXXXXXXXX XXXXXXXXXX} & \textbf{N(\%)} & \textbf{Mean(SD)}\\
\hline
\endhead
\hline \multicolumn{3}{r}{\textit{Continued on next page}} \\
\endfoot
\bottomrule
\insertTableNotes
\endlastfoot
\textbf{XX ({\footnotesize XXXX})} (\textit{n}=300) & & 36.7(12.4)
\cr XXXX & XXXX
\cr XXXX & XXXX
\cr XXXX & XXXX
\cr XXXX & XXXX
\cr $\geq$ XXXX
%
\cr \textbf{XXXX} (\textit{n}=300)
\cr Female & XXXX
\cr Male & XXXX
\cr \textbf{XXXX} (\textit{n}=300) & & XXXX
\cr \textbf{XXXX} (\textit{n}=300) & & XXXX
\cr \textbf{XXXX\(^a\)(\(kg/m^2\))}(\textit{n}=300) & & XXXX
%
\cr \textbf{XXXX} (\textit{n}=100)
\cr XXXXXX & XXXXXX
\cr XXXXXX & XXXXXX
%
\cr \textbf{XXXXXX ({\footnotesize years})} (\textit{n}=XXX)
\cr XXXXXX (XXXXXX) & XXXXXX
\cr XXXXXX & XXXXXX
%
\cr \textbf{XXXXXXXXXXXXX XXXX} & XXXXXX
\cr \raggedright\textbf{XXXXXX({\footnotesize XXXXXX})} (\textit{n}=300) & & XXXX
\cr \textbf{XXXXXX} & XXXXXX
\cr \textbf{XXXXXXXXX} (\textit{n}=300) & & XXXXXX
\cr \textbf{XXXXXXXXXX} (\textit{n}=300) & & XXXXXX
\cr \textbf{XXXXXX\(^b\)} (\textit{n}=300)
\cr XXXXXX& & XXXXXX
\cr XXXXXX & & XXXXXX
\cr XXXXXX XXXXXX XX & & XXXXXX
\cr XXXX XXXX XXXXXX & & XXXXXX
\cr XXXX XXXXXXXXX XXXXXXX & & XXXXXX
\cr XXXXXX XXXXX & & XXXXXX
\cr \textbf{XXXXXX\(^c\)} (\textit{n}=XXX) & & XXXXXX
%
\cr \textbf{XXXXXXX XXX\(^d\)} (\textit{n}=XX) & & XXXXXX
\cr \textbf{XXX XXXXXXX XXXXXXX\(^e\)} (\textit{n}=XX) & & XXXXXX
\cr XXXXXX XXXXXXXXX XXXXXXXXXXX & XXXXXX
\cr XXXXXXXX XXXXXXX XXXXXXXX XXX & XXXXXX
\cr XXXXXXXX XXXXXX XXXXXXXXXXXX XXXXXXXXXX & XXXXXX
\cr XXXXX XXXXXXXXX XXXXXXX XXXXXXXX & XXXXXX
\cr \textbf{XXXXXX} & XXXXXX
\cr \textbf{XXXXXX} (\textit{n}=XX)
\cr \textless XX\% & XXXXXX
\cr XXXXXX\% & XXXXXX
\cr XXXXXX\% & XXXXXX
%
\cr \textbf{XXXXXX} & XXXXXX
\cr \textless XXXXXX & XXXXXX
\cr \textgreater XXXXXX & XXXXXX
%
\cr \textbf{XXXXXX} (\textit{n}=XX)
\cr XXXXXX & XXXXXX
\cr XXXXXXXXX XXXXXXXXX & & XXXXXX
\cr \raggedright\textbf{XXXXXXXX XXXXXXXX XXXXXXXXX} (\textit{n}=XXX) & & XXXXXX
%
\cr \textbf{XXXXXXXXXX XXXXXXX}\raggedright(\textit{n}=XXX)
\cr XXXXXX & XXXXXX
\cr XXXXXX & XXXXXX
\cr XXXXXX & XXXXXX
\end{longtable}
\end{ThreePartTable}
\end{center}
\end{document}
###################################################################################################################################################################################################################################################################第二张表,表 3
\documentclass[a4paper,12pt]{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{babel}
\usepackage{mathtools,amssymb}
\usepackage{booktabs, makecell,
threeparttable} % <---
\setlength\heavyrulewidth{2pt} % <---
\setlength\lightrulewidth{1.2pt} % <---
\setcellgapes{3pt}
\renewcommand\theadfont{\normalsize\bfseries}
\renewcommand\theadgape{}
\usepackage{isotope}
\usepackage[table]{xcolor}
\arrayrulecolor{teal}
\usepackage[skip=0.5ex]{caption}
\DeclareCaptionLabelFormat{uc}{\MakeUppercase{#1}~#2} % <===
\DeclareCaptionFont{teal}{\color{teal}\fontfamily{iwona}\selectfont} % <===
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\usepackage{booktabs}
%\usepackage[flushleft]{threeparttable} % <---
\usepackage{dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\begin{document}
\begin{table}[ht] \centering
\begin{threeparttable}
\renewcommand\thetable{3}
\caption{XXXXXXXXX XXXXXXXXX XXXXXXXXXX XXXXXXXXX XXXXXXXXXXXXXXXXXXXX}
\begin{tabular}{ l d{2.7} d{2.6} d{2.5} }
\hline\hline
\multicolumn{1}{c}{Spooky action at a distance}
&\multicolumn{1}{c}{Mean minutes}
&\multicolumn{1}{c}{SD\(^a\)}\\
\hline
XXX & 8.2 & 1.2 \\
XXX & 305.2 & 1.1 \\
XXXXX & 189.3 & 0.6 \\
XXXX & 62.3 & 0.1 \\
XXXX XXXX & 2.3 & 0.4 \\
XXXXX XXXXX & 39.5 & 1.2 \\
XXX & 0.3 & 1.2 \\
XXXXXX XXXXXXXX & 9.2 & 0.9 \\
XXXXXXXX & 8.9 & 1.4 \\
\hline\hline
\multicolumn{1}{c}{XXXXXX XXXXXXXXX} \\
\cmidrule{1-1}
%XXXXXX XXXXXXX & & \\
%\hline
XXXXXXX & 9.2 & 0.5 \\
XXXXXX XXXXXX XXXXXXXX 90 & 562.3 & 2 \\
XXXX XXXXX XXXXXX 10 & 98.2 & 1.2 \\
XX XXXXXXX XXXXXXX 30 & 1.9 & 0.1 \\
XXXXXX XXXXX 10 & 90.3 & 1.5 \\
XXXXX XXXXXXX 20 & 9.8 & 1.9 \\
\hline\hline
\end{tabular}
\begin{tablenotes}[para] % <---
\footnotesize
Abbrevations: \(^a\)SD = Standard deviation
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}