I could not figure out what is the reason the error when I added in \usepackage{subcaption} in my main.tex for Overleaf.
Basically, I want to have sub figure for one of my figure
My main.tex code:
\documentclass[12pt,oneside]{book} % Remove draft option to show figures (for final draft), otherwise keep for faster production
% to make the text width larger
\usepackage{geometry}
% to make the text width larger
% sub figure
\usepackage{textcomp}
\usepackage{subcaption}
% sub figure
% for drawing a table filled with color
\usepackage[svgnames, table]{xcolor}
\usepackage{hhline, boldline}
% for drawing a table filled with color
\usepackage[most]{tcolorbox}
\usepackage{enumitem} % macros to modify appearance of 'itemize' environments
\usepackage{uorthesis} % Loads the LaTeX style package
\usepackage[backend=biber,
% style=authoryear,
style=authoryear-comp,
% citestyle=authoryear,
dashed=false,
maxcitenames=2,
maxbibnames=99,
uniquelist=false, % for Author1 et al. (year) instead of Author1, Author2 et al. (year)
giveninits,
alldates=comp, %for online citing
dateabbrev=false, %for online citing for data format month in full
uniquename=init]{biblatex}
\urlstyle{same} % to make URL font style same
\DeclareNameAlias{sortname}{family-given} %for second and third author name
\addbibresource{references.bib}
% \usepackage{uorbib}
% for combine both year for an author
% \DeclareDelimFormat{nameyeardelim}{\addcomma\space}
% 12-09-2019
% for a chapter edited by a book
\usepackage{xpatch}
% \renewcommand*{\finalnamedelim}{\addspace\&\space}
% \renewcommand*{\intitlepunct}{\space} (to become In:)
\renewcommand{\labelnamepunct}{\space} %to delete . after (1997)
% \DeclareFieldFormat[article, incollection, unpublished]{pages}{#1} % to add in PP. (page)
\DeclareFieldFormat[article, incollection, unpublished]{title}{#1}
% \renewcommand{\bibpagespunct}{\ifentrytype{article}{\addcolon}{\addperiod\addspace}} %cancel out this in order to add in PP. (page)
% for title italic
% \DeclareFieldFormat*{title}{\mkbibemph{#1}} %for title italic in all format (conference, paper..)
\DeclareFieldFormat*{title}{#1} %for conference title delete ".."
\DeclareFieldFormat[incollection]{title}{\mkbibemph{#1}} %for incollecion title italic ONLY
\DeclareFieldFormat[thesis]{title}{\mkbibemph{#1}} %for phdthesis title italic ONLY
\DeclareFieldFormat[book]{title}{\mkbibemph{#1}} %for book title italic ONLY
% for title italic
% to delete "In:" for article
\renewbibmacro{in:}{%
\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}
% to delete "In:" for article
% to make volume (number), eg. 4(2)
\newcommand*{\volnumdelim}{}
\DeclareFieldFormat[article,periodical]{number}{\mkbibparens{#1}}
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
\setunit*{\volnumdelim}%
\printfield{number}%
\setunit{\addcomma\space}%
\printfield{eid}}
\newcommand*{\jourvoldelim}{\addcomma\space}
\newcommand*{\jourserdelim}{\newunitpunct}
\newcommand*{\servoldelim}{\jourvoldelim}
\newcommand*{\volnumdatedelim}{\addspace}
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\setunit*{\jourvoldelim}%
\iffieldundef{series}
{}
{\setunit*{\jourserdelim}%
\printfield{series}%
\setunit{\servoldelim}}%
\usebibmacro{volume+number+eid}%
\setunit{\volnumdatedelim}%
\usebibmacro{issue+date}%
\setunit{\addcolon\space}%
\usebibmacro{issue}%
\newunit}
% to make volume (number), eg. 4(2)
% for delete comma after Author A and Aurhor b
\DefineBibliographyExtras{english}{%
\let\finalandcomma\empty
\let\finalandsemicolon\empty
}
\renewcommand{\compcitedelim}{\addsemicolon\space}
\DeclareNameAlias{editorin}{given-family}
\newbibmacro*{byeditor:in}{%
\ifnameundef{editor}
{}
{\printnames[editorin]{editor}%
\setunit{\addcomma\space}%
\usebibmacro{editorstrg}%
\clearname{editor}}}
\xpatchbibdriver{inbook}
{\usebibmacro{in:}%
\usebibmacro{bybookauthor}%
\newunit\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}}
{\usebibmacro{in:}%
\usebibmacro{bybookauthor}%
\newunit\newblock
\usebibmacro{byeditor:in}%
\newunit\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}}
{}{}
\xpatchbibdriver{incollection}
{\usebibmacro{in:}%
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}}
{\usebibmacro{in:}%
\usebibmacro{byeditor:in}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor}}
{}{}
\xpatchbibdriver{inproceedings}
{\usebibmacro{in:}%
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{event+venue+date}%
\newunit\newblock
\usebibmacro{byeditor+others}}
{\usebibmacro{in:}%
\usebibmacro{byeditor:in}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{event+venue+date}%
\newunit\newblock
\usebibmacro{byeditor+others}}
{}{}
\xpatchbibdriver{phdthesis}
{\usebibmacro{in:}%
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{event+venue+date}%
\newunit\newblock
\usebibmacro{byeditor+others}}
{\usebibmacro{in:}%
\usebibmacro{byeditor:in}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{event+venue+date}%
\newunit\newblock
\usebibmacro{byeditor+others}}
{}{}
% for the purpose to change "paper title" to 'paper title' in reference
\usepackage[style=british]{csquotes}
% \usepackage[style=english]{csquotes}
% for the purpose to change "paper title" to 'paper title' in reference
% for references 's studies (year)
\renewcommand*{\nameyeardelim}{\addcomma\space}
\newcommand{\mycite}[1]{\citeauthor{#1}'s \citeyear{#1}}
\DeclareCiteCommand{\citeauthor}
{\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\ifciteindex
{\indexnames{labelname}}
{}%
\printtext[bibhyperref]{\printnames{labelname}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\DeclareCiteCommand{\citeyear} % <======================================
{}
{(\bibhyperref{\printdate})}
{\multicitedelim}
{}
% for Quoting AuthorA (1999: 22), Part 2
% \DeclareCiteCommand{\parencite}[\mkbibparens]
% {\usebibmacro{cite:init}%
% \usebibmacro{prenote}}
% {\usebibmacro{citeindex}%
% \printtext[bibhyperref]{\usebibmacro{cite}}}
% {\multicitedelim}
% {\usebibmacro{postnote}}
\DeclareCiteCommand{\parencite}[\mkbibparens]
{\renewcommand*{\postnotedelim}{\addcolon\space}%
\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{cite}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\DeclareCiteCommand{\cbx@textcite}
{\renewcommand*{\postnotedelim}{\addcolon\space}%
\usebibmacro{cite:init}}
{\usebibmacro{citeindex}%
\usebibmacro{textcite}}
{}
{\usebibmacro{textcite:postnote}}
% for Quoting AuthorA (1999: 22), Part 2
\makeatletter
\let\abx@macro@textciteOrig\abx@macro@textcite
\renewbibmacro{textcite}{% <============================================
\bibhyperref{%
\let\bibhyperref\relax\relax%
\abx@macro@textciteOrig%
}%
}%
\makeatother
% for references 's studies (year)
% for Quoting AuthorA (1999: 22), Part 1
\DeclareDelimFormat[textcite]{postnotedelim}{\addsemicolon\space}
\DeclareDelimFormat[parencite]{postnotedelim}{\addcolon\space}
% \DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{postnote}{\printtext[bibhyperref]{#1}}
\DeclareFieldFormat{multipostnote}{#1}
% delete and replace above because of older version of biblatex
% \DeclareFieldFormat{postnote}{\mknormrange{#1}}
% \DeclareFieldFormat{multipostnote}{\mknormrange{#1}}
% delete and replace above because of older version of biblatex
% for Quoting AuthorA (1999: 22), Part 1
% %for changing URL to Available at: and title italic
% \usepackage[english]{babel}
% \usepackage[australian]{babel}
\DeclareFieldFormat{url}{Available at\addcolon\space\url{#1}}
\DeclareFieldFormat{urldate}{\mkbibbrackets{\bibstring{urlseen}\space#1}}
\DeclareFieldFormat[online]{title}{\mkbibemph{#1}}
\DefineBibliographyStrings{english}{%
urlseen = {Accessed},
}
% below is to keep 'english' format as babel
\DefineBibliographyExtras{english}{%
\protected\def\mkdaterangecomp{%
\mkdaterangetrunc{long}}%
\protected\def\mkdaterangeterse{%
\mkdaterangetrunc{short}}%
\protected\def\mkdaterangecompextra{%
\mkdaterangetruncextra{long}}%
\protected\def\mkdaterangeterseextra{%
\mkdaterangetruncextra{short}}%
\protected\def\mkbibdatelong#1#2#3{%
\iffieldundef{#3}
{}
{\thefield{#3}%
\iffieldundef{#2}{}{\nobreakspace}}%
\iffieldundef{#2}
{}
{\mkbibmonth{\thefield{#2}}%
\iffieldundef{#1}{}{\space}}%
\iffieldbibstring{#1}
{\bibstring{\thefield{#1}}}
{\dateeraprintpre{#1}\stripzeros{\thefield{#1}}}}%
}
% %for changing URL to Available at: and title italic
% For making book citing 2nd (subscript) and edn.
% --------------------------------------------------------------------
\DeclareFieldFormat[book]{title}{\mkbibemph{#1}}
\usepackage[raise]{fmtcount}
\DefineBibliographyExtras{english}{%
\renewcommand*{\mkbibordedition}[1]{\ordinalnum{#1}[f]}
}
\DefineBibliographyStrings{english}{%
edition = {edn\adddot},%
}
% --------------------------------------------------------------------
% For making book citing 2nd (subscript) and edn.
\DeclareCiteCommand{\secondaryciteauthor}{}{\printtext[bibhyperref]{\printnames{labelname}}}{}{}
\DeclareCiteCommand{\secondaryciteyear}{}{\bibhyperref{\printdate}}{\multicitedelim}{}
\newcommand{\secondarycitedirect}[2]{\secondaryciteauthor{#1} (\secondaryciteyear{#1}, cited in \secondaryciteauthor{#2}, \secondaryciteyear{#2})}
\newcommand{\secondaryciteindirect}[2]{(\secondaryciteauthor{#1}, \secondaryciteyear{#1}, cited in \secondaryciteauthor{#2}, \secondaryciteyear{#2})}
% to add DOI as "Available at:" for @article
\DeclareFieldFormat{doi}{Available at\addcolon\space\url{#1}}
% can try below also
% \DeclareFieldFormat{doi}{\bibstring{urlfrom}\addcolon\space\url{#1}}
% \DefineBibliographyStrings{english}{%
% urlfrom = {Available at}
% }
% to add DOI as "Available at:" for @article
\usepackage{enumitem} %for tab in Latex (macros to modify appearance of 'itemize' environments)
% Put custom packages to be loaded here
% \usepackage{linguex} % For linguistic examples
% \usepackage{tikz} % For drawing
%for section paragraph
% https://tex.stackexchange.com/questions/60209/how-to-add-an-extra-level-of-sections-with-headings-below-subsubsection
\makeatletter
%%%%% Change the style of paragraph headings %%%%%
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}% %for section paragraph
{-2.5ex\@plus -1ex \@minus -.25ex}% %for section paragraph
{1.25ex \@plus .25ex}% %for section paragraph
{\normalfont\normalsize\bfseries}} %for section paragraph
%%%%% Change the style of subparagraph headings %%%%%
% \renewcommand\subparagraph{\@startsection{paragraph}{4}{\z@}% %for section paragraph
% {-2.5ex\@plus -1ex \@minus -.25ex}% %for section paragraph
% {1.25ex \@plus .25ex}% %for section paragraph
% {\normalfont\normalsize\bfseries}} %for section paragraph
\makeatother
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
%for paragraph spacing
\setlength{\parindent}{4em} %for paragraph spacing
\setlength{\parskip}{1em} %for paragraph spacing
%for paragraph spacing
%for table spacing to second row
\usepackage{tabularx,seqsplit, caption} %for table spacing to second row
\usepackage{booktabs, ragged2e} % Use booktabs rules and get rid of vertical rules, ragged2e to ragged text
\usepackage{makecell,siunitx} %for table spacing to second row
%for table spacing to second row
\usepackage{threeparttable} %to add footnote below table
\renewcommand{\TPTtagStyle}{\itshape} % optional
\usepackage{lipsum} % for filler text
% for bold in table using \small
\usepackage{makecell} % for bold in table using \small
\renewcommand\theadfont{\small\bfseries} % for bold in table using \small
\usepackage{tabulary,siunitx}
% for bold in table using \small
\renewcommand\theadgape{}
% for df1 and df2 math symbol in bold
\usepackage{amsmath}
% for df1 and df2 math symbol in bold
\usepackage{graphicx}
\usepackage[export]{adjustbox}
% \usepackage{libertine} %added by ryan
%\usepackage{float}
%\restylefloat{table}
%for table multirow
%\usepackage{multirow} %for table multirow
%\usepackage{multicol} %for table multirow
\usepackage{makecell, multirow, tabularx} %for table multirow
%for table multirow
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,calc, positioning,matrix,fit,calc, arrows.meta,
backgrounds,
chains}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15} % <---
%---------------- show page layout. don't use in a real document!
% \usepackage{showframe}
% \renewcommand\ShowFrameLinethickness{0.15pt}
% \renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
% % for making a comma after the volume -> cancel off because it create journal title, 4.(1).
% \renewbibmacro*{volume+number+eid}{%
% \setunit{\addcomma\space}%
% \printfield{volume}%
% \setunit*{\adddot}%
% \printfield{number}%
% \setunit{\addcomma\space}%
% \printfield{eid}}
% \usepackage{parskip}
\usepackage[hypcap=false]{caption}
% for the studies and hypothesis
\usepackage{amssymb}
\usepackage[utf8]{inputenc}
% for the studies and hypothesis
% for appendix
\usepackage{listings}
\usepackage{xcolor}
%New colors defined below
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
%Code listing style named "mystyle"
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour}, commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\ttfamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
%"mystyle" code listing set
\lstset{style=mystyle}
% for appendix
% \usepackage{geometry}
% \usepackage{tikz}
% \usetikzlibrary{matrix,calc,positioning,fit}
% \makeatletter
% \newcommand{\WriteAux}[1]{%
% \immediate\write\@mainaux{\xdef\string#1{#1}\relax}}
% \makeatother
% \pgfkeys{initialize dimension/.code={\unless\ifdefined#1
% \def#1{0pt}
% \fi}}
% \usetikzlibrary{fit,
% matrix}
% To change the default "PhD thesis" to "Ph.D. Thesis in Bibliography?
\DefineBibliographyStrings{english}{phdthesis = {Ph\adddot D\adddotspace Thesis}}
% To change the default "PhD thesis" to "Ph.D. Thesis in Bibliography?
\begin{document}
% Title page
\include{structure/title}
% All subsequent pages must be numbered, title page is considered page i,
% front matter is numbered in lowercase Roman numerals
\pagestyle{fancy}
\pagenumbering{roman}
\setcounter{page}{2}
\doublespacing
% Dedication (optional)
\include{structure/dedication}
% Acknowledgments
\include{structure/acknowledgements}
% Abstract
\include{structure/abstract}
% Table of Contents, List of Tables, List of Figures
\tableofcontents
%List of Tables & Figures
\include{structure/tablesfigures}
%%%%%%%%%%%%%%%%%%%% DISSERTATION CONTENT %%%%%%%%%%%%%%%%%%%%
% Regular numbering starts now, first page of first chapter is page 1
\clearpage
\setcounter{page}{0}
\pagenumbering{arabic}
% Body
\include{chapters/01-introduction}
\include{chapters/02-background}
\include{chapters/03-chapter}
\include{chapter4/04-chapter}
\include{chapters/05-chapter}
% \include{chapters/06-chapter}
% \include{chapters/07-chapter}
% \include{chapters/08-chapter}
% \include{chapters/Full-06-chapter}
%backup
% \include{chapters/04-chapter}
% References
\clearpage
\addcontentsline{toc}{chapter}{Bibliography}
\markboth{\MakeUppercase{Bibliography}}{}
%\singlespacing
\printbibliography
\appendix
\include{chapters/99-appendix}
\end{document}
and i need to use this below in template:
\usepackage{subfigure}
\usepackage[subfigure]{tocloft} % subfigure option only if using subfigure package

subcaptionmanual saysPlease note: This package is incompatible with the subfigure and subfig packages.. So these packages are mutually exclusive. They also serve the same purpose. You can do everything thatsubfigureallows you to do also withsubcaption. – Dec 28 '19 at 02:16\usepackage{subfigure} \usepackage[subfigure]{tocloft} % subfigure option only if using subfigure package \renewcommand{\cfttoctitlefont}{\Huge \bfseries \sffamily} % ToC titleto solve the issue of this here https://tex.stackexchange.com/questions/521989/how-to-do-subfigure-top-and-bottom-and-not-left-and-right?noredirect=1#comment1320065_521989 – aan Dec 28 '19 at 02:30subcaption? If not, the problem is solved. If you do, this would make a very nice question: remove everything from the document but\usepackage{subfigure} \usepackage[subfigure]{tocloft} \renewcommand{\cfttoctitlefont}{\Huge \bfseries \sffamily}and provide a very crisp minimal document. But I think the problem is solved in this post. – Dec 28 '19 at 02:36\usepackage{subcaption}with\usepackage{tocloft}and it work both – aan Dec 28 '19 at 02:52