將標題置於數字下方居中

將標題置於數字下方居中

有沒有辦法做到這一點?我的所有都是左對齊的;但是,我希望它們居中。它是如何完成的?

另請參閱:如何增強所有字幕的效果?

\documentclass[a4paper,12pt,fleqn,titlepage]{report}
\usepackage[margin=2.0cm]{geometry}                % See geometry.pdf to learn the layout options. There are lots.
\geometry{letterpaper}                   % ... or a4paper or a5paper or ... 
%\geometry{landscape}                % Activate for for rotated page geometry
\usepackage[parfill]{parskip}    % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx}
\usepackage{ulem}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{epstopdf}
\usepackage{longtable}
\usepackage{color}
\usepackage{subfigure}
\usepackage{wrapfig}
\usepackage{pdfpages}
\usepackage{makecell}
\usepackage{caption}
\usepackage{titlesec}
\newcommand{\sectionbreak}{\clearpage}
\titleformat{\chapter}[display]
  {\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}{0pt}{-30pt}{12pt}
\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}
\renewcommand{\thefootnote}{\arabic{footnote}}
\usepackage[perpage,bottom]{footmisc}

\begin{document}

\begin{table}[h!]
\centering
\captionsetup{width=13cm}
\caption{Load of stuff above the table which is wider than the table, can use width to limit that as above but want it centralised, also might be numbers in here which means when I want to embolden the entire caption from the preamle so that it does it for all figures in my document that the numbers like this $n=1,2,3,4,5,6$ and $7$ will embolden too. If I put this in at the moment it looks like my actual text and so there is lttle way to discern between the two.}
\vspace{0.3cm}
\begin{tabular}{| l | l | l |}
\hline
Thing1 & Thing2 & Thing3 \\ \hline
blah1 & blah2 & blah3 \\ \hline
\end{tabular}
\label{table:stuff}
\end{table}

\end{document}

請原諒序言,因為我真的不知道什麼與什麼相關,我只知道這些是隨著時間的推移而收集的,以便能夠編寫我的整個文檔,因此所有內容都會在某個時候使用。我你想要我可以編輯它們......

因此,我想要一種方法來在全球範圍內增強、集中和更改所有字幕的字體大小,集中是指居中對齊,因此它們不會左對齊。

答案1

無需額外包裝;由於您正在加載caption,您可以使用它的功能:

\documentclass[a4paper,12pt,fleqn,titlepage]{report}
\usepackage{caption}

\captionsetup{width=.75\textwidth,font={bf,scriptsize},skip=0.3cm,within=none}


\begin{document}

\chapter{Test}
\begin{table}
\centering
\caption{Load of stuff above the table which is wider than the table, can use width to limit that as above but want it centralised, also might be numbers in here which means when I want to embolden the entire caption from the preamle so that it does it for all figures in my document that the numbers like this $n=1,2,3,4,5,6$ and $7$ will embolden too. If I put this in at the moment it looks like my actual text and so there is lttle way to discern between the two.}
\begin{tabular}{| l | l | l |}
\hline
Thing1 & Thing2 & Thing3 \\ \hline
blah1 & blah2 & blah3 \\ \hline
\end{tabular}
\label{table:stuff}
\end{table}

\end{document}

在此輸入影像描述

答案2

這更接近您正在尋找的東西嗎?第一張桌子就是你所擁有的。第二個是使用boxhandler.標題寬度、標題字體大小以及標題中普通文字的粗體都已在序言中進行了更改,並將適用於所有表格和圖形。標題中的粗體數學不能在表格標題中全域更改,而不在文件的其餘部分中進行更改。因此,\mathbf每個圖形標題的一部分都使用數學。我使用的參數是標題寬度= .5\textwidth,標題以 scriptsize 粗體顯示。

\documentclass[a4paper,12pt,fleqn,titlepage]{report}
\usepackage[margin=2.0cm]{geometry}                % See geometry.pdf to learn the layout options. There are lots.
\geometry{letterpaper}                   % ... or a4paper or a5paper or ... 
%\geometry{landscape}                % Activate for for rotated page geometry
\usepackage[parfill]{parskip}    % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx}
\usepackage{ulem}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{epstopdf}
\usepackage{longtable}
\usepackage{color}
\usepackage{subfigure}
\usepackage{wrapfig}
\usepackage{pdfpages}
\usepackage{makecell}
\usepackage{caption}
\usepackage{titlesec}
%
\usepackage{boxhandler}
\captionStyle{n}{c}
\constrainCaptionWidth{.5\textwidth}
\def\CaptionFontSize{\scriptsize\bfseries}
%
\newcommand{\sectionbreak}{\clearpage}
\titleformat{\chapter}[display]
  {\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}{0pt}{-30pt}{12pt}
\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}
\renewcommand{\thefootnote}{\arabic{footnote}}
\usepackage[perpage,bottom]{footmisc}

\begin{document}

\begin{table}[h!]
\centering
\captionsetup{width=13cm}
\caption{Load of stuff above the table which is wider than the table, can use width to limit that as above but want it centralised, also might be numbers in here which means when I want to embolden the entire caption from the preamle so that it does it for all figures in my document that the numbers like this $n=1,2,3,4,5,6$ and $7$ will embolden too. If I put this in at the moment it looks like my actual text and so there is lttle way to discern between the two.}
\vspace{0.3cm}
\begin{tabular}{| l | l | l |}
\hline
Thing1 & Thing2 & Thing3 \\ \hline
blah1 & blah2 & blah3 \\ \hline
\end{tabular}
\label{table:stuff}
\end{table}

\bxtable[ht]
{Load of stuff above the table which is wider than the table,
can use width to limit that as above but want it centralised, also might
be numbers in here which means when I want to embolden the entire
caption from the preamle so that it does it for all figures in my
document that the numbers like this $\mathbf{n=1,2,3,4,5,6}$ and
$\mathbf{7}$ will
embolden too. If I put this in at the moment it looks like my actual
text and so there is lttle way to discern between the two}
{
\begin{tabular}{| l | l | l |}
\hline
Thing1 & Thing2 & Thing3 \\ \hline
blah1 & blah2 & blah3 \\ \hline
\end{tabular}
}

\end{document}

在此輸入影像描述

答案3

使用\makebox[\textwidth]{}

\begin{table}[h!]
\centering
\makebox[\textwidth]{
\captionsetup{width=13cm}
\caption{Load of stuff above the table which is wider than the table, can use width to limit that as above but want it centralised, also might be numbers in here which means when I want to embolden the entire caption from the preamle so that it does it for all figures in my document that the numbers like this $n=1,2,3,4,5,6$ and $7$ will embolden too. If I put this in at the moment it looks like my actual text and so there is lttle way to discern between the two.}
\vspace{0.3cm}
\begin{tabular}{| l | l | l |}
\hline
Thing1 & Thing2 & Thing3 \\ \hline
blah1 & blah2 & blah3 \\ \hline
\end{tabular}}
\label{table:stuff}
\end{table}

相關內容