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 am using subcaption package to plot subfloats in my report. However, the caption for subfigures are not centered. Here is what I have done:

\documentclass[10pt]{report}
\usepackage{epsfig,cite,amsfonts,amssymb,psfrag,balance}
\usepackage[centertags]{amsmath}
\usepackage{amsthm}
\usepackage{newlfont}
\usepackage[ansinew]{inputenc}
\usepackage[justification=centering]{caption}
\usepackage{graphicx,subcaption}
\usepackage{dsfont}
\usepackage{morefloats}

\begin{subfigure}{0.33\textwidth}
    \centering
    \psfrag{lambda}[][][1.5]{$\log_{10} (\lambda)$}
    \psfrag{N}[][][1.5]{Channel Noise Power, $N$}
    \resizebox{8cm}{!}{\epsfbox{P3_N_vary.eps}}
    \caption{Achievable}
    \label{fig:p3_graph1}
\end{subfigure}
\hspace{2.5cm}
\begin{subfigure}{0.33\textwidth}
    \centering
    \psfrag{lambda}[][][1.5]{$\log_{10} (\lambda)$}
    \psfrag{Ps}[][][1.5]{Encoder transmit power, $\ps$}
    \resizebox{8cm}{!}{\epsfbox{P3_ps_vary.eps}}
    \caption{Achievable }
    \label{fig:p3_graph2}
\end{subfigure}
\caption{}
\end{figure}

Am I missing something here? Can somebody help me out please?

share|improve this question
1  
your MWE doesn't compile- please fix it, and remove any unnecessary packages :) –  cmhughes Aug 2 '12 at 0:37

1 Answer 1

Assuming you're using a "standard" paper size (either letterpaper or A4) and "normal" horizontal margins (ca. 1"), your document's \textwidth parameter will be equal to roughly 6" (15cm). You allocate an overall width to each subfigure environments of 0.33\textwidth, which works out to about 2" (5cm). Yet, via the \resizebox instructions, you specify a display width of 8cm for the included graphics. These parameters are not mutually consistent, and thus LaTeX can't perform the centering as requested.

To fix up the problem, you may try applying the following changes: (i) specify widths of each subfigure of 0.45\textwidth instead 0.33\textwidth, (ii) use \linewidth instead of 8cm as the first argument of the \resizebox instructions, and (iii) replace the instruction \hspace{2.5cm} with \hspace{\fill}.

share|improve this answer

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.