TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My Problem: I would like to have all images in my Latex document beeing well sized in height and width. Precisly I want, that protrait and landscape images get a predefined size in the document. I got this by this style:

    \ifthenelse{\lengthtest{\widthW > \heightH}}{

The second thing is, I want to use this in a \subfigure because I have a lot of images which have to be side by side.

The problem is, everything works great, but as soon as I try to centering this images I got:

! LaTeX Error: Something's wrong--perhaps a missing \item.

Thats my code:

\subfigure[comment]{\includegraphicsJustified{images/img1.png}  }
\subfigure[comment]{\includegraphicsJustified{images/img2.png}  }
\caption{whole comment}

Note again: without the \centering command it works.

I tried to add this to my style, to automaticly center all figure elements:

\def\figure{\@ifnextchar[\figure@i \figure@ii}

This works great, but not when I use the \subfigure:

! LaTeX Error: Something's wrong--perhaps a missing \item.

Without the \subfigure I can use my \includegraphicsJustified{} command and it get centered. Note also: When I use the subfigure with a normal \includegraphics{} it works!

Is there anybody out there who could explain this or much better can distribute a solution?

share|improve this question

migrated from stackoverflow.com Oct 2 '12 at 6:04

This question came from our site for professional and enthusiast programmers.

What package are you using that supports \subfigure, subfigure? This has been replaced by subfig that provides \subfloat. – Werner Oct 1 '12 at 3:29
Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Werner Oct 2 '12 at 6:10

Try putting the subfigure inside a minipage, see below,

\subfigure[comment]{\includegraphicsJustified{images/img1.png} }
\subfigure[comment]{\includegraphicsJustified{images/img2.png} }
\caption{whole comment}

I firmly believe that you can carry out the rest of the fine tuning.

For further details, please see http://www.tex.ac.uk/cgi-bin/texfaq2html?label=errmissitem.

Hope this helps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.