Graphics, Figures & Tablessubcaption | Labels of Sub-floats on left Side

Information and discussion about graphics, figures & tables in LaTeX documents.
dcernst
Posts: 19
Joined: Sun Aug 29, 2010 9:50 pm

subcaption | Labels of Sub-floats on left Side

Post by dcernst »

I'm looking for a way to put the labels for subfloats in a figure environment on the left while the label and caption for the figure stay on the bottom. I want to do this for a few figures and not globally for all of them. Also, in these cases, the caption for the floats is empty. Here is my setup in a minimal example:

Code: Select all

\documentclass[11pt]{amsart}

\usepackage{graphicx}
\usepackage{caption}
\usepackage[labelformat=simple,labelfont={}]{subcaption}

\begin{document}
yada yada, check out my cool figure.

\begin{figure}[!ht]
\centering
\subfloat[\label{Fig135}]{\includegraphics[scale=.95]{Fig135}}
\subfloat[\label{Fig136}]{\includegraphics[scale=.95]{Fig136}}
\caption{Cool figures}\label{Fig135--Fig136}
\end{figure}

That's all for now...

\end{document}
I'm hoping to get the labels (a) and (b) to appear on the left and centered vertically. It may be worth noting that in each of the cases that I want to do this, the images in the subfloats are too wide to sit side by side. Thanksl
Last edited by dcernst on Thu Aug 11, 2011 10:21 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

subcaption | Labels of Sub-floats on left Side

Post by localghost »

I suggest to take a look at Section 6 of the floatrow manual. It discusses possible setups in conjunction with the caption package. Perhaps you can find something useful for you. In case of upcoming problems, feel free to ask further questions.


Thorsten
dcernst
Posts: 19
Joined: Sun Aug 29, 2010 9:50 pm

Re: subcaption | Labels of Sub-floats on left Side

Post by dcernst »

I'm attempting to sort things out with the floatrow package, but not having much luck. I can't get even a simple example to compile. All the examples in the documentation are filled with ... and it isn't clear to me where to put the various components. In particular, where does \includegraphics{} go? Also, it isn't clear to me how to implement the types of changes that I want to make locally as opposed to globally. Any further input would be greatly appreciated.
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

subcaption | Labels of Sub-floats on left Side

Post by sommerfee »

If you don't want to use the floatrow package, you can build the requested layout by hand, i.e. using \parbox'es or minipages. For example:

Code: Select all

\documentclass[11pt]{amsart}

\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage[labelformat=simple,labelfont={}]{subcaption}

\begin{document}
yada yada, check out my cool figure.

\begin{figure}[!ht]
\centering
\begin{subfigure}[b]{0.45\textwidth}
\caption{}\label{Fig135}
\end{subfigure}
\begin{minipage}[b]{0.45\textwidth}
\includegraphics[scale=.95]{Fig135}
\end{minipage}
\\[1ex]
\begin{subfigure}[b]{0.45\textwidth}
\caption{}\label{Fig136}
\end{subfigure}
\begin{minipage}[b]{0.45\textwidth}
\includegraphics[scale=.95]{Fig136}
\end{minipage}
\caption{Cool figures}\label{Fig135--Fig136}
\end{figure}

That's all for now...

