# Error using \usepackage{subcaption} in LaTeX document

Right now, I am writing my bachelor thesis and using LaTeX for the first time, using the template made available at https://www.overleaf.com/read/jtsdtwkcjcyq .

I am writing the results as I am writing this message. To make a nice presentation of my results, I would like to dedicate a page to a subfigure with 3 rows and 2 columns of figures. I want to have this in my thesis:

Unfortunately, when I try to place this in my thesis, it gives an error when I try to use \usepackage{subcaption}. The error is (There were 2 error messages) /usr/share/texlive/texmf-dist/tex/latex/caption/subcaption.sty:73: Undefined co ntrol sequence. l.73 \caption@SetupOptions {subcaption}{\captionsetup[sub]{#2}}%

The report.tex file looks as follows. (there are probably some usepackages that I don't need, but I am not yet familiar with all of latex and this is a standard template of my university).

I hope somebody knows this error and is able to help me :)

\documentclass[a4paper,12pt,oneside]{booksfsf}
%\documentclass[a4paper,12pt,twoside,fleqn]{booksfsf}
%\documentclass[twocolumn]{article}
\usepackage{hyperref}
\usepackage{latexsym}

\usepackage{graphics}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{psfrag}
\usepackage{cite}
\def\citepunct{], [}
\def\citedash{]--[}

\usepackage{pdfpages}                           % To allow inclusion of the frontpage as a pdf-page
\usepackage{caption}
\usepackage{captspec}
\usepackage[printonlyused]{acronym}
\usepackage{makeidx}
\usepackage[english]{babel}
\makeindex
\usepackage{color}
\usepackage{tabularx}
\usepackage{amsbsy}
\usepackage{lscape}
\usepackage{breakurl}
\usepackage{appendix}
\usepackage{enumerate}

\usepackage{fancyhdr}
\usepackage{mwe}

\usepackage{lastpage}
\usepackage[labelfont = it, font = footnotesize, hangindent = 26pt, parskip = 20pt]{subfig}

%change geometry of the lay-out
\usepackage[left=2.00cm, right=2.00cm, top=3.00cm, bottom=3.00cm]{geometry} % Marges

%change title properties
\usepackage{titlesec}
\titleformat{\chapter}[hang]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter:}{1em}{}
\titlespacing*{\chapter}{0pt}{0pt}{40pt}

\renewcommand{\baselinestretch}{1.20}
\renewcommand{\captionfont}{\footnotesize\itshape}

\renewcommand\sfdefault{phv}                               % use helvetica for sans serif
\renewcommand\familydefault{\sfdefault}               %    use sans serif by default

\begin{document}

\frontmatter

\includepdf{frontpage} % Include the frontpage which is a separate pdf. Make sure the pdf exists!
% Note: this only works with PDFlatex. If you use a different typesetter,
% then include the frontpage afterwards, e.g. using Adobe Acrobat

%\pagestyle{empty}

\newpage
\cleardoublepage

\include{preface}

\include{summary}

\tableofcontents

%\include{acronyms}

\mainmatter

\include{chap_introduction}

\include{theory}

\include{Experimental}

\include{Results}

%\include{chap_body}

%\include{chap_...}

%\include{chap_conclusions}

\cleardoublepage %to make sure that the first page number for the references is correctly listed in the TOC.
\bibliographystyle{IEEEtran}
\bibliography{IEEEfull,Mybibliography}

\noappendicestocpagenum

\begin{appendix}

\include{appendix_A}

\end{appendix}

\end{document}

• Welcome to TeX.Stackexchange! Is booksfsf and captspec available somewhere? Can you make a minimal working example (MWE) that does not need external file which we don't have? – samcarter_is_at_topanswers.xyz Jun 22 '18 at 13:20
• Hi Sam, Thanks for your quick reply! I am afraid i don't fully understand what you mean. – Frank Vermeeren Jun 22 '18 at 13:57
• Off-topic: you don't need graphics if you load graphicx – samcarter_is_at_topanswers.xyz Jun 22 '18 at 13:59
• Alright, thank you I will get rit of it right away – Frank Vermeeren Jun 22 '18 at 15:04
• Coming back to your question, the template I am using is available on Overleaf under the name: University of Twente: Latex template for Telecommunication Engineering (TE) report. – Frank Vermeeren Jun 22 '18 at 15:14

If \caption@SetupOptions is an undefined command then the version of the subcaption is not compatible to the version of the caption package. (There should be a warning about this in the log file.)
Since caption and subcaption are always released in a bundle it seems that you have an old version as local copy (from 2008 or older) of caption.sty and/or caption3.sty in your document folder. So deleting these files should help.
BTW: Using caption and captspec together definitely does not make sense. Both packages re-define \@makecaption so you should decide which one to use (and drop the usage of the other).