如何让表格居中?

如何让表格居中?
    \section{Technical Skills}
\vspace{1mm}
% Please add the following required packages to your document preamble:
% \usepackage{booktabs}

\begin{table}
\centering
\begin{tabular}{@{}ll@{}}
\toprule
\textbf{\begin{tabular}[c]{@{}l@{}}Programming \\ Languages\end{tabular}} & \begin{tabular}[c]{@{}l@{}} $\bullet${\textbf{ Technical:}} C, MATLAB, Python\\  $\bullet${\textbf{ Editing:}} Photoshop\end{tabular}                                                                                                                                    \\ \midrule
\textbf{\begin{tabular}[c]{@{}l@{}}Software\\ Packages\end{tabular}}      & \begin{tabular}[c]{@{}l@{}} $\bullet${\textbf{ AutoCad:}} Design and Drafting\\  $\bullet${\textbf{ Ansys:}} Finite Element Software\\  $\bullet${\textbf{ ArcGis:}} Analyse Spatial Data\\  $\bullet${\textbf{ Qualk2k:}} Surface Water Quality Modeling\\  $\bullet${\textbf{ SWMM:}} Strom Water Management \& Modeling\end{tabular} \\ \bottomrule
\end{tabular}
\end{table}[![][1]][1]

这是我在 Overleaf 中编译时得到的结果

答案1

特别是,我在环境方面遇到了很多问题table。如果您不需要“Table X”,则无需使用\begin{table}。如果您需要这个,您可以使用以下包之一:captioncapt-of或班级memoir

table没有and 使用captionand 的示例minipage

在此处输入图片描述

\documentclass{article}

\usepackage{booktabs}
\usepackage{caption}
\usepackage{changepage}

\begin{document}

\section{Technical Skills}
\vspace{1mm}

Some text

\begin{tabular}{@{}ll@{}}
\toprule
\textbf{\begin{tabular}[c]{@{}l@{}}Programming \\ Languages\end{tabular}} & \begin{tabular}[c]{@{}l@{}} $\bullet${\textbf{ Technical:}} C, MATLAB, Python\\  $\bullet${\textbf{ Editing:}} Photoshop\end{tabular}                                                                                                                                    \\ \midrule
\textbf{\begin{tabular}[c]{@{}l@{}}Software\\ Packages\end{tabular}}      & \begin{tabular}[c]{@{}l@{}} $\bullet${\textbf{ AutoCad:}} Design and Drafting\\  $\bullet${\textbf{ Ansys:}} Finite Element Software\\  $\bullet${\textbf{ ArcGis:}} Analyse Spatial Data\\  $\bullet${\textbf{ Qualk2k:}} Surface Water Quality Modeling\\  $\bullet${\textbf{ SWMM:}} Strom Water Management \& Modeling\end{tabular} \\ \bottomrule
\end{tabular}

\vspace{15mm}

\begin{adjustwidth}{-2cm}{}
\begin{tabular}{@{}ll@{}}
\toprule
\textbf{\begin{tabular}[c]{@{}l@{}}Programming \\ Languages\end{tabular}} & \begin{tabular}[c]{@{}l@{}} $\bullet${\textbf{ Technical:}} C, MATLAB, Python\\  $\bullet${\textbf{ Editing:}} Photoshop\end{tabular}                                                                                                                                    \\ \midrule
\textbf{\begin{tabular}[c]{@{}l@{}}Software\\ Packages\end{tabular}}      & \begin{tabular}[c]{@{}l@{}} $\bullet${\textbf{ AutoCad:}} Design and Drafting\\  $\bullet${\textbf{ Ansys:}} Finite Element Software\\  $\bullet${\textbf{ ArcGis:}} Analyse Spatial Data\\  $\bullet${\textbf{ Qualk2k:}} Surface Water Quality Modeling\\  $\bullet${\textbf{ SWMM:}} Strom Water Management \& Modeling\end{tabular} \\ \bottomrule
\end{tabular}
\end{adjustwidth}

\vspace{15mm}

\begin{minipage}{\textwidth}
\captionof{table}{Name of table}
\begin{tabular}{@{}ll@{}}
\toprule
\textbf{\begin{tabular}[c]{@{}l@{}}Programming \\ Languages\end{tabular}} & \begin{tabular}[c]{@{}l@{}} $\bullet${\textbf{ Technical:}} C, MATLAB, Python\\  $\bullet${\textbf{ Editing:}} Photoshop\end{tabular}                                                                                                                                    \\ \midrule
\textbf{\begin{tabular}[c]{@{}l@{}}Software\\ Packages\end{tabular}}      & \begin{tabular}[c]{@{}l@{}} $\bullet${\textbf{ AutoCad:}} Design and Drafting\\  $\bullet${\textbf{ Ansys:}} Finite Element Software\\  $\bullet${\textbf{ ArcGis:}} Analyse Spatial Data\\  $\bullet${\textbf{ Qualk2k:}} Surface Water Quality Modeling\\  $\bullet${\textbf{ SWMM:}} Strom Water Management \& Modeling\end{tabular} \\ \bottomrule
\end{tabular}
\end{minipage}

\end{document}

答案2

如果您添加文档类并加载包 boooktabs,表格将编译成功并位于中心。如果您更喜欢标题后的表格,请尝试将选项添加\begin{table}[h!]到表格环境中(它可能有效,但并非总是有效):

在此处输入图片描述

\documentclass{article}
\usepackage{booktabs}

\begin{document}

\section{Technical Skills}
\vspace{1mm}

Some text

\begin{table}  %% Add option [h!] if you prefer the table after the heading.
\centering
\begin{tabular}{@{}ll@{}}
\toprule
\textbf{\begin{tabular}[c]{@{}l@{}}Programming \\ Languages\end{tabular}} & \begin{tabular}[c]{@{}l@{}} $\bullet${\textbf{ Technical:}} C, MATLAB, Python\\  $\bullet${\textbf{ Editing:}} Photoshop\end{tabular}                                                                                                                                    \\ \midrule
\textbf{\begin{tabular}[c]{@{}l@{}}Software\\ Packages\end{tabular}}      & \begin{tabular}[c]{@{}l@{}} $\bullet${\textbf{ AutoCad:}} Design and Drafting\\  $\bullet${\textbf{ Ansys:}} Finite Element Software\\  $\bullet${\textbf{ ArcGis:}} Analyse Spatial Data\\  $\bullet${\textbf{ Qualk2k:}} Surface Water Quality Modeling\\  $\bullet${\textbf{ SWMM:}} Strom Water Management \& Modeling\end{tabular} \\ \bottomrule
\end{tabular}
\end{table}
\end{document}

带选项[h!]

在此处输入图片描述

相关内容