如何在 tabulary 包中实现十进制对齐以及自动调整表格,下面是我的代码,或者有没有其他方法可以实现这两者,请指导,
\documentclass{article}
\renewcommand{\arraystretch}{1.5}
\usepackage{tabulary}
\usepackage{showframe}
\usepackage[newcommands]{ragged2e}
\begin{document}
\begin{table}
\caption{Sample Table 1 }\label{table_specrot}
\begin{center}
\begin{tabulary}{0.9\textwidth}{LLCL}
\hline
Definition and Validation of Dynamic Video Reframing based on &1.1 & Definition and Validation of & Definition and Validation of Dynamic \\
\hline
Definition and Validation of Dynamic Video Reframing based on &1.441 & Definition and Validation of & Definition and Validation of Dynamic \\
Definition and Validation of Dynamic &1.2 & Definition and Validation of & Definition and Validation of \\
\hline
\end{tabulary}
\end{center}
\end{table}
\end{document}
答案1
只需使用对齐的列,如平常一样:
\documentclass{article}
\renewcommand{\arraystretch}{1.5}
\usepackage{tabulary}
\usepackage{showframe}
\usepackage[newcommands]{ragged2e}
\usepackage{dcolumn}
\begin{document}
\begin{table}
\caption{Sample Table 1 }\label{table_specrot}
\centering
\begin{tabulary}{0.9\textwidth}{LD..{1.2}CL}
\hline
Definition and Validation of Dynamic Video Reframing based on &1.1 & Definition and Validation of & Definition and Validation of Dynamic \\
\hline
Definition and Validation of Dynamic Video Reframing based on &1.441 & Definition and Validation of & Definition and Validation of Dynamic \\
Definition and Validation of Dynamic &1.2 & Definition and Validation of & Definition and Validation of \\
\hline
\end{tabulary}
\end{table}
答案2
没有要求全部列应该是LCR
:
\documentclass{article}
\usepackage{tabulary,siunitx}
\usepackage{showframe}
\usepackage[newcommands]{ragged2e}
\begin{document}
\begin{table}
\caption{Sample Table 1 }\label{table_specrot}
\medskip
\centering
\begin{tabulary}{0.9\textwidth}{LS[table-format=1.3]CL}
\hline
Definition and Validation of Dynamic Video Reframing based on &1.1 & Definition and Validation of & Definition and Validation of Dynamic \\
\hline
Definition and Validation of Dynamic Video Reframing based on &1.441 & Definition and Validation of & Definition and Validation of Dynamic \\
Definition and Validation of Dynamic &1.2 & Definition and Validation of & Definition and Validation of \\
\hline
\end{tabulary}
\end{table}
\end{document}
我删除了设置\arraystretch
。如果您想要更好的布局,请使用booktabs
。
\documentclass{article}
\usepackage{tabulary,siunitx,booktabs}
\usepackage{showframe}
\usepackage[newcommands]{ragged2e}
\begin{document}
\begin{table}
\caption{Sample Table 1 }\label{table_specrot}
\medskip
\centering
\begin{tabulary}{0.9\textwidth}{LS[table-format=1.3]CL}
\toprule
Definition and Validation of Dynamic Video Reframing based on &1.1 & Definition and Validation of & Definition and Validation of Dynamic \\
\midrule
Definition and Validation of Dynamic Video Reframing based on &1.441 & Definition and Validation of & Definition and Validation of Dynamic \\
\addlinespace
Definition and Validation of Dynamic &1.2 & Definition and Validation of & Definition and Validation of \\
\bottomrule
\end{tabulary}
\end{table}
\end{document}
您也可以使用dcolumn
,而不是siunitx
(但我还是建议您更新 TeX 发行版)。
\documentclass{article}
\usepackage{tabulary,dcolumn,booktabs}
\usepackage{showframe}
\usepackage[newcommands]{ragged2e}
\begin{document}
\begin{table}
\caption{Sample Table 1 }\label{table_specrot}
\medskip
\centering
\begin{tabulary}{0.9\textwidth}{LD{.}{.}{1.3}CL}
\toprule
Definition and Validation of Dynamic Video Reframing based on &1.1 & Definition and Validation of & Definition and Validation of Dynamic \\
\midrule
Definition and Validation of Dynamic Video Reframing based on &1.441 & Definition and Validation of & Definition and Validation of Dynamic \\
\addlinespace
Definition and Validation of Dynamic &1.2 & Definition and Validation of & Definition and Validation of \\
\bottomrule
\end{tabulary}
\end{table}
\end{document}