Adjustbox 包中表格标题的左对齐

Adjustbox 包中表格标题的左对齐

我想将表格标题的位置改为左边,如果有人能帮忙我将不胜感激, 在此处输入图片描述

\documentclass[12pt,a4paper]{article} 
\usepackage{caption} 
\captionsetup[table]{singlelinecheck=false}
\usepackage{adjustbox}
\captionsetup[table]{
    labelsep = newline,
    textfont = sc, 
    name = TABLE, 
    justification=justified,
    singlelinecheck=false,%%%%%%% a single line is centered by default
    labelsep=colon,%%%%%%
    skip = \medskipamount}
\begin{document}


\begin{table}
    \centering
    \caption{Variables and Definitions}\label{table:2}
    \begin{adjustbox}{center}
        \begin{tabular}{ l p{10.5cm} p{3cm}}
            \hline\hline   
            Variables &  Definition & Source \\  \hline\hline   
            POV    & Measured as Poverty Headcount ratio at \$ 2 a day           & WDI                    \\   
            PG     & Measured as Poverty gap at \$ 2 a day       & WDI                   \\  
            GINI   & Income Inequality, natural log of GINI coefficient  &  WDI     \\   \hline                              
            \hline\hline    
            \multicolumn{3}{l}{%
                \begin{minipage}{16cm}%
                    \tiny Note: $+$The World Bank, World Development Indicators (WDI). %
                \end{minipage}%
            }\\
        \end{tabular}
    \end{adjustbox}
\end{table}

\结束{文档}

答案1

如果您只是对最后一列使用说明符,则不需要adjustbox此表。所有这些都可以通过和环境l完成。我还冒昧地用包中的规则替换了您的 s ,并使用来自同一包的规则为行添加一些垂直填充:threeparttabletablenotes\hlinebooktabs\addlinespace

\documentclass[12pt,a4paper]{article}
\usepackage[showframe]{geometry}
\usepackage{caption}
\captionsetup[table]{singlelinecheck=false}
\usepackage{adjustbox}
\captionsetup[table]{
labelsep = newline,
textfont = sc,
name = TABLE,
justification=justified,
singlelinecheck=false,%%%%%%% a single line is centered by default
labelsep=colon,%%%%%%
skip = \medskipamount}
\usepackage{booktabs, threeparttable}

\begin{document}

\begin{table}
  \centering
  \begin{threeparttable}[online]
    \caption{Variables and Definitions}\label{table:2}
    \begin{tabular}{lp{10.5cm}l}
      \toprule\midrule
      Variables & Definition & Source \\
      \midrule\midrule
      POV & Measured as Poverty Headcount ratio at \$ 2 a day & WDI \\
      \addlinespace
      PG & Measured as Poverty gap at \$ 2 a day & WDI \\
      \addlinespace
      GINI & Income Inequality, natural log of GINI coefficient & WDI \\
      \midrule \bottomrule
    \end{tabular}
    \begin{tablenotes}[online]\medskip
      \tiny \item[Note:] $+$The World Bank, World Development Indicators (WDI). %
    \end{tablenotes}
  \end{threeparttable}
\end{table}

\end{document} 

在此处输入图片描述

答案2

以下用途如何让太宽的表格居中?用于将桌子置于中央,以及changepageadjustwidth留出适当的空间以\caption匹配tabular布局。虽然原始布局建议将标题移动到第一列的宽度上(其中包含Variables最宽的条目)。但是,目测它也足够了。

在此处输入图片描述

\documentclass[a4paper]{article} 
\usepackage{caption,lipsum}
\usepackage{booktabs,changepage}

\captionsetup[table]{
    labelsep = newline,
    textfont = sc, 
    name = TABLE, 
    justification=justified,
    singlelinecheck=false,%%%%%%% a single line is centered by default
    labelsep=colon,%%%%%%
    skip = \medskipamount}

\begin{document}


\begin{table}
  \makeatletter
  \settowidth{\@tempdima}{Variables}%
  \addtolength{\@tempdima}{2\tabcolsep}%
  \begin{adjustwidth}{-\@tempdima}{\@tempdima}
    \caption{Variables and Definitions}
  \end{adjustwidth}
  \makeatother
  \makebox[\textwidth]{% https://tex.stackexchange.com/a/39436/5764
    \begin{tabular}{ l p{10.5cm} p{3cm}}
      \toprule
      Variables & Definition & Source \\
      \midrule
      POV       & Measured as Poverty Headcount ratio at \$ 2 a day  & WDI \\
      PG        & Measured as Poverty gap at \$ 2 a day              & WDI \\
      GINI      & Income Inequality, natural log of GINI coefficient & WDI \\
      \bottomrule
      \multicolumn{3}{l}{%
        \tiny Note: $+$The World Bank, World Development Indicators (WDI).%
      }
    \end{tabular}%
  }
\end{table}

\lipsum[1]

\end{document}

booktabs已添加 pizzaz...

相关内容