表格左侧的标题

表格左侧的标题

如何在左侧显示表格标题?

谢谢你, 在此处输入图片描述

答案1

使用包sidecup

\documentclass{article}
\usepackage[leftcaption]{sidecap} % <-- added
\usepackage{booktabs}
\usepackage{lipsum}

\begin{document}
\lipsum[1]
\begin{SCtable}[][ht]
\caption{The caption text over multiple lines on outer side of table}%
\label{tab:side}
    \begin{tabular}{lll}\toprule
        bla & blu & lbll \\
        \midrule
        bla & djfgkdjf jkdfg  dfkgjd kjgkd fkgjdkfgj kdjfgkj & lbll \\
        bla & blu & lbll \\
        bla & blu & lbll \\
        \bottomrule
    \end{tabular}
\end{SCtable}
\lipsum[2]
\begin{table}[ht]
\caption{The caption text over multiple lines on the top of table}%
\label{tab:top}
\centering
    \begin{tabular}{lll}\toprule
        bla & blu & lbll \\
        \midrule
        bla & djfgkdjf jkdfg  dfkgjd kjgkd fkgjdkfgj kdjfgkj & lbll \\
        bla & blu & lbll \\
        bla & blu & lbll \\
        \bottomrule
    \end{tabular}
\end{table}
\lipsum[3]
\end{document}

在此处输入图片描述

答案2

您可以使用minipage环境将内容并排放置。 可以与环境\caption不同。使用可选参数,您可以将两者对齐到顶部。为了使它正常工作,我建议将本地设置为零,以避免标题上方出现一些不必要的空间。此外,小页面应该以零高度线开始,以便对齐。minipagetabularminipage\abovecaptionskiptabular\vspace*{0pt}

这里有一个带有 s 的示例代码minipage,然后是使用该包的第二种方法adjustbox

\documentclass{article}
\usepackage{adjustbox}
\usepackage{booktabs}
\usepackage{lipsum}

\begin{document}
\lipsum

\begin{table}

\begin{minipage}[t]{.2\textwidth}
    \setlength{\abovecaptionskip}{0pt}%
    \caption{The caption text over multiple lines}%
\end{minipage}\hfill
\begin{minipage}[t]{.75\textwidth}\vspace*{0pt}%
    \begin{tabular}{lll}\toprule
        bla & blu & lbll \\
        \midrule
        bla & djfgkdjf jkdfg  dfkgjd kjgkd fkgjdkfgj kdjfgkj & lbll \\
        bla & blu & lbll \\
        bla & blu & lbll \\
        \bottomrule
    \end{tabular}
\end{minipage}


\end{table}

\lipsum


\begin{table}

\begin{adjustbox}{minipage=[t]{.2\textwidth},valign=t}
    \setlength{\abovecaptionskip}{0pt}%
    \caption{The caption text over multiple lines}%
\end{adjustbox}\hfill
\begin{adjustbox}{minipage=.75\textwidth,valign=t}
    \begin{tabular}{lll}\toprule
        bla & blu & lbll \\
        \midrule
        bla & djfgkdjf jkdfg  dfkgjd kjgkd fkgjdkfgj kdjfgkj & lbll \\
        bla & blu & lbll \\
        bla & blu & lbll \\
        \bottomrule
    \end{tabular}
\end{adjustbox}

\end{table}

\lipsum


\end{document}

两个图形看起来都像这样。

结果

.2\textwidth请注意,您可以通过更改和来调整宽度.75\textwidth。两者之和应小于1.0\textwidth,并且之间不应有换行符,minipages以便两者构成一条线。

相关内容