I'm using my University's template to typeset my document and it's messing up some things about the subfigure captions in my document. This is a MWE .tex file that demonstrates my issue:
\documentclass[language=english,stage=alpha]{FRIteza}
\usepackage{graphicx}
\newlength{\colwidth}
\newlength{\rowheight}
\begin{document}
\begin{figure*}
\setlength{\colwidth}{.24\linewidth}
\setlength{\rowheight}{.57\colwidth}
\begin{subfigure}{\colwidth}
\includegraphics[width=\textwidth,height=\rowheight]{example-image-a}
\caption{Image A}
\label{fig:a}
\end{subfigure}\hfill%
\begin{subfigure}{\colwidth}
\includegraphics[width=\textwidth,height=\rowheight]{example-image-b}
\caption{Image B}
\label{fig:b}
\end{subfigure}\hfill%
\begin{subfigure}{2\colwidth}
\includegraphics[width=\textwidth,height=\rowheight]{example-image-c}
\caption{Image C}
\label{fig:c}
\end{subfigure}\hfill%
\caption{3 sample images, specifically \subref{fig:a} an excerpt from A, \subref{fig:b} some stuff from B, and \subref{fig:c} things from C.}
\label{fig:example}
\end{figure*}
Fig.~\ref{fig:example} shows some examples. Note the big letter C in Fig.~\ref{fig:c}.
\end{document}
I also made an Overleaf project that contains the class files and the required fonts, and can be downloaded as a zip file. It also has the correct software versions set up (TeX Live 2019 and XeLaTeX).
How it looks:
How I'd like it to look:
In the projects I've done so far, the subcaptions have normally been centered by default. I've also tried to center them manually using this advice:
\captionsetup[subfigure]{justification=centering}
I've tried adding this line right after the \documentclass
declaration, inside the figure
environment, and inside the subfigure
environment. None of these worked as the captions were still left-aligned.
Additionally, when I reference the captions in text, \ref
references to subfigures don't include the parentheses. I.e. they are referred to as Fig. 0.1c, instead of Fig. 0.1(c). I've fixed this in another project by using the following:
\usepackage{caption}
\makeatletter
\DeclareCaptionLabelFormat{mysublabelfmt}{(\alph{sub\@captype})}
\makeatother
\usepackage[labelformat=mysublabelfmt]{subcaption}
\renewcommand\thesubfigure{(\alph{subfigure})}
\renewcommand\thesubtable{(\alph{subtable})}
However, in this project now this same code gives me double parentheses around \subref
s.
The only code in the .cls I can find that alters caption positioning and reference format is this:
\RequirePackage[style=base]{caption}
\DeclareCaptionLabelSeparator{br}{\par\vspace*{2\p@}}
\captionsetup{singlelinecheck=off,labelsep=br,labelfont=it,textfont={RaggedRight,scriptsize}}
% subcaptions
\RequirePackage{subcaption}
\captionsetup[sub]{subrefformat=parens}
\captionsetup[sub]{format=plain,labelformat=parens,labelsep=space,font={normalfont,scriptsize},labelfont=up,hypcap=true}
but this doesn't seem to change anything about subcaption adjustment. And as far as the issue with the referencing style, I've tried to mess around with these subrefformat
, format
, and labelformat
properties along with the \renewcommand
s from the previously mentioned solution but I can't get all the references and captions to be parenthesised as shown in the image.
I've checked some other students' accepted submissions and they have centered subcaptions (though they seemingly did it by manually captioning the images in image editing software rather than in TeX), so these left-adjusted subcaptions don't seem to be a typesetting requirement, and they really make some of my figures unclear and difficult to read.
So, in short:
- How do I center the subfigure captions, while keeping the figure caption style as is?
- How do I parenthesise the
\ref
subfigure referencing, while keeping both\subref
subfigure referencing and\ref
figure referencing as is?
\captionsetup[sub]{subrefformat=simple}
followed by\renewcommand\thesubfigure{(\alph{subfigure})}
. It should give you the style you are looking for.