[Tex/LaTex] Table caption should be left aligned

captionsfloatshorizontal alignmentindentation

How to make table caption left-aligned.

I tried \usepackage[singlelinecheck=off]{caption} but it did not work out. In other words it gives an error:


\DeclareFloatFont
{tiny}{\tiny}% "scriptsize" is defined by floatrow, "t...

    \documentclass[a4paper]{article}
    \usepackage{graphicx}
    \usepackage[cmex10]{amsmath}
    \usepackage{mathtools}
    \usepackage[usenames]{color}
    \usepackage[table]{xcolor}
    \usepackage[left=2cm, right=2cm]{geometry}
    \usepackage{authblk}

    \usepackage{floatrow}
    \usepackage[labelsep=space]{caption}

    \DeclareFloatFont{tiny}{\tiny}
    \floatsetup[table]{font=footnotesize,capposition=top}

    \linespread{1.6}
    \renewenvironment{abstract}{%
    \noindent\bfseries\abstractname:\normalfont}{}

    \newcommand{\affilmark}[1]{\rlap{\textsuperscript{\itshape#1}}}

    \begin{document}

    \centerline{\LARGE Title}
    \vspace*{3ex}
    \begin{flushleft}\large
    A.B \affilmark{a},\quad
    A.D\affilmark{b}\\[2ex]
    \normalsize\itshape
    \textsuperscript{a}\,University of nowhere,\
    \upshape Corresponding author's email: \texttt{A.D@ieee.org}
    \end{flushleft}
    \date{}

    \begin{abstract}
    abstract goes here
    \end{abstract}


    \section{Introduction}
    some text goes here.

    \begin{figure}[!t]
    \includegraphics[width=0.4\textwidth, height=0.2\textwidth]
    \ffigbox[\FBwidth]
    \caption{Conventional  (a) ABCD. (b) EFGH.}
    \label{ABCDEFGH}
    \end{figure}

    \begin{table}[!t]

    \caption{performance of .}
    \label{tableII}
    \centering
    \definecolor{latexbl}{RGB}{28,220,240}
    \rowcolors{12}{black}{latexbl}

    \begin{tabular}  {|m{0.8cm}|m{0.6cm}|m{1.35cm}|m{1.1cm}|m{1.5cm}|m{1.1cm}|m{1.4cm}|m{0.7cm}|m{1.75cm}|m{1.2cm}|m{0.5cm}|}
    \hline
    \center Ref. & A &  B& C & D& E& F &G &H&I &J\\
    \hline
    \end{tabular}
    \begin{flushleft}
    some explanation
    \end{flushleft}
    \end{table}
    \end{document}

EDIT BY LOCKSTEP (moved from separate "answer"):

Here's a compilable example that doesn't show the problematic behaviour mentioned by you. Please use it as start-up aid to post a compilable example which does show the behaviour.

\documentclass{article}

\usepackage{floatrow}
\usepackage[singlelinecheck=off]{caption}

\begin{document}


\begin{table}
(Table content)
\caption{A table}
\end{table}

\end{document}

Best Answer

Seems like you want the captions to have the same width than the width of its figure/table. If this is the case, you can use the \ffigbox, and \ttabbox commands from the floatrow package. A little example:

\documentclass{article}
\usepackage{floatrow}
\usepackage[labelsep=space]{caption}

\DeclareFloatFont{tiny}{\tiny}
\floatsetup[table]{font=footnotesize,capposition=top}

\newcommand\Text{text text text text text text text}% just for the example

\begin{document}

\begin{figure}[!ht]
\ffigbox[\FBwidth]
{\caption{A figure with its caption having equal width to the figure width}\label{fig:test1}}
{\rule{4cm}{2cm}}
\end{figure}

\begin{table}[!ht]
\ttabbox[\FBwidth]
{\caption{A table with its caption having equal width to the table width}\label{fig:test1}}
{\begin{tabular}{p{3cm}p{3cm}}
\Text\Text & \Text\Text \\
\Text\Text & \Text\Text 
\end{tabular}
}
\end{table}

\end{document}

enter image description here