【问题标题】:How do I automatically break line within a cell in a LaTeX table containing counts and percentage如何在包含计数和百分比的 LaTeX 表格中的单元格内自动换行
【发布时间】:2020-07-04 15:13:54
【问题描述】:

我想将每个括号及其内容移动到每个单元格中的新行,以创建更多空间。有没有聪明的方法来做到这一点?

\begin{table}[ht]
    \centering
        \resizebox{\textwidth}{!}{
    \begin{tabular}{lrrrrrrrrrrrrrr}
        \toprule
        & 2007 (N=2571) & 2008 (N=4888) & 2009 (N=6856) & 2010 (N=8669) & 2011 (N=9812) & 2012 (N=10734) & 2013 (N=13582) & 2014 (N=14500) & 2015 (N=14529) & 2016 (N=13739) & 2017 (N=12178) & 2018 (N=9525) & NULL (N=228) & Total (N=121811) \\ 
        \midrule
        Sex &  &  &  &  &  &  &  &  &  &  &  &  &  &  \\ 
        -  Male & 1410 (54.8\%) & 2538 (51.9\%) & 3537 (51.6\%) & 4514 (52.1\%) & 5015 (51.1\%) & 5564 (51.8\%) & 7241 (53.3\%) & 7970 (55.0\%) & 8195 (56.4\%) & 7861 (57.2\%) & 7091 (58.2\%) & 5572 (58.5\%) & 129 (56.6\%) & 66637 (54.7\%) \\ 
        -  Female & 1150 (44.7\%) & 2283 (46.7\%) & 3219 (47.0\%) & 4103 (47.3\%) & 4795 (48.9\%) & 5169 (48.2\%) & 6340 (46.7\%) & 6530 (45.0\%) & 6334 (43.6\%) & 5878 (42.8\%) & 5087 (41.8\%) & 3953 (41.5\%) & 91 (39.9\%) & 54932 (45.1\%) \\ 
        -  NULL & 11 (0.4\%) & 67 (1.4\%) & 100 (1.5\%) & 52 (0.6\%) & 2 (0.0\%) & 1 (0.0\%) & 1 (0.0\%) & 0 (0.0\%) & 0 (0.0\%) & 0 (0.0\%) & 0 (0.0\%) & 0 (0.0\%) & 8 (3.5\%) & 242 (0.2\%) \\ 
        AgeBin &  &  &  &  &  &  &  &  &  &  &  &  &  &  \\ 
        -  0to4 & 31 (1.2\%) & 42 (0.9\%) & 64 (0.9\%) & 98 (1.1\%) & 88 (0.9\%) & 161 (1.5\%) & 119 (0.9\%) & 149 (1.0\%) & 154 (1.1\%) & 143 (1.0\%) & 174 (1.4\%) & 153 (1.6\%) & 3 (1.3\%) & 1379 (1.1\%) \\ 
    \bottomrule
    \end{tabular}
}
\end{table}

【问题讨论】:

标签: count latex break percentage xtable


【解决方案1】:

正如对您问题的第一条评论,您可以切换

\begin{tabular}{lrrrrrrrrrrrrrr}

\begin{tabular}{*{15}{p{15mm}}}

这将一次性在单元格中插入换行符,但您仍然有很多列并且仍然超出了页面跨度。

也许newgeometry 包中的newgeometry 命令和landscape 选项可能会有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多