Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

subfigure caption centering

7,263 views
Skip to first unread message

laks...@gmail.com

unread,
Jun 21, 2007, 1:42:02 PM6/21/07
to
How do I center the subfigure captions? I tried using several commands
like -
\centering - doesn't center
\captionsetup{justification=centering} - centers the global caption
but doesn't center the subfigure captions
\centerfigcaptionstrue - returns an error on compilation

Here is my code -

\\begin{figure}
\begin{center}
\captionsetup{justification=centering}
\subfigure[] {\label{fig:i-page}}\includegraphics[width=70mm]{path/
i_page.png}
\subfigure[] {\label{fig:o-page}}\includegraphics[width=70mm]{path/
o_page.png}
\caption{Figure title.}
\label{fig:data-pages}
\end{center}
\end{figure}

I do not use subfigure captions, just the numbers (a) and (b), which
are left justified if I use the above code.

Thanks
ldr

Werner

unread,
Jun 21, 2007, 2:01:56 PM6/21/07
to

Are you using the subfigure or subfig pacakge? And what about the
caption package to manipulate your caption material?

Werner

laks...@gmail.com

unread,
Jun 21, 2007, 2:21:09 PM6/21/07
to
I'm using the subfigure package and also the captions package.

Enrico Gregorio

unread,
Jun 21, 2007, 3:10:09 PM6/21/07
to
<laks...@gmail.com> wrote:

> I'm using the subfigure package and also the captions package.

subfigure has been declared obsolete by its author, who has released
its successor, subfig. This one cooperates well with caption.

Ciao
Enrico

laks...@gmail.com

unread,
Jun 21, 2007, 3:55:38 PM6/21/07
to
I tried using the subfig package too. It gives me several compilation
errors.

First I'm not able to generate a proper subfig.sty file from the
version 1.2 downloaded from http://www.cs.cmu.edu/afs/cs/usr/sdc/www/latex/subfig.html.
Secondly, if I use the code provided in http://www.cs.cmu.edu/~sdc/latex/subfig.12/subfig.sty,
on compilation it returns several errors like-
-Missing $ inserted.
-Extra }, or forgotten $

My code to generate subfigures using the subfig package is -

\begin{figure}
\begin{center}
\subfloat[] {path/ i_page.png}
\subfloat[] {path/ o_page.png}

Enrico Gregorio

unread,
Jun 21, 2007, 4:34:36 PM6/21/07
to
<laks...@gmail.com> wrote:

You should say

\subfloat[]{\includegraphics{path/i_page.png}}

A subfloat can contain anything, no \includegraphics is implied.
Also, change \begin{center} into \centering and delete \end{center}.

Ciao
Enrico

laks...@gmail.com

unread,
Jun 21, 2007, 4:53:25 PM6/21/07
to
I corrected the subfloat command. However, it gives me several errors
in the subfig.sty file. I use the one from http://www.cs.cmu.edu/~sdc/latex/subfig.12/subfig.sty.

I replaced with \centering as well. Doesn't work.

Please help.

Lars Madsen

unread,
Jun 21, 2007, 5:07:32 PM6/21/07
to

always get your packages from CTAN, the subfig I got in my TeX Live is
from 2005, the URL you gave is from 2003.

what do you mean \centering doesn't work? minimal example please

--

/daleif (remove RTFSIGNATURE from email address)

LaTeX FAQ: http://www.tex.ac.uk/faq
LaTeX book: http://www.imf.au.dk/system/latex/bog/ (in Danish)
Remember to post minimal examples, see URL below
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl

Axel Sommerfeldt

unread,
Jun 21, 2007, 5:15:54 PM6/21/07
to
laks...@gmail.com wrote:

> I corrected the subfloat command. However, it gives me several errors
> in the subfig.sty file.

In many cases replacing \usepackage{subfigure} with \usepackage{subfig} and
replacing \subfigure with \subfloat (or simply saying \let\subfigure
\subfloat after loading the subfig package) is sufficient.

So if you have a TeX document which compiles using the subfigure package,
it should not be so difficult to migrate this document to subfig.

It's outdated, version 1.3 on CTAN is the actual one.

