3

image

Figure 4.1 is two subfigures, each with a caption (technically four figures in total, but the ones on rows are one image).

Using

\documentclass[twocolumn,titlepage]{report}

 \usepackage{verbatim}
\usepackage{amsfonts}
\usepackage{amsmath}
%%\usepackage{subfigure}
\usepackage{amssymb}
\usepackage[pdftex]{graphicx}
\usepackage{geometry}
\usepackage{titlesec}
\usepackage[center]{caption}
\usepackage{subcaption}

\titleformat{\chapter}[block]
 {\normalfont\huge\bfseries}{\thechapter}{1em}{}

\geometry{
  body={7in, 10in},
  left=0.75in,
  top=0.5in
}

\begin{document}

\begin{figure}[ht]
       \begin{subfigure}[b]{0.3\textwidth}
          \includegraphics[width=8.7cm]{fig5-a.png}
      \caption{\textit{I-V Charactaristic at 1Hz (left) and 5 Hz (right)}}
   \end{subfigure}
       \begin{subfigure}[b]{0.3\textwidth}
          \includegraphics[width=8.7cm]{fig8.png}
      \caption{\textit{I-V Charactaristic at 10 Hz (left) and 500Hz (right)}}
\end{subfigure}
    \caption{I-V Charactaristics of varying frequencies, showing the expected tightening of the bow}
    \label{fig:freqdep}
 \end{figure}    
\end{document}

the captions are not aligned under the entire figure. Ideally the caption would spread right across the width of both plots in figure 4.1 a

  • 1
    Welcome to TeX.sx! Thank you for the sample code. In the future, please include a full minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...}, including all necessary packages, and ending with \end{document}. – Matthew Leingang Apr 9 '13 at 12:00
4

You have specified the width of each subfigure to be 0.3\textwidth, and that sets the width of the caption. But the included graphic is much wider, so it sticks out.

To fix, set the width of the subfigure to be the full column width:

\documentclass[twocolumn]{article}
\usepackage[draft]{graphicx}
\usepackage{subcaption}
\begin{document}
   \begin{figure}[ht]
      \begin{subfigure}[b]{\columnwidth}
         \includegraphics[width=\columnwidth]{fig5-a.png}
         \caption{\textit{I-V Charactaristic at 1Hz (left) and 5 Hz (right)}}
      \end{subfigure}
      \begin{subfigure}[b]{\columnwidth}
          \includegraphics[width=\columnwidth]{fig8.png}
          \caption{\textit{I-V Charactaristic at 10 Hz (left) and 500Hz (right)}}
      \end{subfigure}
      \caption{I-V Charactaristics of varying frequencies, showing the expected tightening of the bow}
      \label{fig:freqdep}
   \end{figure}
\end{document}

(Thanks to egreg for the helpful comment.)

  • This has made the text central to the entire page? i.imgur.com/NJQJDg3.png – TheRandom Apr 9 '13 at 12:09
  • @TheRandom: That's weird. I wasn't working with a two-column document. Update your MWE to accurately recreate the problem and I'll take another look. (But not immediately; I'll be away for the next few hours.) – Matthew Leingang Apr 9 '13 at 12:36
  • 3
    Use \columnwidth instead of \textwidth. I'd use the same or a fraction of it (say 0.9\columnwidth) instead of 8.7cm which is just a guess. – egreg Apr 9 '13 at 13:12
  • @egreg: Thanks for the comment. I've edited. – Matthew Leingang Apr 9 '13 at 18:10
  • 1
    The \textit could be moved to the subcaption package options: \usepackage[textfont=it]{subcaption} so there is no need for repeating \textits anymore. – Axel Sommerfeldt Apr 10 '13 at 6:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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