図の下にキャプションを中央揃えにする

図の下にキャプションを中央揃えにする

これを実行する方法はありますか? 私のものはすべて左揃えですが、中央揃えにしたいです。どうすればいいですか?

関連:すべてのキャプションを太字にするにはどうすればいいですか?

\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

これはあなたが探しているものに近いでしょうか? 最初の表はあなたが持っていたものです。 2 番目は を使用していますboxhandler。キャプションの幅、キャプションのフォント サイズ、キャプション内の通常のテキストの太字はすべてプリアンブルで変更されており、すべての表と図に適用されます。キャプション内の太字の数式は、ドキュメントの残りの部分も変更せずに、表のキャプション内でグローバルに変更することはできません。したがって、 は\mathbf数式を使用する各図のキャプションの一部です。使用したパラメーターは、キャプションの幅 = で.5\textwidth、キャプションはスクリプト サイズの太字です。

\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}

関連情報