紙上的表格 (A4) 被切斷

紙上的表格 (A4) 被切斷

我使用表格建立了一個寬表。儘管它在 pdf 上看起來很好,但當我在 A4 上列印時,表格的右側被剪掉了。知道為什麼會發生這種情況嗎?我知道我可以簡單地用表格減小列寬,但在列印之前我沒有任何跡象表明文字超出了邊距。

 \documentclass[12pt, oneside, landspace, leqno]{report}
\usepackage[doublespacing]{setspace}
\usepackage[top=.8in, left=0.5in]{geometry}%bottom=.8in,left=1in,right=2.54cm]{geometry} % customized margins
\geometry{headsep = 25pt}
\usepackage{apacite}
\usepackage{tabularx}
\usepackage{tikz}
\usepackage{float}
\usepackage{booktabs}
\newgeometry{left=0.5cm,bottom=0.3cm,top=0.2cm}
\begin{document}
\begin{center}
\begin{table}[H]
{\footnotesize
\begin{tabular}{ p{4cm} p{4cm} p{4cm} p{7cm}}
\toprule
Part 1&Part 2&Part 3&Part 4\\ \midrule
Bei et al., 2006 & E2 - Positive NB; PELL - classifiers SVM, NB, C4.5 & LingSpam ;PU1 & E2 94.20\% accuracy, PDB 90.10\%, PERL 88.29\% \\
Yus \& Xuin, 2005 & NB; NMN; SVM; RVM &Spam Ensemble; Babletext & SVM - 92\%, 94.5\%; NN 81.3\%, 82.7\%; NB - 93.7\%, 95.8\% \\
\bottomrule
\end{tabular}
\caption{demo table}
}
\end{table}
\end{center}
\end{document}

答案1

我猜想,您實際上喜歡文件的縱向方向,並且只有非常大的桌子才處於橫向方向。您所展示的範例的表格實際上並沒有那麼大(我認為需要。

根據您的序言,您有一個使用tabularx表格的計劃。有了它,您已經可以在推表格中使用它,透過它保證它不會突出右側的文字寬度:

\documentclass[12pt, oneside, a4paper, leqno]{report}
    \usepackage[doublespacing]{setspace}
    \usepackage[margin=1in,showframe]{geometry}% <-- changed to usual margins
\geometry{headsep = 25pt}
    \usepackage{booktabs, tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash
                    \let\\\newline}X}
    \usepackage{siunitx}% <-- added for units

    \begin{document}
\begin{table}[h]
\footnotesize
\begin{tabularx}{\textwidth}{lLLL}
    \toprule
Part 1  &   Part 2  &   Part 3  &   Part 4                      
    \tabularnewline\midrule
Bei et al., 2006 
        &   E2 - Positive NB; \\
            PELL - classifiers SVM, NB, C4.5
                    &   LingSpam; PU1
                                &   E2   \SI{94.20}{\%} accuracy,\\ 
                                    PDB  \SI{90.10}{\%}, \\
                                    PERL \SI{88.29}{\%}   
    \tabularnewline\addlinespace
Yus \& Xuin, 2005 
        &   NB; NMN; SVM; RVM
            &   Spam Ensemble; Babletext
                        &   SVM - \SI{92}{\%}, \SI{94.5}{\%}; \\
                            NN  - \SI{81.3}{\%}, \SI{82.7}{\%}; \\
                            NB  - \SI{93.7}{\%}, \SI{95.8}{\%} 
    \tabularnewline\bottomrule
\end{tabularx}
    \caption{demo table}
\end{table}
    \end{document}

這使:

在此輸入影像描述

如果您確實需要寬桌子,請將桌子方向變更為橫向。例如(也)可以使用rotating套件及其sidewaystable環境來完成此操作:

\documentclass[12pt, oneside, a4paper, leqno]{report}
    \usepackage[doublespacing]{setspace}
    \usepackage[margin=1in,show frame]{geometry}
\geometry{headsep = 25pt}
    \usepackage{booktabs, tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash
                    \let\\\newline}X}
    \usepackage{siunitx}
    \usepackage{rotating}

    \begin{document}