\end{document}
(Please note that I have added the "demo" option to the graphicx package since I don't have your picture files.)
dcernst
Posts: 19
Joined: Sun Aug 29, 2010 9:50 pm

Re: subcaption | Labels of Sub-floats on left Side

Post by dcernst »

I notice that you replaced \subfloat with \subfigure and in another recent post of yours, you said to use \subcaptionbox instead of \subfloat. What's the difference between \subfigure and \subcaptionbox here? Thanks! (I'll close the topic once I've verified that this works for me.)
dcernst
Posts: 19
Joined: Sun Aug 29, 2010 9:50 pm

subcaption | Labels of Sub-floats on left Side

Post by dcernst »

OK, I'm getting closer, but I'm not there yet. Even with messing around with the width of the minipage and subfigure, I can't get things to look right. Here is my most recent attempt using \subcaptionbox:

Code: Select all

\documentclass[11pt]{amsart}

\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage[labelformat=simple,labelfont={}]{subcaption}

\begin{document}
yada yada, check out my cool figure.

\begin{figure}[!ht]
\centering
\subcaptionbox{\label{Fig135}}{}
\begin{minipage}[c]{.6\textwidth}
\includegraphics[scale=.95]{Fig135}
\end{minipage}
\\[1ex]
\subcaptionbox{\label{Fig136}}{}
\begin{minipage}[c]{0.6\textwidth}
\includegraphics[scale=.95]{Fig136}
\end{minipage}
\caption{Cool figures}\label{Fig135--Fig136}
\end{figure}

That's all for now...

\end{document}
However, in this case, the subfigure labels overlap the left end of the image. Also, the label isn't quite centered vertically.
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

subcaption | Labels of Sub-floats on left Side

Post by sommerfee »

dcernst wrote:I notice that you replaced \subfloat with \subfigure and in another recent post of yours, you said to use \subcaptionbox instead of \subfloat. What's the difference between \subfigure and \subcaptionbox here?
The subcaption package offers \subcaption, \subcaptionbox, and the subfigure resp. subtable environment. For an explanation of them please take a look at the subcaption package documentation.
OK, I'm getting closer, but I'm not there yet.
What is not working or wrong with the version I have posted?
\subcaptionbox{\label{Fig135}}{}
This does not work because a \subcaptionbox will have the width of its contents (at least by default). So the above box will have a width of 0pt.

So if you want to typeset a sub-caption without context, better use \subcaption or the subfigure environment instead.
Last edited by sommerfee on Fri Aug 12, 2011 10:08 am, edited 1 time in total.
dcernst
Posts: 19
Joined: Sun Aug 29, 2010 9:50 pm

Re: subcaption | Labels of Sub-floats on left Side

Post by dcernst »

I've attached the output for your code using my figures. As you can see, the horizontal spacing is off and despite playing around with various values, I couldn't get it to look right. Also, I'm hoping to have the label centered vertically.
Attachments
test.pdf
(14.55 KiB) Downloaded 418 times
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

subcaption | Labels of Sub-floats on left Side

Post by sommerfee »

dcernst wrote:As you can see, the horizontal spacing is off
This is controlled by the widths of the minipages. Since I don't have your graphic files I was not able to give them proper values. (I have changed them a bit now.)
Also, I'm hoping to have the label centered vertically.
This can be done by changing the minipage alignment option from "b" to "c", e.g.:

Code: Select all

\documentclass[11pt]{amsart}

\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage[labelformat=simple,labelfont={}]{subcaption}

\begin{document}
yada yada, check out my cool figure.

\begin{figure}[!ht]
\centering
\begin{subfigure}[c]{0.1\textwidth}
\caption{}\label{Fig135}
\end{subfigure}%
\begin{minipage}[c]{0.9\textwidth}
\includegraphics[width=\linewidth]{Fig135}
\end{minipage}
\\[1ex]
\begin{subfigure}[c]{0.1\textwidth}
\caption{}\label{Fig136}
\end{subfigure}%
\begin{minipage}[c]{0.9\textwidth}
\includegraphics[width=\linewidth]{Fig136}
\end{minipage}
\caption{Cool figures}\label{Fig135--Fig136}
\end{figure}

That's all for now...

\end{document}
Last edited by sommerfee on Fri Aug 12, 2011 8:53 am, edited 3 times in total.
dcernst
Posts: 19
Joined: Sun Aug 29, 2010 9:50 pm

Re: subcaption | Labels of Sub-floats on left Side

Post by dcernst »

Yes, this looks much better. Is there a way to determine the exact width of an eps file? That way I could figure out how wide to make the minipages. Then I think I can nail this down. Thanks (again) for all the help.
Post Reply