Centralizando legendas sob figuras

Centralizando legendas sob figuras

Existe uma maneira de fazer isso? Todos os meus estão alinhados à esquerda; no entanto, quero-os centrados. Como isso é feito?

Também relacionado: como posso encorajar todas as minhas legendas?

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

Por favor, desculpe o preâmbulo, pois eu realmente não sei o que está relacionado a quê, só sei que eles foram coletados ao longo do tempo para poder escrever todo o meu documento para que todos sejam usados ​​em algum momento. Se você quiser, posso editá-los ...

Portanto, quero uma maneira de encorajar, centralizar e alterar o tamanho da fonte de todas as minhas legendas globalmente, e por centralizar quero dizer alinhar ao centro, para que não fiquem alinhados à esquerda.

Responder1

Não há necessidade de pacote extra; já que você está carregando caption, você pode usar seus recursos:

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

insira a descrição da imagem aqui

Responder2

Isso está mais próximo do que você está procurando? A primeira mesa é o que você tinha. O segundo é usar boxhandler. A largura da legenda, o tamanho da fonte da legenda e o negrito do texto normal na legenda foram alterados no preâmbulo e serão aplicados a todas as tabelas e figuras. A matemática em negrito na legenda não pode ser alterada globalmente nas legendas da tabela sem alterá-la também no restante do documento. Assim, \mathbffaz parte da legenda de cada figura usando matemática. Os parâmetros que usei são caption width= .5\textwidthe a legenda está em negrito em tamanho de script.

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

insira a descrição da imagem aqui

Responder3

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

informação relacionada