
Я вставляю картинку в свой документ. По умолчанию выравнивание подписи (рис. 3) по центру, а перед подписью стоит двоеточие.
Как можно выровнять метку по левому краю и изменить Fig. 3:
формат Fig. 3
?
Мой код:
\setcounter{figure}{2}
\begin{figure}
\centering
\includegraphics[width=1\linewidth]{75_02-45.jpeg}\caption{}
\label{fig}
\end{figure}
решение1
Это нормально?
\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}
Выход:
решение2
С
\captionsetup[figure]{
justification=raggedright,
singlelinecheck=false, % <<< raggadright also when the caption is shorterthan a single line
name={Fig.}
}
Полный код
\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}