0

Why my subfigure references increase by 0.1 when I force my main caption to be at top of figure?

This is my my documentclass{tdiinpe.cls} link enter link description here

I want my all caption (figure and subfigure) to be at top of the figure.

enter image description here

\documentclass{tdiinpe} \usepackage[caption=false,position=top]{subfig} \usepackage[subfigure]{tocloft} \usepackage{float,graphicx} \begin{document} \begin{figure}[H] \centering \caption{My main caption (\ref{fig:foo}) with first \ref{fig:foo-1} subfigure and second \ref{fig:foo-2} subfigure.} \label{fig:foo} \subfloat[My first subfigure] { \includegraphics[scale=.4]{example-image-a} \label{fig:foo-1} } \subfloat[My second subfigure] { \includegraphics[scale=.4]{example-image-b} \label{fig:foo-2} } \end{figure} \end{document} 

Some of the contents of tdiinpe.cls

Caption setup

\renewcommand{\captionlabeldelim}{ -} \renewcommand{\captionfont}{\captionlabelfont\mdseries\captionsize} \renewcommand\@makecaption[2]{% \vskip\abovecaptionskip \captionlinewidth\hsize % \realcaptionwidth\hsize \def\captionlabel{#1}% \def\captiontext{#2}% \usecaptionstyle{\caption@style}% \vskip\belowcaptionskip \gdef\tamlabel{\captionlabelfont\captionsize#1\captionlabeldelim\captionfont\space} \gdef\tamtexto{\captionfont#2} } 

Some of packages used

\RequirePackage[hang,small]{caption2} \RequirePackage{amsmath,amssymb,amsthm} \RequirePackage[caption=false,position=top]{subfig} \RequirePackage[subfigure]{tocloft} 

Your code get me this refence when I consider my tdiinpe.cls

\documentclass{article} \usepackage[caption=false,position=top]{subfig} \usepackage[subfigure]{tocloft} \usepackage{float,graphicx} \begin{document} \begin{figure}[H] \centering \caption{My main caption (\ref{fig:foo}) with first \ref{fig:foo-1} subfigure and second \ref{fig:foo-2} subfigure.} \label{fig:foo} \subfloat[My first subfigure] { \includegraphics[scale=.4]{example-image-a} \label{fig:foo-1} } \subfloat[My second subfigure] { \includegraphics[scale=.4]{example-image-b} \label{fig:foo-2} } \end{figure} \end{document} 

enter image description here

9
  • 2
    Please provide a full but minimal example others can copy and test as is. Here we do not know your class or preamble, and we do not have your images, you can use \rule{5cm}{5cm} instead. Commented Aug 14 at 15:24
  • It might be that you need to use \subfloat[My first subfigure \label{fig:foo-1}]{...} as that is the caption part providing the number. Commented Aug 14 at 15:25
  • 1
    You cannot use \usepackage after \begin{document}. So I'm sure, you've not tested the shown code, which is still not a minimal working example (MWE). Commented Aug 14 at 15:45
  • I fixed your example this time, it should show 1a and 1b but shows 2a and 2b Commented Aug 14 at 16:10
  • why are you using an obsolete version of caption? don't use a class which loads obsolete code, especially with recent or current latex. where did you get tdiinpe.cls? it is not in tex live. Commented Aug 14 at 16:57

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.