[Tex/LaTex] \captionsetup{option} does not work for table

captions

I have a problem with the \captionsetup{}

First of all, singlelinecheck=off does not work for my table, nor does any other option I define for my table, e.g. labelfont=bf.

Interestingly it works for figures in the same document.

Does anybody have a suggestion?

Here is my code:

\documentclass[journal=jacsat,manuscript=article]{achemso}

\usepackage[version=3]{mhchem} % Formula subscripts using \ce{}
\usepackage{caption}
\usepackage[colorlinks, linkcolor = black, citecolor = black, filecolor = black, urlcolor = blue]{hyperref}
%\usepackage{cleveref}
\usepackage{upgreek}

\newcommand*\mycommand[1]{\texttt{\emph{#1}}}


\author{Some author}
\affiliation{some affiliation}
\email{a.b@c.com}
\makeatletter
\let\acs@address@list\relax
\setlength\acs@space@post@address{0pt}
\makeatother

\title[An \textsf{achemso} demo]
  {Some title}%\footnote{A footnote for the title}}

\begin{document}

\begin{abstract}
...
\end{abstract}

\newpage
\section{Introduction}
... 
\section{Results and discussion}
...
\subsection{Subsection 1}
...
\subsection{Subsection 2}
...
\section{Outline}
...
\section{Experimental}
...
\begin{acknowledgement}
Some acknowledgement
\end{acknowledgement}

\cleardoublepage
\section{Tables} 

\begin{table}
  \captionsetup{format=hang, labelfont=bf, singlelinecheck=off}
  \caption{Test test}
  \label{T1}
  \begin{center}
  {\renewcommand{\arraystretch}{1.3}
  \begin{tabular}{ccc}
    \hline
    Random1 & Random2 & Random3 \\
    \hline
    1 & 1 & 1 \\
    2 & 2 & 2 \\
    3 & 3 & 3 \\
    \hline
  \end{tabular}}
  \end{center}
\end{table}

\cleardoublepage
\section{Tables} 

\begin{figure}[htb]
  \noindent\includegraphics[width=1\textwidth]{./pics/somepic}
  \centering
  \captionsetup{format=hang, labelfont=bf}
  \caption{Test test test test test test test test test test test test test test test test test test test test test test test test test} 
  \label{F1}
 \end{figure}

\end{document}

I tried to pre-define the singlelinecheck=off at the beginning of the document when loading the caption package. Unfortunately, I get an error message stating that I already loaded the package when I do this.

Thanks in advance!

Hope it works now; this is the achemso Latex template

Best Answer

This provides hanging indents (and I've removed the \begin{center}...\end{center} pair in the floating table.

The error is most likely due to a missing \title{...} statement!

singlelinecheck=off as an option to the caption package works too!

\documentclass[journal=jacsat,manuscript=article]{achemso}

\usepackage[version=3]{mhchem} % Formula subscripts using \ce{}
\usepackage[singlelinecheck=off]{caption}
\usepackage{upgreek}
\usepackage[colorlinks, linkcolor = black, citecolor = black, filecolor = black, urlcolor = blue]{hyperref}
%\usepackage{cleveref}
\title{Theory of Brontosaurs}
\author{Ann Elk}
\begin{document}
\begin{table}
  \captionsetup{format=hang, labelfont=bf}
  \caption{Test test test test test test test test test test test test test test test test test test test test test test test test test}
  \label{T1}
%  \begin{center}
  \centering
  {\renewcommand{\arraystretch}{1.3}
  \begin{tabular}{ccc}
    \hline
    Random1 & Random2 & Random3 \\
    \hline
    1 & 1 & 1 \\
    2 & 2 & 2 \\
    3 & 3 & 3 \\
    \hline
  \end{tabular}}
\end{table}

\begin{figure}[htb]
%  \noindent\includegraphics[width=1\textwidth]{./pics/pic}
  \centering
  \captionsetup{format=hang, labelfont=bf}
  \caption{Test test test test test test test test test test test test test test test test test test test test test test test test test} 
  \label{F1}
 \end{figure}

\end{document}

enter image description here