Text Formatting ⇒ Citations in \subsection{}
-
- Posts: 4
- Joined: Thu Apr 16, 2009 9:45 pm
Citations in \subsection{}
I am using texniccenter and miktex. When trying something like
\subsection{sectionheading \cite{andrews2007}}
I get a fatal error and the document does not compile. Is this to be expected?
Thanks,
M
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
-
- Posts: 707
- Joined: Tue Mar 25, 2008 5:02 pm
Re: Citations in \subsection{}
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Citations in \subsection{}
It's not about the \cite command but more about the moving argument of the \subsection command.kaiserkarl13 wrote:The \cite command is robust, so you shouldn't have any problems. [...]
The reason is the argument as described above. Use the short form to avoid difficulties.mornington wrote:[...] When trying something like
\subsection{sectionheading \cite{andrews2007}}
I get a fatal error and the document does not compile. [...]
Code: Select all
\subsection[subsection heading]{subsection heading \cite{andrews2007}}
Best regards
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 707
- Joined: Tue Mar 25, 2008 5:02 pm
Citations in \subsection{}
The short form will work (and it's what I'd do here, too, since citations in the ToC look tacky), but the \cite command should work in a floating argument too (that's what I meant by robust). Try the following example:The reason is the argument as described above. Use the short form to avoid difficulties.
Code: Select all
\documentclass{article}\begin{document}\tableofcontents\section{First section}Here's an early citation: \cite{anyone}.\subsection{Howdy~\cite{someone}}\begin{thebibliography}{2}\bibitem{anyone}Anyone else\bibitem{someone}Someone, I. M.\end{thebibliography}\end{document}
However, your first post indicated that TeX was crashing because of this---that shouldn't be happening, and probably means \cite has been redefined in some (non-robust) way. Some package you're using this could do that, but I don't know of any off the top of my head that redefine \cite to be non-robust.
-
- Posts: 4
- Joined: Thu Apr 16, 2009 9:45 pm
Citations in \subsection{}
I usually use a preamble file to keep my most used declarations, so the \usepackage are in two batches with (possible) duplicate inclusions:
1. from preamble.tex
Code: Select all
\usepackage{amsmath,amsfonts,amssymb,mathrsfs,theorem}\usepackage{multicol,multirow,calc,achicago,graphicx,color,colortab,rotating,enumerate}\usepackage{pstricks,psfrag,tabularx,comment,hyperref}\usepackage{boxedminipage}\usepackage{bbm}\usepackage{hyperref}
Code: Select all
\documentclass[a4paper]{article}\input{preamble.tex}% Graphics\usepackage{graphics}\usepackage{graphicx}\usepackage{pstricks}%Tables\usepackage{booktabs}\usepackage{lscape}\usepackage{bbold}\usepackage{natbib}\def\newblock{\hskip .11em plus .33em minus .07em}\usepackage{url}\usepackage{citeref}\citestyle{authoryear}
M
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Citations in \subsection{}
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10