带对齐的表格

带对齐的表格

在此处输入图片描述我即将完成我的硕士论文并且面临一些表格方面的最后问题,我无法整理这个。

\documentclass[12pt,a4paper,oneside,openright]{book}
\usepackage{adjustbox}
\usepackage{array}
\usepackage{dcolumn}
\usepackage{amsmath,amssymb}  

\usepackage{amsthm}
\usepackage{booktabs} 
\usepackage{caption}  
\usepackage{multirow}
\usepackage{siunitx} 
\usepackage{tabularx}
\usepackage{ltablex}
\usepackage{makecell}

\begin{document}
\begin{table}
\centering
\caption{Analisi variabile tasso di interesse\label{tab:stat:tasso}}
\begin{tabular}{p{3cm}p{3cm}}
\toprule
Data di segnalazione & \makecell[ccc]{\% \\ Tasso di interesse\\ medio} \\
\toprule
2014h1 & 3.59\\
2014h2 & 3.44 \\
2015h1 & 3.37 \\
2015h2 & 3.82 \\
2016h1 & 3.68 \\
\bottomrule
Media & 3.58 \\
\end{tabular}%
\end{table}%
\end{document}

答案1

3cm是啥原因?

\documentclass[12pt,a4paper,oneside,openright]{book}
\usepackage{adjustbox}
\usepackage{array}
\usepackage{dcolumn}
\usepackage{amsmath,amssymb}  

\usepackage{amsthm}
\usepackage{booktabs} 
\usepackage{caption}  
\usepackage{multirow}
\usepackage{siunitx} 
\usepackage{tabularx}
\usepackage{ltablex}
\usepackage{makecell}

\begin{document}

\begin{table}
\centering

\caption{Analisi variabile tasso di interesse\label{tab:stat:tasso}}

\begin{tabular}{lS[table-format=1.2]}
\toprule
\makecell{Data di \\ segnalazione} & 
{\makecell{Tasso di interesse\\ medio (\%)}} \\
\toprule
2014h1 & 3.59\\
2014h2 & 3.44 \\
2015h1 & 3.37 \\
2015h2 & 3.82 \\
2016h1 & 3.68 \\
\midrule
Media & 3.58 \\
\bottomrule
\end{tabular}

\end{table}

\end{document}

在此处输入图片描述

答案2

S您可以使用带有适当选项的列来实现以下输出table-format

在此处输入图片描述

\documentclass[12pt,a4paper,oneside,openright]{book}

\usepackage{booktabs} 
\usepackage{siunitx} 
\usepackage{makecell}

\begin{document}
\begin{table}
\centering
\caption{Analisi variabile tasso di interesse\label{tab:stat:tasso}}
\begin{tabular}{cS[table-format=1.2]}
\toprule
\makecell[cc]{Data di \\ segnalazione} & {\makecell[cc]{\% \\ Tasso di interesse\\ medio}} \\
\toprule
2014h1 & 3.59\\
2014h2 & 3.44 \\
2015h1 & 3.37 \\
2015h2 & 3.82 \\
2016h1 & 3.68 \\
\bottomrule
Media & 3.58 \\
\end{tabular}%
\end{table}%
\end{document}

相关内容