Wednesday, November 23, 2011

[LaTeX] How to solve subfig package overriding custom captions in Figures and Tables

26 Zulhijah 1432H.

Here i am writing my thesis using Kile.

Along the way, i need to add three separate figures with its own subcaptions, grouped under one main caption (also known as global caption). Don't understand what i'm saying? See Pic 1.


Pic 1 - See Figure 2.5 in the picture. Three separate figures with its own subcaptions, grouped under one global caption.


To do like Figure 2.5 in Pic 1, i used the subfig package after reading about it here:
WikiBooks > LaTeX/Floats, Figures and Captions > Captions > Subfloats

So i added:
\usepackage{subfig}
to my preamble, which is in the UPMthesisEnglish.tex file.

Wait. What's a preamble and what is UPMthesisEnglish.tex?


A LaTeX preamble is:
"The preamble file defines the style of the document and tells Latex which packages to use, such as packages for including figures."

Source: Chris Paciorek. Latex preamble. Accessed: 23 Nov 2011.

UPMthesisEnglish.tex is the main file of my thesis template and is also where my preamble is. Microsoft Word and LibreOffice Writer users will identify this as the Master document. To know a bit more about the template i'm using, see here, How to set different page margins within the same chapter in LaTeX under Tools.

However, nobody told me the subfig package will override my already existing custom captions for Tables and Figures, or that the package is supposed to be used with the caption package. As a result, all the previously bolded captions in Figures and Tables turn out unbolded, and the vertical spacing between figure and caption was reduced.

After a some searching, here's how to get the custom captions bolded again and at the same time use the subfig package without having to use the caption package. Put this in the preamble:
\usepackage[caption=false]{subfig}

Source: sommerfee's post here, Re: subfig package destroys figure captions. Accessed: 23 Nov 2011.

Then re-Build. Should work by now. As for me, everything is OK except for the altered vertical spacing between figure and caption. Manual tweaking is required suppose :-\