2

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{[email protected]}
\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

2
  • Welcome to TeX.SX! Running your code: There's an error about a missing title, not about the caption option. Please add working examples, not just fragments of code.
    – user31729
    Commented Dec 5, 2015 at 18:36
  • Welcome to TeX.SX! I get hanging captions in both cases.
    – egreg
    Commented Dec 5, 2015 at 18:37

1 Answer 1

2

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

2
  • If I am using your code (I have the same problem when using mine) I get the following error message: ! LaTeX Error: Option clash for package caption. Don't get it.
    – Anton
    Commented Dec 5, 2015 at 19:07
  • Have you updated your TeX distribution? That could help!
    – user31729
    Commented Dec 5, 2015 at 19:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .