2

I am trying to include subcaption package in the document class aastex61.

Here are the relevant lines of my LaTeX source file

\documentclass[twocolumn]{aastex61}
\pdfoutput=1 %for arXiv submission
\usepackage{amsmath,amstext}
\usepackage[T1]{fontenc}
\usepackage{apjfonts} 
\usepackage[figure,figure*]{hypcap}
\usepackage{url}
\usepackage{graphicx}
\usepackage{subcaption}

\renewcommand*{\sectionautorefname}{Section} %for \autoref
\renewcommand*{\subsectionautorefname}{Section} %for \autoref

\shorttitle{AASTeX 6.1 Template}
\shortauthors{Author A et al.}

\begin{document}

\begin{figure}
    \centering 
    \begin{subfigure}[width = 0.3\linewidth] 
    \includegraphics{}[width=\textwidth]{4915_sval.pdf} 
       \caption{plot} 
       \label{plot:sval} 

    \end{subfigure} 

\end{figure} 

\end{document}

The error prompted is:

LaTeX Error: Command \longtable* already defined.
           Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...                                              

l.20 \begin{document}

Any suggestions are welcome!

  • 2
    The current TeX Live only has aastex6, which is based on revtex4-1, hence incompatible with subcaption; probably it's the same with aastex61. You can use subfig, instead, to be called \usepackage[caption=false]{subfig} (the syntax for subfloats is different, though). – egreg Jul 21 '17 at 20:39
6

When you try compiling your example, you get

Package caption Warning: Unsupported document class (or package) detected,
(caption)                usage of the caption package is not recommended.
See the caption package documentation for explanation.

The revtex4-1 class, which aastex61 is based on, is not compatible with caption and therefore also with subcaption.

You can use subfig, to be loaded with the caption=false option.

Here's some code to get you started:

\documentclass[twocolumn]{aastex61}
\pdfoutput=1 %for arXiv submission
\usepackage{amsmath}
\usepackage[T1]{fontenc}
%\usepackage{apjfonts} 
%\usepackage[figure,figure*]{hypcap}
\usepackage{url}
\usepackage{graphicx}
\usepackage[caption=false]{subfig}

\usepackage{lipsum} % just for the example

\renewcommand*{\sectionautorefname}{Section} %for \autoref
\renewcommand*{\subsectionautorefname}{Section} %for \autoref

\begin{document}

\title{An Example Article using AAS\TeX{} v6.1}
\author{Greg J. Schwarz}
\affil{American Astronomical Society \\
2000 Florida Ave., NW, Suite 300 \\
Washington, DC 20009-1231, USA}

\author{Butler Burton}
\affil{National Radio Astronomy Observatory}

\begin{abstract}
Whatever
\end{abstract}

\keywords{One, two}

\section{Test}

\lipsum[1-6]

\begin{figure}
\centering 
\subfloat[plot]{%
  \includegraphics[width=0.3\columnwidth]{example-image-a}%
  \label{plot:sval}%
}\qquad
\subfloat[plot]{%
  \includegraphics[width=0.3\columnwidth]{example-image-b}%
  \label{plot:whatever}%
}
\end{figure}

\lipsum

\end{document}

I commented apjfonts.sty because I don't have it and hypcap because it cannot work with subfig.

enter image description here

| improve this answer | |

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.