[Tex/LaTex] Problem with placement of subfigure captions

subcaption

I am using the subcaption package and I want to know how to place the captions of the subfigures in the bottom center of each subfigure.

\documentclass[12pt,a4paper]{article}
%
%
\usepackage{utopia} 
\usepackage{enumitem}
\usepackage[usenames,dvipsnames]{color}
\usepackage[superscript,ref,nomove]{cite}
\usepackage{textcomp} 
\usepackage{verbatim, amsmath, amsfonts, amssymb, amsthm} 
\usepackage[british]{babel} 
\usepackage{float}
\usepackage{graphicx} 
\usepackage{booktabs,longtable,rotating} 
\usepackage{array,warpcol} 
\usepackage{multirow} 
\usepackage{fixme} 
\usepackage[section,verbose]{placeins}
\usepackage{gensymb,units}
\usepackage{fancyhdr} 
\usepackage{setspace} 
\usepackage{microtype} 
\usepackage{stfloats}
%
\usepackage[width=11cm,font=footnotesize,labelfont=bf%
,format=hang,labelformat=parens,labelsep=endash,%
justification=raggedright,singlelinecheck=on]{caption} % Captions.
\usepackage{subcaption}
\captionsetup[sub]{width=6cm,font=scriptsize,labelfont=bf%
,format=hang,labelformat=parens,labelsep=endash,%
justification=centering,singlelinecheck=on}
%
\usepackage{fixltx2e}
\usepackage{varwidth}
\usepackage{todonotes}
\usepackage[pageanchor=true,plainpages=false,pagebackref=false%
,hyperindex=true,hyperfootnotes=true,linktocpage=false%
,colorlinks=true,citecolor=blue,menucolor=red,bookmarks=true%
,bookmarksnumbered=true,pdftitle={Latitude and Month Correction},pdfauthor={Muhammad Hamdy Al-bassoussi},pdfkeywords={Cooling Load},pdfdisplaydoctitle=true,pdffitwindow=true,pdfmenubar=true%
,pdftoolbar=true,pdfwindowui=true,pdfpagelayout=OneColumn]{hyperref}
%
\graphicspath{{./Figures/}} %To set the first directory to search for images in.
%
%\setlength{\parindent}{0pt}
\setlength{\parskip}{2ex plus 0.5ex minus 0.2ex}
%\parindent0em
%\parskip\medskipamount
%
\renewcommand{\baselinestretch}{1.25}
%
\pagestyle{fancy}
\fancyhf{}
\cfoot{\bfseries{\thepage}}
\rfoot{\scriptsize\bf{Latitude \& Month Correction}}
\lfoot{\scriptsize\bf{M. Hamdy}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.5pt}
%\addtolength{\headheight}{0pt} % make space for the rule
\fancypagestyle{plain}{%
\fancyhead{} % get rid of headers on plain pages
\renewcommand{\headrulewidth}{0pt} % and the line
%\fancyfoot{}
%\renewcommand{\footrulewidth}{0pt}
}
%
\renewcommand{\arraystretch}{1.5} % To edit the height of the rows of a table.
%


\begin{document}



\begin{figure}[H]
\begin{subfigure}{0.3\textwidth}
\centering
\includegraphics[height= 6cm, width=12cm]{W80_32N_Sep_S}
\caption{Wall no.(80): 32$^\circ$N - September - South orientaion}
\label{fig:w80}
\end{subfigure}%

\begin{subfigure}{0.3\textwidth}
\centering
\includegraphics[height= 6cm, width=12cm]{W17_56N_Apr_NE}
\caption{Wall no.(17): 56$^\circ$N - April - NourthEast orientaion}
\label{fig:w17}
\end{subfigure}%
\qquad
\caption{Comparing Corrected CLTDs Resulting from Equations~(\ref{eq:corr}) and~(\ref{eq:corr_ash}) with the Calculated CLTDs for Two Different Wall Constructions, Locations, Months, and Orientations.}\label{fig:corr}
\end{figure} 

\end{document}

The image

Best Answer

You are using a subfigure with width of 0.3\textwidth and a width of 6cm in \captionsetup[sub]. The caption is centered within that width. But the figure width (as in \includegraphics[height= 6cm, width=12cm]) is more than that. Hence all this trouble.

Remedies:

  1. Don't use more width in \includegraphics[width=..] than given in \begin{subfigure}{....} and use same width in both \captionsetup[sub] as well.
  2. It is better to give only width in \includegraphics[width=..]. If you include height, you should use keepaspectratio to prevent the figure from getting distorted.

Use something like

\begin{figure}[H]
\begin{subfigure}{6cm}
\centering
\includegraphics[width=6cm]{example-image-a}
\caption{Wall no.(80): 32$^\circ$N - September - South orientaion}
\label{fig:w80}
\end{subfigure}%
\hfill                              %% note this addition
\begin{subfigure}{6cm}
\centering
\includegraphics[width=6cm]{example-image-b}
\caption{Wall no.(17): 56$^\circ$N - April - NourthEast orientaion}
\label{fig:w17}
\end{subfigure}%
\qquad
\caption{Comparing Corrected CLTDs Resulting from Equations~(\ref{eq:corr}) and~(\ref{eq:corr_ash}) with the Calculated CLTDs for Two Different Wall Constructions, Locations, Months, and Orientations.}\label{fig:corr}
\end{figure}

enter image description here