2

I am currently trying to type up a literature review for a class where I have to use the citation style which is relevant to my field. I would like to be able to put the citation I am talking about and the analysis of the source under it with a final bibliography at the end of the paper. Everything seems to work okay and the citations are the way I want them formatted, but at the top of my first page a list of in-text citations for all of my sources appears.

What appears to be the in-text citations.

I have seen some notes about \nocite{*}, but it doesn't seem to make any changes in my document.

\documentclass[12pt,letterpaper]{article}

% Set margins to 1.5in
\usepackage[margin=0.75in]{geometry}

% for crimson text
\usepackage{crimson}
\usepackage[T1]{fontenc}

% setup parameter indentation
\setlength{\parindent}{15pt}
\setlength{\parskip}{6pt}

% for 1.15 spacing between text
\renewcommand{\baselinestretch}{1.15}

% For defining spacing between headers
\usepackage{titlesec}
% Level 1
\titleformat{\section}
  {\normalfont\fontsize{18}{0}\bfseries}{\thesection}{1em}{}
% Level 2
\titleformat{\subsection}
  {\normalfont\fontsize{14}{0}\bfseries}{\thesection}{1em}{}
% Level 3
\titleformat{\subsubsection}
  {\normalfont\fontsize{12}{0}\bfseries}{\thesection}{1em}{}
% Level 4
\titleformat{\paragraph}
  {\normalfont\fontsize{12}{0}\bfseries\itshape}{\theparagraph}{1em}{}
% Level 5
\titleformat{\subparagraph}
  {\normalfont\fontsize{12}{0}\itshape}{\theparagraph}{1em}{}
% Level 6
\makeatletter
\newcounter{subsubparagraph}[subparagraph]
\renewcommand\thesubsubparagraph{%
  \thesubparagraph.\@arabic\c@subsubparagraph}
\newcommand\subsubparagraph{%
  \@startsection{subsubparagraph}    % counter
    {6}                              % level
    {\parindent}                     % indent
    {12pt} % beforeskip
    {6pt}                           % afterskip
    {\normalfont\fontsize{12}{0}}}
\newcommand\l@subsubparagraph{\@dottedtocline{6}{10em}{5em}}
\newcommand{\subsubparagraphmark}[1]{}
\makeatother
\titlespacing*{\section}{0pt}{12pt}{6pt}
\titlespacing*{\subsection}{0pt}{12pt}{6pt}
\titlespacing*{\subsubsection}{0pt}{12pt}{6pt}
\titlespacing*{\paragraph}{0pt}{12pt}{6pt}
\titlespacing*{\subparagraph}{0pt}{12pt}{6pt}
\titlespacing*{\subsubparagraph}{0pt}{12pt}{6pt}

% Set caption to correct size and location
\usepackage[tableposition=top, figureposition=bottom, font=footnotesize, labelfont=bf]{caption}

% set page number location
\usepackage{fancyhdr}
\fancyhf{} % clear all header and footers
\renewcommand{\headrulewidth}{0pt} % remove the header rule
\rhead{\thepage}
\pagestyle{fancy}

% Overwrite Title
\makeatletter
\renewcommand{\maketitle}{\bgroup
   \begin{center}
   \textbf{{\fontsize{18pt}{20}\selectfont \@title}}\\
   \vspace{10pt}
   {\fontsize{12pt}{0}\selectfont \@author} 
   \end{center}
}
\makeatother

% For full citations inline
\usepackage{bibentry}
\nobibliography*

% For making hanging indents under citations
\usepackage{hanging}
\newcommand\hangbibentry[1]{%
    \smallskip\par\hangpara{1em}{1}\bibentry{#1}\smallskip\par %{indent}{afterline}
}

% For indenting the first paragraph of every line
\usepackage{indentfirst}

% For use of astron citation package
\usepackage{natbib} 

\begin{document}

\thispagestyle{fancy}


\subsection*{\hangbibentry{Soderblom2010TheStars}}

This source outlines the various methods astrophysicists utilize to estimate the ages of stars.

\bibliographystyle{astron}
\bibliography{mnemonic.bib,bib.bib}

\end{document}

The citation for this article is this:

@article{Soderblom2010TheStars,
    title = "The Ages of Stars",
    year = "2010",
    journal = aar,
    author = "Soderblom, David R.",
    month = "3",
    volume = "48",
    pages = "581--629",
    url = "http://arxiv.org/abs/1003.6074 http://dx.doi.org/10.1146/annurev-astro-081309-130806",
    doi = "10.1146/annurev-astro-081309-130806",
}

I have one warning which says this:

Package Fancyhdr Warning: \headheight is too small (12.0pt): Make it at least 14.49998pt. We now make it that large for the rest of the document. This may cause the page layout to be inconsistent, however.

And two errors which say this:

Undefined control sequence.

The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.

Learn more

<argument> \protect \astroncite 
                                {Soderblom}{2010}
l.3 ...te{Soderblom}{2010}]{Soderblom2010TheStars}
                                               The control sequence at the end of the top line of your error message was never

