横向格式表格前的缩进

横向格式表格前的缩进

我第一次使用 Latex,使用的是来自 Sharelatex.com 的模板。

为了这个例子,我已尽可能地将其精简。

我希望表格能够覆盖整个文本宽度(就像标题一样),这在普通文档中通常没有问题。由于我的表格非常大,包含两个子表格,因此我希望它横向显示,但麻烦就来了。

我不知道如何操作表格开头和页面之间的空格/缩进/边距。在正常文章中,当我创建这样的表格时,它们会遍布整个页面。如果我在几何包中更改边距,它会移动整个页面内容。

\documentclass[12pt]{article}
\usepackage{subcaption,pdflscape}
\usepackage{siunitx,booktabs}
\usepackage[margin=1in]{geometry}%

\begin{document}
\begin{landscape}
\begin{table} \centering 
{\captionsetup{justification=centering,singlelinecheck=off}
\caption{\bfseries\Large Title for table IV }\label{tab:renvarcov}}
\caption*{\small Referencing the return vector which is table \ref{tab:renvec} and referencing the variance co-variance matrix which is table \ref{tab:varcov}. demo text for table description demo text for table description demo text for table description demo text for table description demo text for table description demo text for table description demo text for table description demo text for table description. Plus some more
text to test some other format}

    \begin{subtable}{1\textwidth}
    \sisetup{table-format=-1.2}
    \centering
    \caption{Vector of expected returns}
        \begin{tabular}{@{}l*{12}{S}@{}}
            \toprule
            Asset & $R_T$ & $U_T$ & $S_T$ & $P_{S B=F}$ & $C_{S B=F}$ & $P_{S B=38\;\$}$ & $C_{B=43.34\;\$}$ & $P_{U B=F}$  & $C_{U B=F}$ & $P_{R B=F}$ & $C_{R B=F}$ \\
            \midrule
            Return & 0.03 & 0.07 & 0.1 & -0.42 & 0.71 & -0.46 & 0.87 & -0.39 & 0.62 & -0.23 & 0.32 \\
            \bottomrule
        \end{tabular}
        \label{tab:renvec}
    \end{subtable}

    \bigskip
    \begin{subtable}{1\textwidth}
    \sisetup{table-format=-1.3}
    \centering
    \caption{Variance-covariance-matrix}
        \begin{tabular}{@{}l*{12}{S}@{}}
            \toprule
              & $R_T$ & $U_T$ & $S_T$ & $P_{S B = F}$ & $C_{S B = F}$  & $P_{S B = 38\;\$}$  & $P_{S B = 43.34\;\$}$  & $P_{U B = F}$  & $C_{U B = F}$ & $P_{R B = F}$ & $C_{R B = F}$ \\
            \midrule
            $R_T$ & 0.009 & -0.001 &    -0.002 &    0.008 & -0.018 &    0.008 & -0.023 &    0.004 & -0.009 &    -0.091 &    0.149  \\
            $U_T$ & -0.001 &    0.026 & 0.007 & -0.026 &    0.063 & -0.027 &    0.080 & -0.129 &    0.307 & 0.009 & -0.013  \\
            $S_T$ & -0.002 &    0.007 & 0.049 & -0.165 &    0.455 & -0.169 &    0.587 & -0.037 &    0.081 & 0.023 & -0.034  \\
            $P_{S B = F}$ & 0.008 & -0.026 &    -0.165 &    1.065 & -1.002 &    1.205 & -1.090 &    0.157 & -0.281 &    -0.081 &    0.133  \\
            $C_{S B = F}$ & -0.018 &    0.063 & 0.455 & -1.002 &    4.715 & -0.922 &    6.283 & -0.313 &    0.737 & 0.204 & -0.294 \\
            $P_{S B = 38\;\$}$ & 0.008 &    -0.027 &    -0.169 &    1.205 & -0.922 &    1.446 & -1.004 &    0.168 & -0.291 &    -0.084 &    0.142  \\
            $C_{S B = 43.34\;\$}$ & -0.023 &    0.080 & 0.587 & -1.090 &    6.283 & -1.004 &    8.598 & -0.388 &    0.944 & 0.261 & -0.369  \\
            $P_{U B = F}$ & 0.004 & -0.129 &    -0.037 &    0.157 & -0.313 &    0.168 & -0.388 &    1.168 & -0.993 &    -0.045 &    0.071  \\
            $C_{U B = F}$ & -0.009 &    0.307 & 0.081 & -0.281 &    0.737 & -0.291 &    0.944 & -0.993 &    4.134 & 0.098 & -0.145  \\
            $P_{R B = F}$ & -0.091 &    0.009 & 0.023 & -0.081 &    0.204 & -0.084 &    0.261 & -0.045 &    0.098 & 1.527 & -1.013 \\
            $C_{R B = F}$ & 0.149 & -0.013 &    -0.034 &    0.133 & -0.294 &    0.142 & -0.369 &    0.071 & -0.145 &    -1.013 &    3.146 \\
            \bottomrule
        \end{tabular}
        \label{tab:varcov}
    \end{subtable}        
