Document Classesemulateapj | Cross-references Issue

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
communist_goatboy
Posts: 3
Joined: Wed May 02, 2012 10:15 pm

emulateapj | Cross-references Issue

Post by communist_goatboy »

Hello, I am having troubles with the emulateapj class not properly rendering cross-references. My example.

Code: Select all

\documentclass[english]{emulateapj}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{babel}
\begin{document}
\begin{abstract}
An abstract, title, and author are needed in order to render correctly.
\end{abstract}

\title{Title!}
\author{Onius Autorus}
\maketitle

\section{Section1\label{sec:Section1}}
Here is section 1! You should read Section \ref{sec:Section2}!\\

\section{Section2\label{sec:Section2}}
This is section 2! Go read Section \ref{sec:Section1}!\\
\end{document}
renders as (reformatted for readability)
MY TITLE!
Onius Autorus

Abstract
An abstract, title, and author are needed in order to render correctly.

1. SECTION1
Here is section 1! You should read Section ??!

2. SECTION2
This is section 2! Go read Section ??!
As you can see, neither "forward" nor "backward" references are working. I know the particular version of this class works in general, as I have seen many documents that have used it.

Is there something blatantly obvious that I am missing?

Many thanks for your help.

- Tim

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

emulateapj | Cross-references Issue

Post by localghost »

It works for me (apart from some warnings) when I pull out the \label commands from the \section arguments.

Code: Select all

\documentclass[english]{emulateapj}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}

\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}

\begin{document}
  \title{Title!}
  \author{Onius Autorus}

  \begin{abstract}
    An abstract, title, and author are needed in order to render correctly.
  \end{abstract}

  \maketitle

  \section{Section1}\label{sec:Section1}
    Here is section 1! You should read Section \ref{sec:Section2}!\\

  \section{Section2}\label{sec:Section2}
    This is section 2! Go read Section \ref{sec:Section1}!\\
\end{document}

Thorsten
communist_goatboy
Posts: 3
Joined: Wed May 02, 2012 10:15 pm

emulateapj | Cross-references Issue

Post by communist_goatboy »

While that fixed my issue, I feel a bit unsettled by it. Is it generally the case that you are not allowed to put a \label inside of a \section? It has worked for me in the past with other document classes.


Thanks again.
- Tim
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: emulateapj | Cross-references Issue

Post by localghost »

I don't know why it doesn't work here. It could depend on the class. Lamport confirms in his book that although fragile, the command should work in captions as well as in heading arguments. Perhaps somebody else can explain better.
Post Reply