3

I'm trying to change bubcaption to the top but can't find a way using subfigure package. Can not add captio/ subcaption package because they crash with subfigure package, and I'm already half way through a very long document. That's what I type:

    \begin{figure}[h]
        \centering
        \subfigure{A}
        \includegraphics[scale=0.35]{kinase/grapmorpfirstadd}
        \label{subfigure:kinmorfirst}
        \hspace{1mm}
        \subfigure{B}
        \includegraphics[scale=0.35]{kinase/grapdamgofirstadd}
        \label{subfigure:kindamgofirst}

        \caption[Concentration response curve in the presence of 1$\mu$M PMA]{Concentration response curve in the presence of 1$\mu$M PMA (A) Morphine treatment  (B) DAMGO treatment}  
        \label{figure:kinfirstadd}
        \end{figure}

The A or B is in the bottom left, I want them on top left. enter image description here Thanks

  • Welcome to TeX.SX! Please help us to help you and complete your code to create a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Since you are explicitly dependent on particular packages, posting code without those is hardly going to make it easier for people to help you. – cfr Mar 09 '15 at 01:20
  • But do note that if you are using this it is considered obsolete.... – cfr Mar 09 '15 at 01:22
  • \documentclass[phd,titlesmallcaps, examinerscopy, copyrightpage]{mqthesis} – Marina J Santiago Mar 09 '15 at 02:27
  • It's a very long document with many parts to it.\ It does finish with \end{document} – Marina J Santiago Mar 09 '15 at 02:28
  • 1
    Please read the link I posted which explains how to construct an MWE. If my answer below does not solve the problem, we cannot do much if we do not have a compilable document we can use to reproduce. I don't have mqthesis.cls and I can only guess what might be in it. Follow the instructions to create an example we can compile here so that we can help you. – cfr Mar 09 '15 at 02:37
  • Also, use the edit to complete the code in your question - don't post it in comments. – cfr Mar 09 '15 at 02:38

2 Answers2

4

Do NOT use this code in new documents. subfigure is deprecated and ought not be used. Instead use subfig or subcaption.

You can use adjustbox to align things:

\usepackage{graphicx,subfigure,adjustbox}
\begin{document}
  \begin{figure}[h]
    \centering
    \mbox{}%
    \adjustbox{valign=T}{\subfigure{A}}
    \adjincludegraphics[valign=T,scale=0.35]{example-image-a}
    \label{subfigure:kinmorfirst}
    \hspace{1mm}
    \adjustbox{valign=T}{\subfigure{B}}
    \adjincludegraphics[valign=T,scale=0.35]{example-image-a}
    \label{subfigure:kindamgofirst}

    \caption[Concentration response curve in the presence of 1$\mu$M PMA]{Concentration response curve in the presence of 1$\mu$M PMA (A) Morphine treatment  (B) DAMGO treatment}
    \label{figure:kinfirstadd}
  \end{figure}
\end{document}

aligned things

cfr
  • 198,882
  • The problem is once I remove the package subfigure and add subfig I get hundred errors. Is that common? – Marina J Santiago Mar 09 '15 at 04:11
  • Yes, because the syntax to declare a sub figure is different. I would use subcaption. – MaxNoe Mar 09 '15 at 07:23
  • @MarinaJSantiago You don't need to remove subfigure to use my solution. I don't understand the problem. – cfr Mar 09 '15 at 12:59
  • @cfr You explicitly admonish visitors to not use the subfigure package, so that last comment doesn't make sense. Beyond that, it would also be good if you could actually supply a solution in line with the best-practices you recommend, i.e. using subfig instead of subfigure. – E.P. Aug 31 '16 at 18:42
  • @E.P. It makes perfect sense. It is perfectly sensible to say: look, I wouldn't use package X but, if you must, solution Y will work with package X. The reason for providing this solution was that the OP was already a long way into a long document and using subfigure. Without rewriting a lot of existing code, no better option is available. That's why I started with the warning not to use this in *new* documents. But the OP's document was not new. – cfr Aug 31 '16 at 20:56
  • @cfr The point was that telling people off for following your advice is not on the awesome side of life. In any case, your answer is one of the top google hits for the equivalent subfig query, and it could perfectly well address that case too, but unfortunately it doesn't. – E.P. Aug 31 '16 at 21:53
  • @E.P. I was not telling anybody off for anything. I simply stated the facts. And, as MaxNoe suggests, subcaption is really a better option than subfig for new documents. subfig is just easier to substitute for subfigure if updating old code. And there is already an answer here addressing the use of subcaption together with floatrow. There is no need for my answer to duplicate that effort. – cfr Aug 31 '16 at 23:39
2

Here's one option using the powerful floatrow package in combo with subcaption (subfig could have been an option too); since the labeling is dome automatically, you can easily cross-reference the subfigures:

\documentclass{article}
\usepackage{floatrow}
\usepackage{subcaption}
\usepackage{graphicx}

\renewcommand\thesubfigure{\Alph{subfigure}}

\begin{document}

Some references to Figure~\ref{fig:test} and its subfigures~\ref{sfig:testa} and~\ref{sfig:testb}.
\begin{figure}
\floatsetup[subfigure]{style=plain,heightadjust=object,
capbesideposition={left,top},capbesidesep=space}
\ffigbox[\FBwidth]
  {%
    \begin{subfloatrow}\useFCwidth
    \fcapside[\FBwidth]
      {\caption{}\label{sfig:testa}}
      {\includegraphics[width=4cm]{example-image-a}}
    \fcapside[\FBwidth]
      {\caption{}\label{sfig:testb}}
      {\includegraphics[width=4cm]{example-image-b}}
  \end{subfloatrow}%
  }
  {\caption{A figure with two subfigures}\label{fig:test}}
\end{figure}

\end{document}

enter image description here

I agree with cfr, you shouldn't use the obsolete subfigure package anymore.

Gonzalo Medina
  • 505,128