Como posso alterar o formato da legenda de uma imagem?

Como posso alterar o formato da legenda de uma imagem?

Eu colo uma imagem no meu documento. Por padrão, o alinhamento da legenda (Fig. 3) é centralizado e há dois pontos antes da legenda.

Como posso alinhar o rótulo à esquerda e alterar o formato a partir de Fig. 3:agora Fig. 3?

Meu código:

\setcounter{figure}{2}
\begin{figure}
    \centering
    \includegraphics[width=1\linewidth]{75_02-45.jpeg}\caption{}
    \label{fig}
\end{figure}

Responder1

Tudo bem?


\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}

\makeatletter
\renewcommand{\fnum@figure}{Fig. \thefigure} % Changing the prefix to 'Fig.'
\makeatother

\begin{document}
Example:

\setcounter{figure}{2}
\begin{figure}[ht]
    \centering
    \includegraphics[width=0.5\linewidth]{frog.jpg}
    \captionsetup{justification=raggedright,singlelinecheck=false} % Left align the label
    \caption{} 
    \label{fig}
\end{figure}

\end{document}

Saída:

insira a descrição da imagem aqui

Responder2

Com

\captionsetup[figure]{
  justification=raggedright,
  singlelinecheck=false, % <<< raggadright also when the caption is shorterthan a single line
  name={Fig.}
  }

O código completo

\documentclass{article}
\usepackage{showframe}% comment in the final document
\usepackage{graphicx}
\usepackage{caption}
\captionsetup[figure]{
  justification=raggedright,
  singlelinecheck=false, % <<< raggadright also when the caption is shorterthan a single line
  name={Fig.}
  }

\begin{document}
%\noindent
Example:

\setcounter{figure}{2}
\begin{figure}[ht]
    \centering
    \includegraphics[width=0.5\linewidth]{example-image-duck}
    \caption{} 
    \label{fig}
\end{figure}

\end{document}

insira a descrição da imagem aqui

informação relacionada