需要帮助在表格中添加标题

需要帮助在表格中添加标题

我试图按照此处附图所示命名表格,但无法成功。请帮忙。桌子

谢谢。

编辑:

\documentclass[a4paper,12pt]{book}
\usepackage[a4paper, inner=1.5cm, outer=2.5cm, top=2.0cm,
bottom=2.5cm, bindingoffset=1cm]{geometry}
\usepackage{blindtext}
\begin{document}
\begin{table}
\caption{Variation of color with temperature}
\begin{tabular}{lc}
\hline
\textbf{COLOR}  & \textbf{TEMP.,\textbf{$^{o}F$}}\\
\hline
Faint Red  & 950\\
Dark red & 1150\\
Dark cherry & 1175\\
Cherry red&1300\\
Bright cherry&1475\\
Dark orange&1650\\
Orange&1750\\
Yellow&1800\\
\hline
\end{tabular}\\\\
\end{table}
\blindtext{10}
\end{document}

在此处输入图片描述

另外,表格和后面的文本之间有间隙。如何缩小这个间隙?

答案1

floatrow以下是使用 和的解决方案siunitx

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} 
\usepackage{caption, booktabs, floatrow, threeparttable}
\usepackage{textcomp, siunitx}
\setlength{\extrarowheight}{2pt}
\begin{document}
\setcounter{section}{1}
\counterwithin{table}{section}

\begin{table}
\renewcommand{\normalfont}{\sffamily}
 \centering
\sisetup{detect-family, mode = text, table-format=4.0, table-number-alignment=left}
 \captionsetup{font={bf, sf}}
 \floatsetup{captionskip=6pt}
 \ttabbox[\FBwidth]{\caption{Variation of color with temperature}\label{colortp}}%
 {\begin{tabular}{lS}
\toprule
 \textbf{COLOR} & {\textbf{TEMP.,\,\textdegree F}} \\
 \midrule
 Faint red &950 \\
 Dark red & 1150 \\
 Dark cherry & 1175 \\
 Cherry red & 1300 \\
 Bright cherry & 1475 \\
 Dark orange & 1650 \\
 Orange & 1750 \\
 Yellow & 1800 \\
 \bottomrule
 \end{tabular}}
 \end{table}

\end{document} 

在此处输入图片描述

相关内容