Theses, Books, Title pagesAdding subfigures

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
Post Reply
templateuser
Posts: 679
Joined: Tue Mar 03, 2015 4:01 pm

Adding subfigures

Post by templateuser »

Hi,

The template looks great and work perfectly. But I have a little problem with using this part

Code: Select all

\begin{figure}[htbp]
\centering
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[scale=0.5]{./Figures/ccd}
\caption{Capteur CCD}
%\label{fig:ccd}
\end{subfigure}%
~ ~ ~ ~ %add desired spacing between images, e. g. ~, \quad, \qquad etc.
%(or a blank line to force the subfigure onto a new line)
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[scale=0.5]{./Figures/cmos}
\caption{Capteur CMOS}
% \label{fig:cmos}
\end{subfigure}
\caption{Les principes des capteurs}
%\label{fig:cmos}
\end{figure}
It generate a problem :

Code: Select all

! Use of \@subfloat doesn’t match its definition.
\reserved@c ->\@subfloat {
sub\@captype }[\@empty {b}][{b}]
l.600 \begin{subfigure}[b]{
0.3\textwidth}
?
I tried to use

Code: Select all

\usepackage{caption}
\usepackage{subcaption}
but it doesn’t work, same problem

best
Amed

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Vel
Site Moderator
Posts: 463
Joined: Fri Jun 29, 2012 1:20 am

Adding subfigures

Post by Vel »

Hi Ahmed,

This works just fine for me without the inclusion of any additional packages:

Code: Select all

\begin{figure}
\centering
\subfigure[Capteur CCD\label{fig:ccd}]{\includegraphics[scale=0.1]{image1.png}}\\
\subfigure[Capteur CMOS\label{fig:cmos}]{\includegraphics[scale=0.1]{image2.png}}
\caption{Les principes des capteurs}
\end{figure}
Cheers,
Vel
Founder and administrator of LaTeXTemplates.com and LaTeXTypesetting.com
templateuser
Posts: 679
Joined: Tue Mar 03, 2015 4:01 pm

Re: Adding subfigures

Post by templateuser »

Hi Vel,

thanks for the answer , it work but I wanted the figures on the same line not seperated on different lines.

Best regards
Amed
User avatar
Vel
Site Moderator
Posts: 463
Joined: Fri Jun 29, 2012 1:20 am

Adding subfigures

Post by Vel »

Simply remove the \\ after the first \subfigure{}.
Founder and administrator of LaTeXTemplates.com and LaTeXTypesetting.com
templateuser
Posts: 679
Joined: Tue Mar 03, 2015 4:01 pm

Re: Adding subfigures

Post by templateuser »

Your code works fine but the captions are too far from the subfigures.Any suggestion please?

Dee
Post Reply