![如何将子表 h 对齐到文本的限制?](https://linux22.com/image/292543/%E5%A6%82%E4%BD%95%E5%B0%86%E5%AD%90%E8%A1%A8%20h%20%E5%AF%B9%E9%BD%90%E5%88%B0%E6%96%87%E6%9C%AC%E7%9A%84%E9%99%90%E5%88%B6%EF%BC%9F.png)
我有这 2 个子表。我怎样才能进一步分隔这两个表,将图像中指示的空间放在中心以增大中心距离?
我通常使用 \centering 来居中...是否有类似的命令将 h-align 移到右侧或左侧?
\documentclass{article}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{mathtools,amsmath,amssymb}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[spanish]{cleveref}
\usepackage[spanish]{babel}
\begin{document}
\renewcommand{\listtablename}{Índice de tablas}
\renewcommand{\tablename}{Tabla}
\crefname{table}{tabla}{tablas}
jdhjfdks fjkf hjdshjds hfj kdhjk h dj fhdj k fhhfjdfd dsj fl k d sjf kd j fljkasdfk j sd alk flka s j f kla sjf lkd sj fk l sajf kl dsj fl k d sjf kd j fljkasdfk j sd alk flka s j f kla sjf lkd sj fk l sajf kl dsj fl k d sjf kd j fl
After a table we have.. THIS
\begin{table}[h!]
\centering
\begin{subtable}{.48\linewidth}
{\begin{tabular}{|c|c|c|c|c|}
\hline
% after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
{\scriptsize Tarea} & {\scriptsize T.Proc.} & {\scriptsize Límite} & {\scriptsize Ret.} & {\scriptsize Pen.} \\ \hline
$j$ & $t_j$ & $d_j$ & $h_j$ & $p_j$ \\ \hline
1 & 3 & 3 & 3 & 45\\
2 & 7 & 7 & 7 & 23\\
3 & 4 & 14 & 4 & 4\\
\hline
\end{tabular}}
\end{subtable}%
%
\begin{subtable}{.48\linewidth}
{\begin{tabular}{|c|c|c|c|c|}
\hline
% after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
{\scriptsize Tarea} & {\scriptsize T.Proc.} & {\scriptsize Límite} & {\scriptsize Ret.} & {\scriptsize Pen.} \\ \hline
$j$ & $t_j$ & $d_j$ & $h_j$ & $p_j$ \\ \hline
29 & 42 & 175 & 32 & 23\\
30 & 23 & 168 & 12 & 240\\
31 & 17 & 35 & 123 & 23\\
\hline
\end{tabular}}
\end{subtable}%
\caption{JjjreA TABLE}\label{tab:1a}
\end{table}
AFTER The big BIG
\end{document}
答案1
不要使用\centering
,尝试用 分隔两个表格\hfill
。另一种可能性是将一个\hfill
放在左边,一个放在中间,一个放在右边;这样会给出三个大小相同的空间。
\documentclass{article}
\usepackage{lipsum}
\begin{document}
\begin{table}
\rule{4.5cm}{4.5cm} % replace with tabular
\hfill
\rule{4.5cm}{4.5cm} % replace with tabular
\end{table}
\lipsum[1]
\begin{table}
\hfill
\rule{4.5cm}{4.5cm} % replace with tabular
\hfill
\rule{4.5cm}{4.5cm} % replace with tabular
\hfill\null
\end{table}
\end{document}
答案2
A不太优雅解决方案是删除一个子表\centering
,然后删除另一个子表:\raggedright
\raggedleft
\begin{table}[h!]
\begin{subtable}{.5\linewidth}
\raggedright
{\begin{tabular}{|c|c|c|c|c|}
\hline
% after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
{\scriptsize Tarea} & {\scriptsize T.Proc.} & {\scriptsize Límite} & {\scriptsize Ret.} & {\scriptsize Pen.} \\ \hline
$j$ & $t_j$ & $d_j$ & $h_j$ & $p_j$ \\ \hline
1 & 3 & 3 & 3 & 45\\
2 & 7 & 7 & 7 & 23\\
3 & 4 & 14 & 4 & 4\\
\hline
\end{tabular}}
\end{subtable}%
%
\begin{subtable}{.5\linewidth}
\raggedleft
{\begin{tabular}{|c|c|c|c|c|}
\hline
% after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
{\scriptsize Tarea} & {\scriptsize T.Proc.} & {\scriptsize Límite} & {\scriptsize Ret.} & {\scriptsize Pen.} \\ \hline
$j$ & $t_j$ & $d_j$ & $h_j$ & $p_j$ \\ \hline
29 & 42 & 175 & 32 & 23\\
30 & 23 & 168 & 12 & 240\\
31 & 17 & 35 & 123 & 23\\
\hline
\end{tabular}}
\end{subtable}%
\caption{JjjreA TABLE}\label{tab:1a}
\end{table}