Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have little icons (48x48) and I want to display them using subfloat. To prevent that images from being pixelated I set the width to 1cm. But now the caption has also a length of 1cm and looks terrible. Here is my code:

\documentclass[12pt,a4paper]{scrartcl}
\usepackage{graphicx}
\usepackage{subfloat}
\usepackage{subfig}
\begin{document}
    \begin{figure}[!htb]
    \centering
    \subfloat[Logo]{\includegraphics[width=1cm]{Bilder/icons/logo.png}}
    \hspace{1pt}               
    \caption{Graphiken der Anwendung}
    \label{fig:icons}
    \end{figure}
\end{document}

Is there a way to make the caption longer than the 1cm image?

share|improve this question
1  
It would be good if you could turn the code sample into a full, compilable document (i.e. starting from \documentclass). That will make it easier for people to try out the code. –  Jake Jun 20 '11 at 10:49
    
Why are you using \hspace{1pt}? –  Martin Scharrer Jun 20 '11 at 10:49
    
After a short look in the subfig manual (I assume you are using this package), I found a reference to: \captionsetup[subfigure]{width=<some length>}. Give it a try. Another possibility for short captions would be to use \mbox{Logo} to avoid a line break. However, this only allows for single line sub-captions and might cause other issues. –  Martin Scharrer Jun 20 '11 at 10:56
    
changed the code, \hspace is for the next row of images, I'll try the \mbox –  dbrettschneider Jun 20 '11 at 11:02
add comment

1 Answer 1

up vote 7 down vote accepted

You could just increase the official width of the subfloat by putting the image in a larger but invisible box:

\begin{figure}
    \centering
    \subfloat[Logo]{\makebox[5cm][c]{\includegraphics[width=1cm]{Bilder/icons/logo.png}}}
    \caption{Graphiken der Anwendung}
    \label{fig:icons}
\end{figure}
share|improve this answer
    
thanks, that works –  dbrettschneider Jun 20 '11 at 11:04
3  
It's possible also to say \makebox[1.2\width]{...} that will enlarge the box by the 20%. –  egreg Jun 20 '11 at 11:08
1  
Or \makebox[\dimexpr\width+2cm\relax]{...} to increase the width by e.g. 2cm. –  Martin Scharrer Jun 20 '11 at 11:28
add comment

Your Answer

 
discard

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.