如何调整表格标题的左/右对齐?

如何调整表格标题的左/右对齐?

这是示例图。我想把我的桌子做成那样。

在此处输入图片描述

这是我正在做的事情。

\documentclass{svjour3}
\usepackage{tabularx}
\captionsetup{labelfont=bf, justification=raggedleft, singlelinecheck=false, position=above}

\begin{document}

\begin{table}[ht]
\caption{Definitions of symbols}
\label{Symbols}       % Give a unique label
\begin{tabular}{ll}
\hline\noalign{\smallskip}
    {Symbol} & {Definition} \\
\noalign{\smallskip}\hline\noalign{\smallskip}
    {$\mathcal{G}$} & Graph \\
    {$\mathcal{M}$} & Adjacency matrix \\
    {$N$} & Vertices \\
    {$E$} & Edges \\
\noalign{\smallskip}\hline
\end{tabular}
\end{table}

\end{document}

答案1

使用该包的解决方案sidecap

\documentclass{article}
\usepackage{tabularx,caption}
\usepackage[leftcaption]{sidecap}
\captionsetup{labelfont=bf, justification=raggedleft, singlelinecheck=false}

\begin{document}
\renewcommand{\sidecaptionsep}{1cm} % to be adjusted
\begin{SCtable}[][ht]
\caption{Definitions of symbols}
\label{Symbols}       % Give a unique label
\begin{tabular}{ll}
\hline\noalign{\smallskip}
    {Symbol} & {Definition} \\
\noalign{\smallskip}\hline\noalign{\smallskip}
    {$\mathcal{G}$} & Graph \\
    {$\mathcal{M}$} & Adjacency matrix \\
    {$N$} & Vertices \\
    {$E$} & Edges \\
\noalign{\smallskip}\hline
\end{tabular}
\end{SCtable} 

\end{document}

在此处输入图片描述

答案2

借助floatrow

在此处输入图片描述

\documentclass{svjour3}
\usepackage{booktabs}
\usepackage{floatrow}

\begin{document}
\begin{table}[htb]
\floatbox[{\capbeside\thisfloatsetup{capbesideposition={left,top},capbesidewidth=4cm}}]{table}[\FBwidth]
{\caption{A test figure with its caption side by side}\label{fig:test}}
{\begin{tabular}{ll}
    \toprule
Symbol          &   Definition          \\
    \midrule
$\mathcal{G}$   &   Graph               \\
$\mathcal{M}$   &   Adjacency matrix    \\
$N$             &   Vertices            \\
$E$             &   Edges               \\
    \bottomrule
 \end{tabular}}
\end{table}

or

\begin{table}[htb]
\floatbox[{\capbeside\thisfloatsetup{capbesideposition={right,top},capbesidewidth=4cm}}]{table}[\FBwidth]
{\caption{A test figure with its caption side by side}\label{fig:test}}
{\begin{tabular}{ll}
    \toprule
Symbol          &   Definition          \\
    \midrule
$\mathcal{G}$   &   Graph               \\
$\mathcal{M}$   &   Adjacency matrix    \\
$N$             &   Vertices            \\
$E$             &   Edges               \\
    \bottomrule
 \end{tabular}}
\end{table}

\end{document}

相关内容