縮小後如何讓表格居中?

縮小後如何讓表格居中?

我在用著 (像Beamer一樣的大都會主題),我製作了一個簡單的表格並顯示了一些大的東西,然後我查看瞭如何減少它並使用了:

\begin{table}[H]
\resizebox{0.8\textwidth}{!}{\begin{minipage}{\textwidth} 
....
\end{minipage}}
\end{table}

工作正常,但桌子不是中心位置,總是向右側移動。我嘗試使用 包含所有表格\centering \begin{center} and \begin{flushleft},但它沒有移動。

這是我的桌子:

\begin{flushleft}
\begin{table}[H]
 \resizebox{0.8\textwidth}{!}{\begin{minipage}{\textwidth}
\begin{tabular}{l| l l}
\toprule
\textbf{Parameters} & \textbf{Description of values}  \\
\toprule
$ Prohibited\_times $ & Timeslots prohibited for the event. \\
$ Prohibited\_rooms $ & Rooms prohibited for the event. \\
$ Prohibited\_events\_clash $ & Events you can not clash. \\
$ Count\_students $ & Number of students associated to the event. \\
$ Predecessor $ & Events predecessor to the event. \\
$ Successor $ & Event successor to the events. \\
$ Features $ & Characteristics of the event. \\
\bottomrule
\end{tabular}
\end{minipage}}
\end{table}
\end{flushleft} 
\end{frame}

在此輸入影像描述

有任何想法嗎?問候

答案1

您是否嘗試過包含\centeringafter \begin{table}[h]

此外,您也可以刪除minipage環境。

下面的例子對我來說效果很好:

\begin{frame}
    \begin{table}[h]
    \centering
    \resizebox{0.7\textwidth}{!}{
        \begin{tabular}{l l l}
\toprule
\textbf{Parameters} & \textbf{Description of values}  \\
\toprule
$ Prohibited\_times $ & Timeslots prohibited for the event. \\
$ Prohibited\_rooms $ & Rooms prohibited for the event. \\
$ Prohibited\_events\_clash $ & Events you can not clash. \\
$ Count\_students $ & Number of students associated to the event. \\
$ Predecessor $ & Events predecessor to the event. \\
$ Successor $ & Event successor to the events. \\
$ Features $ & Characteristics of the event. \\
\bottomrule
        \end{tabular}
    }
    \end{table}
\end{frame}

答案2

我嘗試使用 adjustmentbox 並且它有效。問候。

\begin{table}[h]
\centering
\begin{adjustbox}{max width=\textwidth}
\begin{tabular}{l| l l}
\toprule
\textbf{Parameters} & \textbf{Description of values}  \\
\toprule
$ Prohibited\_times $ & Timeslots prohibited for the event. \\
$ Prohibited\_rooms $ & Rooms prohibited for the event. \\
$ Prohibited\_events\_clash $ & Events you can not clash. \\
$ Count\_students $ & Number of students associated to the event. \\
$ Predecessor $ & Events predecessor to the event. \\
$ Successor $ & Event successor to the events. \\
$ Features $ & Characteristics of the event. \\
\bottomrule
\end{tabular}
\end{adjustbox}
\end{table}
\end{frame}

相關內容