And please visit http://www.minimalbeispiel.de/mini-en.html

HTH,
Axel

laks...@gmail.com

unread,
Jun 21, 2007, 6:10:58 PM6/21/07
to
If I do as you say "In many cases replacing \usepackage{subfigure}

with \usepackage{subfig} and
replacing \subfigure with \subfloat (or simply saying \let\subfigure
\subfloat after loading the subfig package) is sufficient. "

I get an error : No counter 'subfigure@save defined.

My code is --
\begin{figure}
\centering
\subfloat[] {\includegraphics[width=70mm]{path/ i_page.png}}
\subfloat[] {\includegraphics[width=70mm]{path/ o_page.png}}


\caption{Figure title.}
\label{fig:data-pages}

\end{figure}


Enrico Gregorio

unread,
Jun 21, 2007, 6:39:33 PM6/21/07
to
<laks...@gmail.com> wrote:

Again, this is /not/ a minimal example. And there must be
/no/ space after the slash. Your code, with

\documentclass{article}
\usepackage{graphicx,subfig,caption}
\begin{document}

at the beginning and \end{document} at the end, compiles perfectly on
my computer (erasing the space, of course). Therefore, try

\documentclass{article}
\usepackage{graphicx,subfig,caption}
\listfiles
\begin{document}
\begin{figure}
\centering
\subfloat[] {\includegraphics[width=70mm]{i_page.png}}
\subfloat[] {\includegraphics[width=70mm]{o_page.png}}


\caption{Figure title.}
\label{fig:data-pages}
\end{figure}

\end{document}

It's best to avoid the complicated path, place a copy of the
pictures in the directory where you are working with this example.
I've added also a \listfiles command, which should inform you about
the version number of the various packages you are loading.

Ciao
Enrico

laks...@gmail.com

unread,
Jun 21, 2007, 8:29:19 PM6/21/07
to
Thanks everyone. It seems to be working now.

Axel Sommerfeldt

unread,
Jun 22, 2007, 12:24:48 AM6/22/07
to
laks...@gmail.com wrote:

> I get an error : No counter 'subfigure@save defined.

You get this error when you try to use both, the subfigure *and* the subfig
package. This is not possible, please decide which one do you actually want
to use.

HTH,
Axel

Ulrich M. Schwarz

unread,
Jun 21, 2007, 4:14:05 PM6/21/07
to
laks...@gmail.com writes:

> I tried using the subfig package too. It gives me several compilation
> errors.
>
> First I'm not able to generate a proper subfig.sty file from the
> version 1.2 downloaded from http://www.cs.cmu.edu/afs/cs/usr/sdc/www/latex/subfig.html.
> Secondly, if I use the code provided in http://www.cs.cmu.edu/~sdc/latex/subfig.12/subfig.sty,
> on compilation it returns several errors like-
> -Missing $ inserted.
> -Extra }, or forgotten $
>
> My code to generate subfigures using the subfig package is -
>
> \begin{figure}
> \begin{center}

You want \centering here instead (which does not insert extra vertical space).

> \subfloat[] {path/ i_page.png}

Well, yes, a _ in text mode will probably trigger math mode
complaints. The mandatory argument is not assumed to be a picture
filename, since you might want to have picture/pstricks/emp/tikz ...
environments there. Check if using \includegraphics{path/i_page.png} works.

HTH
Ulrich
--
"There was an argument on the Caml list over the merits of where,
a.k.a backwards let. I am now completely opposed to it after seeing
that. I think the code would be more readable in FORTH."
-- Jed Davis, on my implementation of dependency sorting

ziz...@gmail.com

unread,
Mar 25, 2016, 4:18:15 AM3/25/16
to
In case some one is still having this problem. Using the subcaption package also created this. so delete it

Marcos Alves Vieira

unread,
Oct 3, 2023, 3:46:22 PM10/3/23
to
Em sexta-feira, 25 de março de 2016 às 05:18:15 UTC-3, ziz...@gmail.com escreveu:
> In case some one is still having this problem. Using the subcaption package also created this. so delete it

Thank you man! subcaption package was triggering the error here.
0 new messages