旋转 longtblr 而不旋转页面

旋转 longtblr 而不旋转页面

我已阅读过几篇关于如何制作旋转长桌的讨论。

我特别感兴趣的是pdflscape可以提出一个可行的解决方案,例如: 长桌景观

不过,我希望页面不是最后处于横向模式,因为它与 PDF/A 生成不兼容。

有没有办法专门旋转那些横向页面?

我可以想象页码可能会放错位置,但如果这是唯一的问题,那么对我来说没问题。

我正在使用来自所示链接的 MWE:

\documentclass[11pt]{article}
\usepackage[a4paper,margin=1.5cm]{geometry}

\usepackage[labelfont=bf, textfont=it,
            labelsep=newline,
            justification=centering]{caption}
\captionsetup[table]{ skip=1.4pt, labelfont=sc}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}  % <---
  \ExplSyntaxOn
\NewChildSelector{eachtwo}
  {
    \int_step_inline:nnnn {3}{2}{\l_tblr_childs_total_tl}
      { \clist_put_right:Nn \l_tblr_childs_clist {##1} }
  }
\ExplSyntaxOff

\usepackage{pdflscape}
\sisetup{group-separator={,},
         table-format={(}1.3{***},
         input-open-uncertainty =,
         input-close-uncertainty=,
         }

\begin{document}

%%% <- HERE ADD A COMMAND TO START ROTATING THE LANDSCAPE PAGES %%%

    \begin{landscape}
%
    \begin{longtblr}[
caption = {OLS estimation - Dependent variable std\_gpa},
  label = {OLSstd},
  remark{Note} = {TBW\\ 
                  $^*p<0.1;~^{**}p<0.05;~^{***}p<0.01$.},
                    ]{%colsep = 4pt,
                      colspec = {@{} X *{5}{S} @{}},
                     row{2-Z} = {rowsep=0pt},
                     row{eachtwo} = {abovesep=1ex},
                      rowhead = 1,
                     }
    \toprule
% column headers
            & {{{(1)}}} & {{{(2)}}} & {{{(3)}}} & {{{(4)}}} & {{{(5)}}} \\
    \midrule
% table body
autonuni    &  0.020    &  0.019    &  0.013    &   0.011   &   0.011           \\
            & (0.013)   & (0.013)   & (0.013)   &  (0.013)  &  (0.013)          \\

female      &           &  0.168\TblrNote{***}
                                    &   0.129\TblrNote{***}
                                                &  0.127\TblrNote{***}
                                                            &   0.138\TblrNote{***}  \\
            &           & (0.046)   &  (0.042)  & (0.044)   &  (0.041)          \\

z\_age      &           & -1.142\TblrNote{**}
                                    & -1.070\TblrNote{**}
                                                & -1.122\TblrNote{**}
                                                            & -0.977\TblrNote{*}     \\
            &           & (0.564)   & (0.518)   & (0.519)   & (0.521)           \\

z\_age2     &           &  1.113\TblrNote{*}
                                    &  1.044\TblrNote{*}
                                                &  1.098\TblrNote{**}
                                                            &  0.957\TblrNote{*}     \\
            &           & (0.570)   & (0.523)   & (0.523)   & (0.525)           \\

school\_scientlic
            &           & -0.083    & -0.081    & -0.089    & -0.091\TblrNote{*}     \\
            &           & (0.057)   & (0.056)   & (0.056)   & (0.053)           \\

school\_otherlic    &   & -0.179\TblrNote{***}
                                    & -0.173\TblrNote{***}
                                                & -0.178\TblrNote{***}
                                                            & -0.169\TblrNote{***}   \\
            &           & (0.039)   & (0.039)   & (0.037)   & (0.040)           \\

school\_techvoc
            &           & -0.332\TblrNote{***}
                                    & -0.338\TblrNote{***}
                                                & -0.338\TblrNote{***}
                                                            & -0.345\TblrNote{***}   \\
            &           & (0.066)   & (0.065)   & (0.060)   & (0.059)           \\

z\_e        &           &           & -0.026    & -0.024    & -0.023            \\
            &           &           & (0.019)   & (0.019)   & (0.019)           \\

z\_a        &           &           & -0.040\TblrNote{*}
                                                & -0.042\TblrNote{*}
                                                            & -0.038            \\
            &           &           & (0.023)   & (0.023)   & (0.023)           \\

z\_c        &           &           & 0.094\TblrNote{***}
                                                & 0.093\TblrNote{***}
                                                            & 0.091\TblrNote{***}    \\
            &           &           & (0.017)   & (0.017)   & (0.017)           \\

z\_n        &           &           & -0.034    & -0.029    & -0.028            \\
            &           &           & (0.024)   & (0.023)   & (0.022)           \\

z\_o        &           &           &  0.037\TblrNote{**}
                                                &  0.036\TblrNote{**}
                                                            &  0.037\TblrNote{**}    \\
            &           &           & (0.018)   & (0.017)   & (0.017)           \\

edufat\_high    &       &           &           &  0.037    &  0.026            \\
            &           &           &           & (0.040)   & (0.039)           \\

edufat\_l   &           &           &           & -0.042    & -0.048            \\
            &           &           &           & (0.053)   & (0.055)           \\

edumot\_high    &       &           &           & -0.039    & -0.048            \\
            &           &           &           & (0.050)   & (0.050)           \\
edumot\_l   &           &           &           & 0.099     &  0.085            \\
            &           &           &           & (0.062)   & (0.059)           \\

occupfat\_d2    &       &           &           & -0.059    & -0.055            \\
            &           &           &           & (0.054)   & (0.055)           \\

occupfat\_d3    &       &           &           & -0.164\TblrNote{***}
                                                            & -0.159\TblrNote{**}    \\
            &           &           &           & (0.059)   & (0.059)           \\

occupfat\_d4    &       &           &           &  0.084    &  0.087            \\
            &           &           &           & (0.157)   & (0.155)           \\

occupfat\_d5    &       &           &           & -0.282\TblrNote{***}
                                                            & -0.288\TblrNote{***}   \\
            &           &           &           & (0.070)   & (0.073)           \\

occupmot\_d2    &       &           &           & -0.062    & -0.051            \\
            &           &           &           & (0.038)   & (0.038)           \\

occupmot\_d3    &       &           &           & -0.150\TblrNote{**}
                                                            & -0.135\TblrNote{*}     \\
            &           &           &           & (0.068)   & (0.069)           \\

occupmot\_d4    &       &           &           &  0.063    &  0.061            \\
            &           &           &           & (0.054)   & (0.054)           \\

occupmot\_d5    &       &           &           &  0.024    &  0.027            \\
            &           &           &           & (0.181)   & (0.178)           \\

jobsectfat\_d2  &       &           &           & -0.011    & -0.015            \\
            &           &           &           & (0.060)   & (0.061)           \\

jobsectfat\_d3  &       &           &           & -0.035    & -0.041            \\
            &           &           &           & (0.077)   & (0.076)           \\

jobsectfat\_d4  &       &           &           & -0.037    & -0.034            \\
            &           &           &           & (0.044)   & (0.045)           \\

jobsectmot\_d2  &       &           &           &  0.063    &  0.072            \\
            &           &           &           & (0.119)   & (0.117)           \\

jobsectmot\_d3  &       &           &           &  0.211    &  0.184            \\
            &           &           &           & (0.155)   & (0.155)           \\

jobsectmot\_d4  &       &           &           & -0.029    & -0.018            \\
            &           &           &           & (0.043)   & (0.044)           \\

resid\_provme   &       &           &           &           &  0.002            \\
            &           &           &           &           & (0.033)           \\

resid\_othersicily  &   &           &           &           & -0.084            \\
            &           &           &           &           & (0.062)           \\

resid\_rc   &           &           &           &           &  0.004            \\
            &           &           &           &           & (0.079)           \\

resid\_provrc   &       &           &           &           & -0.175\TblrNote{***}   \\
            &           &           &           &           & (0.062)           \\

resid\_othercalabria
            &           &           &           &           & -0.374\TblrNote{***}   \\
            &           &           &           &           & (0.093)           \\
    
resid\_otheritaly   &   &           &           &           & 0.035             \\
            &           &           &           &           & (0.227)           \\
    \midrule
\(N\)       &{{{3242}}} &{{{3242}}} &{{{3242}}} &{{{3242}}} &{{{3242}}}         \\
    \bottomrule
    \end{longtblr}
    \end{landscape}

%%% <- HERE ADD A COMMAND TO STOP ROTATING THE LANDSCAPE PAGES %%%

\end{document}

更新

我添加了一张图片来更好地解释所需的结果: 所需页面方向

答案1

太期待评论了...

  • 正如我在评论中提到的那样,您所需表格的背景是未知的:
    • 你真的需要那么宽的第一列吗(它的宽度几乎是表格的宽度,但显示的文本却非常窄(大约 8em)。
    • 由于提供了MWE,使用的表格代码可以完美地适应纵向页面。
    • 您所说的旋转表格而不旋转页面是什么意思?这个要求不清楚。您似乎希望带有表格的页面不应旋转(以便于阅读),而应保持文档打印版本的形式。
    • 如果上述情况属实,那么您的问题就不在于表格代码,而在于用于横向页面的包:pdflscape您应该使用而不是lscape
  • 下面是两个示例。第一个示例提供了纵向页面上表格设置的完整 MWE 代码,第二个示例仅显示了如果您坚持旋转页面上的表格所需的更改:
\RequirePackage{etex}
\documentclass[11pt]{article}
\usepackage[a4paper,margin=1.5cm]{geometry}

%\usepackage[labelfont=bf, textfont=it,             % not used in this MWE
%            labelsep=newline,
%            justification=centering]{caption}
%\captionsetup[table]{ skip=1.4pt, labelfont=sc}
\usepackage{tabularray}
    \SetTblrStyle{caption-text}{font=\small}
    \SetTblrStyle{caption-tag}{font=\small\bfseries}
    \SetTblrStyle{conthead-text}{font=\small}
    \SetTblrStyle{contfoot}{font=\footnotesize\itshape}
%----------------
    \UseTblrLibrary{booktabs, siunitx}
\usepackage{linegoal}

\begin{document}
\begingroup
\sisetup{group-separator={,},
         table-format={(}-1.3{$^{***}$},
         input-open-uncertainty =,
         input-close-uncertainty=,
         table-align-text-before = false
         }

    \begin{longtblr}[
caption = {OLS estimation - Dependent variable std\_gpa},
  label = {OLSstd},
remark{Note} = {\parbox[t]{\linegoal}{
                TBW
                $^*:\ p<0.1;\quad ^{**}:\ p<0.05;\quad ^{***}:\ p<0.01$.}
                },
                    ]{colspec  = {@{} X[2.5,l] *{5}{X[c, h, si]} @{}},
                      row{2-Z} = {rowsep=0pt},
                        row{1} = {guard},
                  row{even[3]} = {abovesep=1ex},
                      rowhead  = 1,
                     }
    \toprule
% column headers
            &   (1)     &   (2)     &   (3)     &   (4)     &   (5)             \\
    \midrule
% table body
autonuni    &  0.020    &  0.019    &  0.013    &   0.011   &   0.011           \\
            & (0.013)   & (0.013)   & (0.013)   &  (0.013)  &  (0.013)          \\

female      &           &  0.168\TblrNote{***}
                                    &   0.129\TblrNote{***}
                                                &  0.127\TblrNote{***}
                                                            &   0.138\TblrNote{***}  \\
            &           & (0.046)   &  (0.042)  & (0.044)   &  (0.041)          \\

z\_age      &           & -1.142\TblrNote{**}
                                    & -1.070\TblrNote{**}
                                                & -1.122\TblrNote{**}
                                                            & -0.977\TblrNote{*}     \\
            &           & (0.564)   & (0.518)   & (0.519)   & (0.521)           \\

z\_age2     &           &  1.113\TblrNote{*}
                                    &  1.044\TblrNote{*}
                                                &  1.098\TblrNote{**}
                                                            &  0.957\TblrNote{*}     \\
            &           & (0.570)   & (0.523)   & (0.523)   & (0.525)           \\

school\_scientlic
            &           & -0.083    & -0.081    & -0.089    & -0.091\TblrNote{*}     \\
            &           & (0.057)   & (0.056)   & (0.056)   & (0.053)           \\

school\_otherlic    &   & -0.179\TblrNote{***}
                                    & -0.173\TblrNote{***}
                                                & -0.178\TblrNote{***}
                                                            & -0.169\TblrNote{***}   \\
            &           & (0.039)   & (0.039)   & (0.037)   & (0.040)           \\

school\_techvoc
            &           & -0.332\TblrNote{***}
                                    & -0.338\TblrNote{***}
                                                & -0.338\TblrNote{***}
                                                            & -0.345\TblrNote{***}   \\
            &           & (0.066)   & (0.065)   & (0.060)   & (0.059)           \\

z\_e        &           &           & -0.026    & -0.024    & -0.023            \\
            &           &           & (0.019)   & (0.019)   & (0.019)           \\

z\_a        &           &           & -0.040\TblrNote{*}
                                                & -0.042\TblrNote{*}
                                                            & -0.038            \\
            &           &           & (0.023)   & (0.023)   & (0.023)           \\

z\_c        &           &           & 0.094\TblrNote{***}
                                                & 0.093\TblrNote{***}
                                                            & 0.091\TblrNote{***}    \\
            &           &           & (0.017)   & (0.017)   & (0.017)           \\

z\_n        &           &           & -0.034    & -0.029    & -0.028            \\
            &           &           & (0.024)   & (0.023)   & (0.022)           \\

z\_o        &           &           &  0.037\TblrNote{**}
                                                &  0.036\TblrNote{**}
                                                            &  0.037\TblrNote{**}    \\
            &           &           & (0.018)   & (0.017)   & (0.017)           \\

edufat\_high    &       &           &           &  0.037    &  0.026            \\
            &           &           &           & (0.040)   & (0.039)           \\

edufat\_l   &           &           &           & -0.042    & -0.048            \\
            &           &           &           & (0.053)   & (0.055)           \\

edumot\_high    &       &           &           & -0.039    & -0.048            \\
            &           &           &           & (0.050)   & (0.050)           \\
edumot\_l   &           &           &           & 0.099     &  0.085            \\
            &           &           &           & (0.062)   & (0.059)           \\

occupfat\_d2    &       &           &           & -0.059    & -0.055            \\
            &           &           &           & (0.054)   & (0.055)           \\

occupfat\_d3    &       &           &           & -0.164\TblrNote{***}
                                                            & -0.159\TblrNote{**}    \\
            &           &           &           & (0.059)   & (0.059)           \\

occupfat\_d4    &       &           &           &  0.084    &  0.087            \\
            &           &           &           & (0.157)   & (0.155)           \\

occupfat\_d5    &       &           &           & -0.282\TblrNote{***}
                                                            & -0.288\TblrNote{***}   \\
            &           &           &           & (0.070)   & (0.073)           \\

occupmot\_d2    &       &           &           & -0.062    & -0.051            \\
            &           &           &           & (0.038)   & (0.038)           \\

occupmot\_d3    &       &           &           & -0.150\TblrNote{**}
                                                            & -0.135\TblrNote{*}     \\
            &           &           &           & (0.068)   & (0.069)           \\

occupmot\_d4    &       &           &           &  0.063    &  0.061            \\
            &           &           &           & (0.054)   & (0.054)           \\

occupmot\_d5    &       &           &           &  0.024    &  0.027            \\
            &           &           &           & (0.181)   & (0.178)           \\

jobsectfat\_d2  &       &           &           & -0.011    & -0.015            \\
            &           &           &           & (0.060)   & (0.061)           \\

jobsectfat\_d3  &       &           &           & -0.035    & -0.041            \\
            &           &           &           & (0.077)   & (0.076)           \\

jobsectfat\_d4  &       &           &           & -0.037    & -0.034            \\
            &           &           &           & (0.044)   & (0.045)           \\

jobsectmot\_d2  &       &           &           &  0.063    &  0.072            \\
            &           &           &           & (0.119)   & (0.117)           \\

jobsectmot\_d3  &       &           &           &  0.211    &  0.184            \\
            &           &           &           & (0.155)   & (0.155)           \\

jobsectmot\_d4  &       &           &           & -0.029    & -0.018            \\
            &           &           &           & (0.043)   & (0.044)           \\

resid\_provme   &       &           &           &           &  0.002            \\
            &           &           &           &           & (0.033)           \\

resid\_othersicily  &   &           &           &           & -0.084            \\
            &           &           &           &           & (0.062)           \\

resid\_rc   &           &           &           &           &  0.004            \\
            &           &           &           &           & (0.079)           \\

resid\_provrc   &       &           &           &           & -0.175\TblrNote{***}   \\
            &           &           &           &           & (0.062)           \\

resid\_othercalabria
            &           &           &           &           & -0.374\TblrNote{***}   \\
            &           &           &           &           & (0.093)           \\

resid\_otheritaly   &   &           &           &           & 0.035             \\
            &           &           &           &           & (0.227)           \\
    \midrule
\(N\)       &{{{3242}}} &{{{3242}}} &{{{3242}}} &{{{3242}}} &{{{3242}}}         \\
    \bottomrule
    \end{longtblr}
\endgroup

\end{document}

在此处输入图片描述

在第二个示例中,表格在页面上旋转,那么您需要lscape在文档前言中插入包,并稍微采用在文档中插入表格的方式:



\RequirePackage{etex}
\documentclass[11pt]{article}
\usepackage[a4paper,margin=1.5cm]{geometry}

%\usepackage[labelfont=bf, textfont=it,             % not used in this MWE
%            labelsep=newline,
%            justification=centering]{caption}
%\captionsetup[table]{ skip=1.4pt, labelfont=sc}
\usepackage{tabularray}
    \SetTblrStyle{caption-text}{font=\small}
    \SetTblrStyle{caption-tag}{font=\small\bfseries}
    \SetTblrStyle{conthead-text}{font=\small}    
    \SetTblrStyle{contfoot}{font=\footnotesize\itshape}
%---------------- 
    \UseTblrLibrary{booktabs, siunitx}  
\usepackage[inline]{enumitem}
\usepackage{linegoal}
\usepackage{lscape}         % <---- added

\begin{document}
\begin{landscape}   % <--- added
\sisetup{group-separator={,},
         table-format={(}-1.3{$^{***}$},
         input-open-uncertainty =,
         input-close-uncertainty=,
         table-align-text-before = false
         }

    \begin{longtblr}[
caption = {OLS estimation - Dependent variable std\_gpa},
  label = {OLSstd},
remark{Note} = {\parbox[t]{\linegoal}{
                TBW\\
                $^*:\ p<0.1;\quad ^{**}:\ p<0.05;\quad ^{***}:\ p<0.01$.}
                },
                    ]{colspec  = {@{} X[5,l] *{5}{X[c, h, si]} @{}},  %  changed width of the first column
                      row{2-Z} = {rowsep=0pt},
                        row{1} = {guard},
                  row{even[3]} = {abovesep=1ex},
                      rowhead  = 1,
                     }
    \toprule
% column headers
            &   (1)     &   (2)     &   (3)     &   (4)     &   (5)             \\
    \midrule
% table body is the same ase in the first example
% ...
    \bottomrule
    \end{longtblr}
\end{landscape}     % added

\end{document}

在此处输入图片描述

请告诉我,我是否猜测您的问题实际上是什么是正确的。如果不正确,请澄清您的问题。

在两种环境中,至少表格代码都有所改变(改进),现在代码更短更简单,并且在我看来表格更具吸引力。

顺便说一句,我坚持第一个例子。

相关内容