0

I am having some problem with my thesis format. Please help me to fix these issues. thanks in advance

  1. How to add figure label in subfigure. Currently it's showing as a) caption..... but I want it as Fig. 2.1(a) caption....
  2. I want to get Fig. 1.1 example figure instead of 1.1 example figure in List of Figures. I can't use tocloft package. I have tested it. It's not working because of the titlesec and titletoc. I have used both of these packages extensively in my format.
  3. I want the same for List of Tables. Now it comes as 2.1 abc. But I need Table 2.1 abc
  4. Is there any way to cite the figure and table as bold face without typing \textit{...} everytime -

for example in page 6 it comes like this “Fig. 2.1” shows an example image. But I need “Fig. 2.1” shows an example image.

  1. I need to remove the dots from the ToC

an working mwe is given here. complete format can be found here - Thesis formatting - ToC, figure

\documentclass[12pt,a4paper]{report}


\usepackage{setspace}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{titlesec}
\usepackage{titletoc} 


\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}


\begin{document}

\tableofcontents
\listoffigures
\listoftables



\setstretch{1.5}
\chapter{SIMULATION}
\section{Example section}
\lipsum[2-3]

\begin{figure}[!htb]
    \centering
    \includegraphics{example-image-a}
    \caption{Example figure}
\end{figure}

\chapter{SIMULATION2}
\section{Example section 2}


\begin{figure}[!htb]
    \begin{subfigure}{.48\linewidth}
        \centering
        \includegraphics[width=\linewidth]{example-image-b}
        \caption{Example figure 2.1}
    \end{subfigure}
    \begin{subfigure}{.48\linewidth}
        \centering
        \includegraphics[width=\linewidth]{example-image-c}
        \caption{Example figure 2.2}
    \end{subfigure}
    \caption{Example figure 2}
    \label{fig2}
\end{figure}

``Fig.~\ref{fig2}'' shows an example image.

\end{document}
1

Not sure if I implemented all your requirements. It's recommended to ask for one thing in one question.

\documentclass[12pt,a4paper]{report}


\usepackage{setspace}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage[labelfont=bf, labelsep=space, belowskip=-5pt, aboveskip=10pt]{caption}
\usepackage{subcaption}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{xpatch}


\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}


\renewcommand\thesubfigure{\thefigure~(\alph{subfigure})}
\renewcommand\thesubtable{\thetable~(\alph{subtable})}

\makeatletter
\renewcommand\p@figure{Fig.~}
\renewcommand\p@subfigure{Fig.~}
\renewcommand\p@table{Table.~}
\renewcommand\p@subtable{Table.~}
\makeatother

\DeclareCaptionLabelFormat{subfigure-label}{Fig.~#2}
\DeclareCaptionLabelFormat{subtable-label}{Table.~#2}
\DeclareCaptionListFormat{figurelist}{#1#2}
\DeclareCaptionListFormat{tablelist}{#1#2}

\captionsetup[subfigure]{labelformat=subfigure-label}
\captionsetup[subtable]{labelformat=subtable-label}
\captionsetup[figure]{listformat=figurelist}
\captionsetup[table]{listformat=tablelist}

% dotless toc entries
\makeatletter
\xpatchcmd\@dottedtocline
  {\leaders\hbox{$\m@th\mkern\@dotsep mu\hbox{.}\mkern\@dotsep mu$}}
  {}
  {}{\fail}

% enlarge label width
\renewcommand*\l@figure{\@dottedtocline{1}{1.5em}{4em}}
\renewcommand*\l@table{\@dottedtocline{1}{1.5em}{5em}}
\makeatother

\usepackage{cleveref}
\crefname{figure}{}{}
\crefname{table}{}{}
\creflabelformat{figure}{#2\textbf{#1}#3}
\creflabelformat{table}{#2\textbf{#1}#3}

\begin{document}

\tableofcontents
\listoffigures
\listoftables



%\setstretch{1.5}
\chapter{SIMULATION}
\section{Example section}
%\lipsum[1]

\begin{figure}[!htb]
    \centering
    \includegraphics{example-image-a}
    \caption{Example figure}
\end{figure}

\chapter{SIMULATION2}
\section{Example section 2}

\begin{table}
  \caption{text}\label{tab1}
\end{table}

\begin{figure}[!htb]
    \begin{subfigure}{.48\linewidth}
        \centering
        \includegraphics[width=\linewidth]{example-image-b}
        \caption{Example figure 2.1}
    \end{subfigure}
    \begin{subfigure}{.48\linewidth}
        \centering
        \includegraphics[width=\linewidth]{example-image-c}
        \caption{Example figure 2.2}
    \end{subfigure}
    \caption{Example figure 2}
    \label{fig2}
\end{figure}

``\cref{fig2}'' shows an example image.5

\end{document}

enter image description here enter image description here enter image description here

3
  • I can't express how much grateful I am. May the creator bless You. Everything is working perfectly. However I have a small problem - In Toc subsection and subsubsection is still showing the dots Sep 17 '20 at 12:13
  • @MAzharulIslam Updated. Now xpatch package is loaded and the code for dotless toc entries is changed. Sep 17 '20 at 13:02
  • It works perfectly. Thanks for Your great effort and for the time You have given to solve this. Sep 17 '20 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.