使用 Stargazer 切割表格

使用 Stargazer 切割表格

我知道 TeX.SE 上有類似的問題,但我沒有足夠的能力來推斷其他範例和我的範例或隔離有問題的程式碼行。

我很困惑,因為這不僅僅是文字大小造成的截斷 - 如果我將文字大小從 36 更改為 12,它仍然會被截斷。

有人可以建議嗎?

我的表格和程式碼如下。

切斷表

% Table created by stargazer v.5.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
% Date and time: Sun, Apr 30, 2017 - 16:53:55

\begin{table}[!htbp] \centering 
  \caption{} 
  \label{} 
\begin{tabular}{@{\extracolsep{5pt}} cccc} 
\\[-1.8ex]\hline 
\hline \\[-1.8ex] 
 & Variable & Party.With.High.Populism.Score & Party.With.Low.Populism.Score \\ 
\hline \\[-1.8ex] 
1 & Nationalism & Supports nationalistic conception of society & Supports cosmopolitan conception of society \\ 
2 & Multiculturalism & Supports assimilation & Supports multiculturalism \\ 
3 & Immigration & Supports a tough stance on immigration & Opposes tough stance on immigration \\ 
4 & Democratic Freedoms & Values tradition and authoritarian values & Values libertarian values \\ 
5 & Civil Liberties & Supports a tough stance on crime & Promotes civil liberties \\ 
6 & Social Lifestyle & Opposes liberal attitudes to lifestyle & Favours liberal attitudes to lifestyle \\ 
7 & Establishment & Critical of the establishment & Supportive of the establishment \\ 
8 & Religion & Supports religions inflluence on politics as 'moral authority' & Opposes religions influence on politics \\ 
9 & Urban/Rural & Supports rural rather than urban  interests & Supports urban rather than rural interests \\ 
10 & Environment & Prioritises economic growth over environment protection & Prioritises environmental protection over economic growth \\ 
\hline \\[-1.8ex] 
\end{tabular} 
\end{table} 

答案1

幫自己一個大忙,學習如何利用tabularx環境。這樣做將使您擺脫旨在“自動”生成表格材料的軟體所施加的人為(並且可能不令人滿意)的限制。您仍然可以使用這樣的工具來建立表格的初始模型。只是不要將模型視為生產過程的最終或接近最終狀態。

在下表中,內容與您發布的內容沒有變化。顯著變化的是標題設定。例如,列中的材料現在左對齊(具有自動換行功能,以確保表格不會太寬)而不是居中。

在此輸入影像描述

\documentclass{article}
\usepackage[english]{babel}
\usepackage{booktabs,tabularx,caption,ragged2e}
\captionsetup{skip=0.333\baselineskip}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\newlength\mylength
\settowidth\mylength{Multiculturalism} % width of 2nd col.
\begin{document}
\begin{table}[!htbp]
\setlength\tabcolsep{4pt} % default: 6pt
\caption{}  \label{} 
\begin{tabularx}{\textwidth}{@{} l p{\mylength} LL @{}}  
\toprule 
 & Variable & Party with High Populism Score & Party with Low Populism Score \\ 
\midrule
1 & Nationalism & Supports nationalistic conception of society & Supports cosmopolitan conception of society \\ 
2 & Multiculturalism & Supports assimilation & Supports multiculturalism \\ 
3 & Immigration & Supports a tough stance on immigration & Opposes tough stance on immigration \\ 
4 & Democratic Freedoms & Values tradition and authoritarian values & Values libertarian values \\ 
5 & Civil Liberties & Supports a tough stance on crime & Promotes civil liberties \\ 
6 & Social Lifestyle & Opposes liberal attitudes to lifestyle & Favours liberal attitudes to lifestyle \\ 
7 & Establishment & Critical of the establishment & Supportive of the establishment \\ 
8 & Religion & Supports religion's influence on politics as `moral authority' & Opposes religion's influence on politics \\ 
9 & Urban/Rural & Supports rural rather than urban  interests & Supports urban rather than rural interests \\ 
10& Environment & Prioritises economic growth over environment protection & Prioritises environmental protection over economic growth \\ 
\bottomrule
\end{tabularx} 
\end{table}
\end{document}

相關內容