\end{table}
\end{landscape}
\end{document}

结果是: enter image description here

有什么帮助我可以尝试将这些表格分布到整个页面宽度吗?

答案1

如果您在方向上只有一个表格landscape,那么最好使用sideways包中的表格rotating,而不是\textwidth(为纵向纸张方向定义)使用\linweidth

\documentclass[12pt]{article}
\usepackage{subcaption}
\usepackage{siunitx,booktabs,rotating}
\usepackage[margin=1in]{geometry}%

\begin{document}
\begin{sidewaystable}
\centering

\captionsetup{font={Large,bf}}% <-- changed
\caption{Title for table IV }
\label{tab:renvarcov}

\captionsetup{font=small, justification=justified}% <-- changed
\caption*{Referencing the return vector which is table \ref{tab:renvec} and referencing the variance co-variance matrix which is table \ref{tab:varcov}. demo text for table description demo text for table description demo text for table description demo text for table description demo text for table description demo text for table description demo text for table description demo text for table description. Plus some more
text to test some other format}

    \begin{subtable}{\linewidth}% <-- changed
    \sisetup{table-format=-1.2}
    \centering
    \caption{Vector of expected returns}
        \begin{tabular}{@{}l*{12}{S}@{}}
            \toprule
    Asset & $R_T$ & $U_T$ & $S_T$ & $P_{S B=F}$ & $C_{S B=F}$ & $P_{S B=38\;\$}$ & $C_{B=43.34\;\$}$ & $P_{U B=F}$  & $C_{U B=F}$ & $P_{R B=F}$ & $C_{R B=F}$ \\
    \midrule
    Return & 0.03 & 0.07 & 0.1 & -0.42 & 0.71 & -0.46 & 0.87 & -0.39 & 0.62 & -0.23 & 0.32 \\
            \bottomrule
        \end{tabular}
        \label{tab:renvec}
    \end{subtable}

    \bigskip
    \begin{subtable}{\linewidth}% <-- changed
    \sisetup{table-format=-1.3}
    \centering
    \caption{Variance-covariance-matrix}
        \begin{tabular}{@{}l*{12}{S}@{}}
    \toprule
      & $R_T$ & $U_T$ & $S_T$ & $P_{S B = F}$ & $C_{S B = F}$  & $P_{S B = 38\;\$}$  & $P_{S B = 43.34\;\$}$  & $P_{U B = F}$  & $C_{U B = F}$ & $P_{R B = F}$ & $C_{R B = F}$ \\
            \midrule
    $R_T$ & 0.009 & -0.001 &    -0.002 &    0.008 & -0.018 &    0.008 & -0.023 &    0.004 & -0.009 &    -0.091 &    0.149  \\
    $U_T$ & -0.001 &    0.026 & 0.007 & -0.026 &    0.063 & -0.027 &    0.080 & -0.129 &    0.307 & 0.009 & -0.013  \\
    $S_T$ & -0.002 &    0.007 & 0.049 & -0.165 &    0.455 & -0.169 &    0.587 & -0.037 &    0.081 & 0.023 & -0.034  \\
    $P_{S B = F}$ & 0.008 & -0.026 &    -0.165 &    1.065 & -1.002 &    1.205 & -1.090 &    0.157 & -0.281 &    -0.081 &    0.133  \\
    $C_{S B = F}$ & -0.018 &    0.063 & 0.455 & -1.002 &    4.715 & -0.922 &    6.283 & -0.313 &    0.737 & 0.204 & -0.294 \\
    $P_{S B = 38\;\$}$ & 0.008 &    -0.027 &    -0.169 &    1.205 & -0.922 &    1.446 & -1.004 &    0.168 & -0.291 &    -0.084 &    0.142  \\
    $C_{S B = 43.34\;\$}$ & -0.023 &    0.080 & 0.587 & -1.090 &    6.283 & -1.004 &    8.598 & -0.388 &    0.944 & 0.261 & -0.369  \\
    $P_{U B = F}$ & 0.004 & -0.129 &    -0.037 &    0.157 & -0.313 &    0.168 & -0.388 &    1.168 & -0.993 &    -0.045 &    0.071  \\
    $C_{U B = F}$ & -0.009 &    0.307 & 0.081 & -0.281 &    0.737 & -0.291 &    0.944 & -0.993 &    4.134 & 0.098 & -0.145  \\
    $P_{R B = F}$ & -0.091 &    0.009 & 0.023 & -0.081 &    0.204 & -0.084 &    0.261 & -0.045 &    0.098 & 1.527 & -1.013 \\
    $C_{R B = F}$ & 0.149 & -0.013 &    -0.034 &    0.133 & -0.294 &    0.142 & -0.369 &    0.071 & -0.145 &    -1.013 &    3.146 \\
            \bottomrule
        \end{tabular}
        \label{tab:varcov}
    \end{subtable}
\end{sidewaystable}
\end{document}

enter image description here

相关内容