如何强制表格的标题以将其置于中心

如何强制表格的标题以将其置于中心

但是,为了做到这一点,我看到了下面的帖子:如何强制使表格标题居中?,我找不到设置表格标题的正确方法。我该如何强制执行此操作?

\documentclass[english,a4paper,12pt]{report}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\newcommand{\head}[1]{\textnormal{\textbf{#1}}}
\usepackage{graphicx}
\usepackage[showframe=false]{geometry}
\usepackage{changepage}
\usepackage[font=Large,labelfont=bf,justification=centering]{caption}
\begin{document}

asdasdasdad sadasdasdasdadasd asdasdasdasdafenm jejfnewjfnejfne nfjewnfwnfwfwqf
\begin{table}[htb]
\begin{adjustwidth}{-0.5cm}{}
\resizebox{0.6\textwidth}{!}{
\begin{minipage}{\textwidth}
\def\arraystretch{1.2}%
\begin{tabular}{ | c | c | c | c | c |  c |  c |  c | c |  c |  c |  }

\cline{2-11} 
\multicolumn{1}{c|}{} & \textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} &
\textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} & 
\textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} \\

\hline
  \textbf{LOC} & 5 & 5 & 6 & 5 & - & 5 & 6 & 5 & 6 & 5  \\
\hline
  \textbf{VS} & 8 & 5 & 9 & 8 & 9 & 8 & 9 & 8 & 9 & 8 \\
\hline

\end{tabular}
\caption{\label{fig:text}text experiment experiment experiment experiment}
\end{minipage} }

\end{adjustwidth}
\end{table}
\\
sdasdada asdasdas adasdasdasd
\end{document}

在此处输入图片描述

答案1

您的标题已调整为 ,0.6\textwidth因为它位于 内。minipage同样的事情也发生在tabular,但由于它太长,我们不会注意到。 将标题放在 之外,并在 选项中\resizebox使用。 您也可以通过 控制宽度。font=smallcaptionwidth=\textwidth

代码:

\documentclass[english,a4paper,12pt]{report}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\newcommand{\head}[1]{\textnormal{\textbf{#1}}}
\usepackage{graphicx}
\usepackage[showframe=false]{geometry}
\usepackage{changepage}
\usepackage[font=normalsize,labelfont=bf,justification=centering]{caption}
%%% use `font=normalsize`. can also use `width=\textwidth`
\begin{document}

asdasdasdad sadasdasdasdadasd asdasdasdasdafenm jejfnewjfnejfne nfjewnfwnfwfwqf
\begin{table}[htb]
\begin{adjustwidth}{-0.5cm}{}
\resizebox{0.6\textwidth}{!}{
\begin{minipage}{\linewidth}
\def\arraystretch{1.2}%
\begin{tabular}{ | c | c | c | c | c |  c |  c |  c | c |  c |  c |  }

\cline{2-11}
\multicolumn{1}{c|}{} & \textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} &
\textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} &
\textbf{Telestrada} & \textbf{Telestrada} & \textbf{Telestrada} \\

\hline
  \textbf{LOC} & 5 & 5 & 6 & 5 & - & 5 & 6 & 5 & 6 & 5  \\
\hline
  \textbf{VS} & 8 & 5 & 9 & 8 & 9 & 8 & 9 & 8 & 9 & 8 \\
\hline

\end{tabular}
\end{minipage} 
}
\end{adjustwidth}
%% put caption outside here
\caption{\label{fig:text}text experiment experiment experiment experiment experiment experiment experiment}
\end{table}

%% don't use a \\ here but leave an empty l;ine
sdasdada asdasdas adasdasdasd
\end{document}

在此处输入图片描述

相关内容