将两个字幕分别移至顶部和左侧

将两个字幕分别移至顶部和左侧

我在下表中有两个标题:

\begin{table}[!htbp]
\caption{Stuff Stuff Stufff.}
\begin{tabular}{l |l  l| l}
\hline
  & aaaaaaa  & aaaaaaa & aaaaaaaa \\ \hline
bbbbbbb & bbbbbbbb & bbbbbbbb  & bbbbbbb \\ 
ccccccccccc & cccccccccc & cccccccccc  & cccccccccc \\ 
dddddddddd & dddddddddd & dddddddddd  & ddddddddd \\
eeeeeeeeeee & eeeeeeeeee & eeeeeeeeeee  & eeeeeeeeeee \\ \hline
fffffffffff & ffffffffff & ffffffffff  & fffffffffff \\ \hline
\end{tabular}
\caption*{Stuff Stuff Stuff.}
\end{table}

我想将顶部标题垂直移动一点,将底部标题向左移动。这可能吗?

答案1

标题和浮动内容之间的垂直间隙可以通过skip=<len>以下选项指定caption。或者,您可以使用 在浮点数内手动指定它\vspace

tabular您可以通过设置适当匹配的下方标题将其移动到左侧\multicolumn

在此处输入图片描述

\documentclass{article}

\usepackage{caption}
\captionsetup{skip=2\baselineskip}

\begin{document}

\begin{table}
  \centering
  \caption{Stuff Stuff Stufff.}
  %\vspace{2\baselineskip}% Gap between caption and float content
  \begin{tabular}{l |l  l| l}
    \hline
    & aaaaaaa  & aaaaaaa & aaaaaaaa \\ \hline
    bbbbbbb & bbbbbbbb & bbbbbbbb  & bbbbbbb \\ 
    ccccccccccc & cccccccccc & cccccccccc  & cccccccccc \\ 
    dddddddddd & dddddddddd & dddddddddd  & ddddddddd \\
    eeeeeeeeeee & eeeeeeeeee & eeeeeeeeeee  & eeeeeeeeeee \\ \hline
    fffffffffff & ffffffffff & ffffffffff  & fffffffffff \\ \hline
    \multicolumn{4}{l}{Stuff Stuff Stuff.}
  \end{tabular}
\end{table}

\end{document}

也许你会对booktabs通过您的tabular

在此处输入图片描述

\documentclass{article}

\usepackage{caption,booktabs}
\captionsetup{skip=2\baselineskip}

\begin{document}

\begin{table}
  \centering
  \caption{Stuff Stuff Stufff.}
  \begin{tabular}{ *{4}{l} }
    \toprule
    & aaaaaaa  & aaaaaaa & aaaaaaaa \\
    \midrule
    bbbbbbb & bbbbbbbb & bbbbbbbb  & bbbbbbb \\ 
    ccccccccccc & cccccccccc & cccccccccc  & cccccccccc \\ 
    dddddddddd & dddddddddd & dddddddddd  & ddddddddd \\
    eeeeeeeeeee & eeeeeeeeee & eeeeeeeeeee  & eeeeeeeeeee \\
    \midrule
    fffffffffff & ffffffffff & ffffffffff  & fffffffffff \\
    \bottomrule
    \multicolumn{4}{l}{\footnotesize Stuff Stuff Stuff.}
  \end{tabular}
\end{table}

\end{document}

当然,不需要垂直规则。

相关内容