Graphics, Figures & Tablessubfig | Weird Captions

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Cosmio
Posts: 3
Joined: Tue Oct 11, 2011 10:09 pm

subfig | Weird Captions

Post by Cosmio »

My preamble:
\documentclass[12pt,a4paper,twoside]{article}
\pagestyle{headings}
\usepackage{graphicx}
\usepackage[version=3]{mhchem}
\usepackage[super,square,numbers,sort&compress]{natbib}
\usepackage{textcomp}
\usepackage{subfig}
\usepackage{soul}
\usepackage{multirow}
%\usepackage{palatino}
%\usepackage[T1]{fontenc}3
\usepackage[font=sf,margin=1cm]{caption}
\bibliographystyle{unsrt}
\newcommand{\degC}{\ensuremath{^\circ}C}

Using the subfig package in my document:
\begin{figure}
\centering
\subfloat[{Altanserine}]{\label{fig:altanserin}}\includegraphics[width=208 pt]{Altanserine.png}
\subfloat[Flumazenil]{\label{fig:flumazenil}}\includegraphics[width=120 pt]{flumazenil.png}
\caption{Structures of the radioligands.}
\label{fig:Structures}
\end{figure}

Produces weird captions! Anyone know why they break?

Also: Can I make the subfig include a picture without specifying size or having it stretched to fit the page width, thus having the picture be its actual size?
Attachments
Captions.png
Captions.png (8.72 KiB) Viewed 2946 times
Last edited by Cosmio on Thu Oct 13, 2011 7:57 pm, edited 1 time in total.

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

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

subfig | Weird Captions

Post by localghost »

The problem is quite easy to solve. You are just using the subfig syntax not correctly. And for more clarity you should format the source code a little bit different.

Code: Select all

\begin{figure}[!ht]
  \centering
  \subfloat[Altanserine\label{fig:altanserin}]{%
    \includegraphics[width=208pt]{Altanserine.png}
  }
  \subfloat[Flumazenil\label{fig:flumazenil}]]{%
    \includegraphics[width=120pt]{flumazenil.png}
  }
  \caption{Structures of the radioligands.}\label{fig:structures}
\end{figure}
Looking at the picture you attached I think that the excellent chemfig package could be interesting for you.

And next time please use the »Code« environment when posting code. This just improves the legibility of your post. Furthermore get used to providing always a minimal example which contains only the relevant code to reproduce the problem. Almost all packages that you load are irrelevant in this context.


Best regards and welcome to the board
Thorsten
Cosmio
Posts: 3
Joined: Tue Oct 11, 2011 10:09 pm

Re: subfig | Weird Captions

Post by Cosmio »

Thanks! That solved my first problem.

Sorry about not knowing of the code env. and apparently posting too much code. Isn't there a possibility of different packages interacting with eachother causing that kind of problems? That's why I posted the whole preamble.

I did look into chemfig, but it seems like a huge hassle when working with 20-22 molecules, all more intricate than the ones I showed.

No possibility of subfloat figures as their actual size?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

subfig | Weird Captions

Post by localghost »

Cosmio wrote:[…] I did look into chemfig, but it seems like a huge hassle when working with 20-22 molecules, all more intricate than the ones I showed. […]
According to my knowledge this is the most easy-to-use package at the moment. You should give it a try.
Cosmio wrote:[…] No possibility of subfloat figures as their actual size?
Oh, I must have overlooked this point. Scale the pictures to three quarters of their original size.

Code: Select all

\begin{figure}[!ht]
  \centering
  \subfloat[Altanserine\label{fig:altanserin}]{%
    \includegraphics[scale=0.75]{Altanserine.png}
  }
  \subfloat[Flumazenil\label{fig:flumazenil}]]{%
    \includegraphics[scale=0.75]{flumazenil.png}
  }
  \caption{Structures of the radioligands.}\label{fig:structures}
\end{figure}
The reason for that is the relation between postscript point (big point) and pixel.
Cosmio
Posts: 3
Joined: Tue Oct 11, 2011 10:09 pm

Re: subfig | Weird Captions

Post by Cosmio »

You have been most helpful.

Thank you very much.
Post Reply