\begin{sidewaystable}
\footnotesize
\begin{tabularx}{\textwidth}{lLLL}
    \toprule
Part 1  &   Part 2  &   Part 3  &   Part 4                      
    \tabularnewline\midrule
Bei et al., 2006 
        &   E2 - Positive NB; \\
            PELL - classifiers SVM, NB, C4.5
                    &   LingSpam; PU1
                                &   E2   \SI{94.20}{\%} accuracy,\\ 
                                    PDB  \SI{90.10}{\%}, \\
                                    PERL \SI{88.29}{\%}   
    \tabularnewline\addlinespace
Yus \& Xuin, 2005 
        &   NB; NMN; SVM; RVM
            &   Spam Ensemble; Babletext
                        &   SVM - \SI{92}{\%}, \SI{94.5}{\%}; \\
                            NN  - \SI{81.3}{\%}, \SI{82.7}{\%}; \\
                            NB  - \SI{93.7}{\%}, \SI{95.8}{\%} 
    \tabularnewline\bottomrule
\end{tabularx}
    \caption{demo table}
\end{sidewaystable}
    \end{document}

這使:

在此輸入影像描述

在這兩個範例中,我在 MWE 的序言中刪除了所有與表格設計無關的套件。對於列類型,我用於l第一列和L其他列。其L定義見序言。

希望這個答案能給您一些額外的想法,幫助您設計您的桌子。

答案2

預設佈局適用於美國信函,與 A4 不符。為了確保您獲得 A4,請新增a4paper到課程選項或選項中幾何學。我會用:

\documentclass[12pt, oneside, a4paper, landscape, leqno]{report}

landscape在這裡,我也糾正一下錯字。請注意,編譯時檢查控制台輸出有時會告訴您有用的信息,例如“全域選項”landspace被忽略。

正如 David 指出的,將浮子放入center環境中是沒有意義的。 (tablefigure是浮點數的範例。)您可能想\centering在環境內部使用。

\documentclass[12pt, oneside, a4paper, landscape, leqno]{report}
\usepackage[doublespacing]{setspace}
\usepackage[top=.8in, left=0.5in]{geometry}%bottom=.8in,left=1in,right=2.54cm]{geometry} % customized margins
\geometry{headsep = 25pt}
\usepackage{apacite}
\usepackage{tabularx}
\usepackage{tikz}
\usepackage{float}
\usepackage{booktabs}
\newgeometry{left=0.5cm,bottom=0.3cm,top=0.2cm}
\begin{document}
\begin{table}[H]
  \centering
  \footnotesize
  \begin{tabular}{ p{4cm} p{4cm} p{4cm} p{7cm}}
    \toprule
    Part 1&Part 2&Part 3&Part 4\\ \midrule
    once upon a time in biblical times the Romans were &there were a few & green apples & and crazy apes\\
    once upon a time &there were a few & green apples & and crazy apes filled the Amazonian forests\\
    \bottomrule
  \end{tabular}
  \caption{demo table}
\end{table}
\end{document}

這確實使用橫向 A4,但您的佈局仍然有些混亂。你有:

\usepackage[top=.8in, left=0.5in]{geometry}%bottom=.8in,left=1in,right=2.54cm]{geometry} % 自訂邊距\geometry{headsep = 25pt} ... \ newgeometry{左=0.5cm,下=0.3cm,上=0.2cm}

但你到底想要什麼?有時在文件開始後更改頁面佈局是有意義的,但在文件開始之前更改頁面佈局有什麼意義呢?原始設定(大部分,但有些變化且不可預測)被覆蓋,只有(成功的)新設定才會產生任何效果。

我還想說這些是非常小利潤。我認為我能使用的任何印表機都無法容納這些。結果是我的內容在印刷時會被剪掉,即使理論上它適合紙張。

這是上面寫的結果

邊際利潤

新增showframe到我們提供的選項中幾何學,我們可以看到佈局:

邊際利潤顯露

這可能不是你想要的...

相關內容