\def'ed. If you have misspelled it (e.g., \hobx'), typeI' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.

LaTeX Error: Missing \begin{document}.

No \begin{document} command was found. Make sure you have included \begin{document} in your preamble, and that your main document is set correctly.

Learn more See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help.

...

l.3 ...te{Soderblom}{2010}]{Soderblom2010TheStars}
                                               You're in trouble here.  Try typing  <return>  to proceed. If that doesn't work, type  X

to quit.

I am currently using Overleaf.

  • 5
    Welcome to TeX.SE! Can you please make your code snippets compilable? Then we do not have to guess what you are doing ... – Mensch Mar 6 at 7:13
  • Unfortunately, it is quite challenging to figure out exactly what you are doing and what goes wrong from only the code snippets shown so far. The gold standard for code examples is the so-called MWE (tex.meta.stackexchange.com/q/228/35864). An MWE is a full document that starts with \documentclass, contains the relevant bits and pieces of the preamble (ideally only what is relevant for the issue, if the title formats are not relevant they can be dropped for the MWE) and has a \begin{document}...\end{document} so that it can be compiled to a PDF that reproduces what you see. – moewe Mar 6 at 8:34
  • @moewe I'm not sure which parts of the code are relevant for the error, I borrowed a template and altered it to better fit the format of the paper I was looking to make. I change the code snippet I posted so it will recreate the problem on a smaller scale as long as all the appropriate astron packages are in the tex files as well. Does the updated code help? – Erica Mar 12 at 1:44
  • I can trace this back to an unexpected clash between natbib and bibentry. gist.github.com/moewew/c94fa5387b5a2f31e76826aea37efc72 No idea how to solve it though... – moewe Mar 12 at 6:27
1

The first error \headheight is too small (12.0pt): Make it at least 14.49998pt. you get because your created header via fancyhdr is bigger than the currently used 12pt. So simply add

\setlength{\headheight}{15pt}

to your preamble to get rid of it.

The first error message you get <argument> \protect \astroncite results from the usage of astron.bst and astron.sty, which contains the lines:

\def\cite{\@ifstar{\citeyear}{\citefull}}
\def\citefull{\def\astroncite##1##2{##1, ##2}\@internalcite}
\def\citeyear{\def\astroncite##1##2{##2}\@internalcite} 

This file is rather old and I do not know it, but using for example

\bibliographystyle{plainnat}

let me use bibentry and natbib without errors you can test with the following MWE

\begin{filecontents*}{mybib.bib}
@article{Soderblom2010TheStars,
    title = "The Ages of Stars",
    year = "2010",
    journal = aar,
    author = "Soderblom, David R.",
    month = "3",
    volume = "48",
    pages = "581--629",
    url = "http://arxiv.org/abs/1003.6074 http://dx.doi.org/10.1146/annurev-astro-081309-130806",
    doi = "10.1146/annurev-astro-081309-130806",
}
\end{filecontents*}


\documentclass{article}

\usepackage{bibentry}
\nobibliography*

\usepackage{natbib} 


\begin{document}
text
%\bibentry{Soderblom2010TheStars}
\subsection*{\bibentry{Soderblom2010TheStars}}
text

\bibliographystyle{plainnat} % plain astron
\bibliography{mybib}
\end{document}

Please see that I deleted extention .bib in the call for the bibliography.

The result is then (nothing done for breaking urls, just ignore this please):

enter image description here

For me the main question now is can you omit using the outdated astron.bst or has it to be used in a special class I do not know? If possible just omit it or make a bug report to the maintainer of that style/journal.

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.