3

In LaTeX, everything works fine with subfigure package, only one trouble is coming; The subcaptions are placed a little towards left from the centre of two figures side by side, which doesnt loook good,,, I have tried everything using nooneline, hang , centrelast etc. but no desired result is coming . Kindly suggest me how could i move either the captions towards centre of figures or the figures such that subcaptions comes in centre.

Marco Daniel
  • 95,681

2 Answers2

3

This seems to work just fine for me:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{subfloat}
\usepackage{subcaption}
\usepackage{caption}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure}
    \begin{subfigure}[b]{.5\linewidth}
        \centering
            \includegraphics[scale=1]{demo}
            \caption{Skeletal}
        \label{fig:SkeletalTissue}
    \end{subfigure}
    \begin{subfigure}[b]{.5\linewidth}
        \centering
            \includegraphics[scale=1]{demo}
            \caption{Cardiac}
        \label{fig:CardiacTissue}
    \end{subfigure}
    \caption{Types of Muscular Tissue}
    \label{fig:MuscularTissue}
\end{figure}
\end{document}

This is the result. Is this what you were looking for?enter image description here

Mario S. E.
  • 18,609
  • I copied ur script and added my figure file in it. But i still got the same result. I have added link of the result i have recieved..... http://tinypic.com/r/2v1wvo1/5 – user2467143 Jun 09 '13 at 16:20
  • 1
    Dear @user2467143, your captions are centered, but are centered to the whole figure. This means the part of the axis where "amplitude m/s^2" is written is also part of the graphic. For tweaking your captions you can add \hspace*{5mm}\caption{Your caption}. 5mm have been selected arbitrary, but you can choose as much space as you see fit. – Mario S. E. Jun 09 '13 at 16:53
0

I have had the same problem with my master thesis and think I found a solution! The problem is that you have too much white "waste" around the figure. You can adjust the position of the image by for instance using \hline{-10pt}.

You need to use packages graphicx, float, and subcaption

Here is one example where four subfigures are located in 2x2, and the v-space is for obtaining some vertical "air" between the figures:

\documentclass[pdftex,10pt,b5paper,twoside]{book}
\usepackage{graphicx}
\usepackage{float} 
\usepackage{subcaption}

\begin{document}
\begin{figure}[H]
        \begin{subfigure}[t]{0.45\linewidth}
                \hspace{-10pt}
                \includegraphics[scale=0.3]{figure1}
                \subcaption{A loooooooooooooooooooooooooooooooooooooooooooooooooooooong text over several lines!!} \vspace{1cm}} %\vspace is for obtaining some vertical "air" between the figures. 
        \end{subfigure}
        \qquad %for horizontal spacing
        \begin{subfigure}[t]{0.45\linewidth}
            \hspace{-10pt}
                \includegraphics[scale=0.3]{figure2}
        \subcaption{A loooooooooooooooooooooooooooooooooooooooooooooooooooooong text over several lines!!}
    \end{subfigure}
\\ %for changing line to next 2 figures    
              \begin{subfigure}[t]{0.45\linewidth}
          \hspace{-10pt}
              \includegraphics[scale=0.3]{figure3}
               \subcaption{A loooooooooooooooooooooooooooooooooooooooooooooooooooooong text over several lines!!}
        \end{subfigure}
        \qquad %for horizontal spacing
        \begin{subfigure}[t]{0.45\linewidth}
            \hspace{-10pt}
                \includegraphics[scale=0.3]{figure4}
        \\subcaption{A loooooooooooooooooooooooooooooooooooooooooooooooooooooong text over several lines!!}
        \end{subfigure} 
\caption{The total caption which is not affected.}
\end{figure}

\end{document}
percusse
  • 157,807
Jon
  • 1
  • 1
    Please have a look at http://tex.stackexchange.com/questions/13625/subcaption-vs-subfig-best-package-for-referencing-a-subfigure subfigure package is really archaic and problematic so it is already a solution just using subcaption but adjusting manual spacing is not the way to go. The package offers various customization possibilities. – percusse May 04 '14 at 17:09
  • @percusse - The user is not using the subfigure package. I agree with you, though, that all these manual spacing adjustments aren't the way to go. – Mico May 04 '14 at 17:18
  • @Mico Right. My wording is not that good. I meant that subcaption is much more than replacing subfigure but apparently failed to reflect that. . – percusse May 04 '14 at 17:23