1

I have

\documentclass[12pt]{article}
\usepackage[left=10mm, top=20mm, right=10mm, bottom=20mm]{geometry}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage[font=scriptsize]{caption}
\captionsetup{width=0.8\textwidth}
\begin{document}

\begin{figure}[h!]
\centering
\subfloat[xxx]{\includegraphics[width=0.25\textwidth]{1.jpg}}
\qquad
\subfloat[yyy]{\includegraphics[width=0.25\textwidth]{1.jpg}}
\qquad
\subfloat[zzz]{\includegraphics[width=0.25\textwidth]{1.jpg}}
\caption{.}
\label{appendix}
\end{figure}
\end{document}

and obtain enter image description here

Could you help me, what can I do with this horizontal shift for (a) xxx, (b) yyy, (c) zzz?

UPD: Such example

\documentclass[12pt]{article}
\usepackage[left=10mm, top=20mm, right=10mm, bottom=20mm]{geometry}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage[font=scriptsize]{caption}
%\captionsetup{width=0.8\textwidth}

\begin{document}
\title{title}
\author{authors}
\date{}
\maketitle
\abstract{abstract}
\section{Introduction}
just main text just main text just main text just main text just main text just main text just main text just main text just main text just main text just main text
\begin{figure}[h!]
\centering
\subfloat[]{\includegraphics[width=0.25\textwidth]{1.jpg}}
\qquad
\subfloat[]{\includegraphics[width=0.25\textwidth]{1.jpg}}
\qquad
\subfloat[]{\includegraphics[width=0.25\textwidth]{1.jpg}}
\caption{just a caption just a caption just a caption just a caption just a caption just a caption just a caption just a caption just a caption just a caption just a caption just a caption}
\label{appendix}
\end{figure}
\end{document}

Result enter image description here

It seems it caused by the width of the title.

3
  • 1
    Welcome to TeX:SE! Why you need \captionsetup{width=0.8\textwidth}? If you remove it, subcaptions are on correct place, below belonging images.
    – Zarko
    Commented Feb 14, 2021 at 23:35
  • Because in this case the width of figure captions is more than the width of the main text. Commented Feb 15, 2021 at 14:00
  • @No, that is not a case. Caption text is newer wider that text width. Provide an example where this is the case.
    – Zarko
    Commented Feb 15, 2021 at 14:14

1 Answer 1

0

As I said in my comment, caption text cannot be wider than \textwidth. Cause of your problem is command command \abstract{abstract} which shrink followed text to width of abstract text.

Correct MWE for your case is:

\documentclass[12pt]{article}
\usepackage[hmargin=10mm, vmargin=20mm]{geometry}
\usepackage[demo]{graphicx}
\usepackage{subfig}
\usepackage[font=scriptsize]{caption}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum} % for generating dummy text

\begin{document}
\title{title}
\author{authors}
\date{}
\maketitle

\begin{abstract} % <--- correct syntax
\lipsum[66]
\end{abstract}   % <---

\section{Introduction}
\lipsum[11]
    \begin{figure}[ht]
    \centering
\subfloat[]{\includegraphics[width=0.25\textwidth]{1.jpg}}
\qquad
\subfloat[]{\includegraphics[width=0.25\textwidth]{1.jpg}}
\qquad
\subfloat[]{\includegraphics[width=0.25\textwidth]{1.jpg}}
\caption{just a caption just a caption just a caption just a caption just a caption just a caption just a caption just a caption just a caption just a caption just a caption just a caption}
\label{appendix}
    \end{figure}
\end{document}

which gives expected result:

enter image description here

(red lines shows page layout).

As you can see, the width caption text is equal to width of text. Also subcaptions are on the right place. Is this what you after?

2
  • Yes, that is perfect, thank you so much for the correct syntax for abstract! I have already understood what problem was. Commented Feb 15, 2021 at 21:13
  • @xolms, you are welcome! Happy TeXing!
    – Zarko
    Commented Feb 15, 2021 at 21:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .