在 Latex 中調整表格大小

在 Latex 中調整表格大小

我在將 TEXSHOP 檔案中的兩個表格調整為正確的大小時遇到問題。下面我附上了一個螢幕截圖,顯示該桌子顯然太小而看不見。我的程式碼如下:

\begin{table}[h]
\centering 
\begin{adjustbox}{max width=\textwidth}
\begin{tabular} {|| l | l ||}
\hline

\end{tabular}
\end{adjustbox}
\caption{Benefits of participatory sensing}
\label{benefits}
\end{table} 

在此輸入影像描述

非常感謝您的幫助,雨果

答案1

如果沒有必要,請勿縮放表格。如果您有這麼多文本,您也可以將其寫為逐項或使用段落或類似內容。

為了獲得最大寬度,我會推薦tabularx這裡的套件:

% arara: pdflatex

\documentclass{article}
\usepackage{blindtext}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{ragged2e}
\usepackage{microtype}

\begin{document}    
\begin{table}
    \centering 
    \begin{tabularx}{\textwidth}{@{}l>{\RaggedRight}X@{}} % @{} takes away any horizontal spacing at the borders. Not beautiful, but gives you some more space. 
        \toprule
        bla bla blup & \blindtext\\
        \bottomrule
    \end{tabularx}
    \caption{Benefits of participatory sensing}\label{benefits}
\end{table} 
\setcounter{section}{3}
\setcounter{subsection}{2}
\setcounter{subsubsection}{2}
\subsubsection{Challenges or participatory sensing}
\blindtext
\end{document}

在此輸入影像描述

如果您想調整第一列以獲得所需定義的寬度,您應該將 替換lp{<some dimension>}。在這種情況下,如果您希望像\RaggedRight我在上面的 MWE 中那樣設置列,您可能需要加載ragged2e\usepackage[raggedrightboxes]{ragged2e}.

相關內容