I want to have sub-figure exactly above the caption, but now I have it on the left side of the caption.
\begin{figure}[H]
\centering
\begin{subfigure}{0.45\textwidth}
\includegraphics[scale=0.7]{astmdowel}
\caption{} \label{fig:}
\end{subfigure}
\hspace*{0cm} % separation between the subfigures
\hfill
\begin{subfigure}{0.45\textwidth}
\includegraphics[scale=0.7]{BSdowel}
\caption{} \label{fig:}
\end{subfigure}
\caption{Specimen according to: a)ASTM D 5764 -97a b)BS EN 383:2007.} \label{fig:40}
\end{figure}
Thank you for your comments, I checked using fbox and the pictures don't have any extra space:
Here is working example:
\documentclass[12pt, a4paper]{report}
% ctrl+T comment, ctrl+U uncomment
\usepackage{tikz}
\usepackage{slashbox}
\usepackage{caption}
\usepackage{float}
\usepackage{enumerate}
\usepackage{bm}
\usepackage[export]{adjustbox}
\usepackage{multirow}
\usepackage{array}
\usepackage[labelformat=simple]{subcaption}
\renewcommand\thesubfigure{\alph{subfigure})}
\usepackage{fixltx2e}
\captionsetup[subfigure]{skip=1pt} %%global setting for subfigure
\usepackage{amsmath, siunitx}
\usepackage{xcolor}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage[labelfont=it]{caption}
\usepackage[font=it]{caption}
%\usepackage{showframe}% http://ctan.org/pkg/showframe
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\@makechapterhead}{\vspace*{50\p@}}{}{}{}% Removes space above \chapter head
\patchcmd{\@makeschapterhead}{\vspace*{50\p@}}{}{}{}% Removes space above \chapter* head
\makeatother
\pretolerance=10000 % stop latex from braking the words
\tolerance=2000 % stop latex from braking the words
\emergencystretch=10pt % stop latex from braking the words
\usepackage{titlesec}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{geometry}
\geometry{a4paper,
bottom=25mm,
right=31.7mm,
left=31.7mm,
top=25mm,
}
\DeclareMathSizes{10}{10}{10}{10}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{}{18pt}{\Huge}
\begin{document}
\begin{figure}[H]
\centering
\begin{subfigure}{0.45\textwidth}
\fbox{\includegraphics[scale=0.7]{astmdowel}}
\caption{} \label{fig:}
\end{subfigure}
\hspace*{0cm} % separation between the subfigures
\hfill
\begin{subfigure}{0.45\textwidth}
\fbox{\includegraphics[scale=0.7]{BSdowel}}
\caption{} \label{fig:}
\end{subfigure}
\caption{Specimen according to: a)ASTM D 5764 -97a b)BS EN 383:2007.} \label{fig:40}
\end{figure}
\end{document}
example-image
from packagegraphicx
instead yours (which are not available too us) I get expected result: image sub-captions are centered below images. This means, that you image has (huge) white space on the right side. To see this, try to enclose inclusion of graphics intofbox
like\fbox{\includegraphics[scale=0.4]{example-image-a}}
. And please, help hus to help you ... alwas provide complete minimal (non) working example (MWE) which we can copy to our computers and test it.