5

I am having a hard time figuring out where the problem is with my code/workflow. I previously posted this question here, but then the same problem came straight back. When I run it in tex, I get an error input limit exceeded. The exact log is pasted below:

This is pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9.6210 64-bit) (preloaded format=pdflatex 2017.1.26)  26 JAN 2017 20:45
entering extended mode
**./master.tex
(master.tex
LaTeX2e <2016/03/31> patch level 3
Babel <3.9r> and hyphenation patterns for 75 language(s) loaded.
("C:\Program Files\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex\latex\base\size11.clo"
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
("C:\Program Files\MiKTeX 2.9\tex\latex\apacite\apacite.sty"
Package: apacite 2013/07/21 v6.03 APA citation
\c@BibCnt=\count87
\bibleftmargin=\skip43
\bibindent=\skip44
\bibparsep=\skip45
\bibitemsep=\skip46
\biblabelsep=\skip47
)
No file master.aux.
\openout1 = `master.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
\c@maskedRefs=\count88
("C:\Program Files\MiKTeX 2.9\tex\latex\apacite\english.apc"
File: english.apc 2013/07/21 v6.03 apacite language file
LaTeX Info: Redefining \BPBI on input line 129.
LaTeX Info: Redefining \BHBI on input line 130.
)
! TeX capacity exceeded, sorry [input stack size=5000].
\AtBeginDocument #1->#1

l.5 \begin{document}

If you really absolutely need more capacity,
you can ask a wizard to enlarge me.


Here is how much of TeX's memory you used:
 641 strings out of 493333
 7639 string characters out of 3139188
 74825 words of memory out of 3000000
 4254 multiletter control sequences out of 15000+200000
 3940 words of font info for 15 fonts, out of 3000000 for 9000
 1141 hyphenation exceptions out of 8191
 5000i,0n,4998p,136b,36s stack positions out of 5000i,500n,10000p,200000b,50000s
!  ==> Fatal error occurred, no output PDF file produced!

I previously posted this question and thought I solved it but am having the same problem again.

The latex code I am trying to execute is below:

\documentclass[11pt,twoside]{article}
\usepackage{apacite}
\nocite{*}

\begin{document}


% title page. Edit as needed for future publications. 
\title{Research Proposal}
\author{Teererai Marange \\
Department of Computer Science \\
University of Auckland\\
\texttt{t.marange@auckland.ac.nz}}
\date{January 26, 2017}
\maketitle
% end title page. 


% abstract goes here
\newpage
\begin{abstract}
Abstract goes here 
\end{abstract}
\newpage


% table of contents 
\tableofcontents
\newpage


%begin introduction 
\section {Introduction}
Lorem Ipsum Doremifaso 

%\cite{Nedakeyword} use to cite 



%references our biliography. This must go whereever we use our bibtex references

\bibliography{references}
\bibliographystyle{apacite}


\end{document}

and the bib file that I am using to build the bibliography is below:

@misc{wikipedia1,
  title = "Scripting language",
  author = "Wikipedia",
  url = {http://en.wikipedia.org/wiki/Scripting_language},
  year = 2014,
}
  • 1
    You should update your previous question instead of adding a new one. – Andrew Swann Jan 26 '17 at 7:58
  • So does this mean I need to change the previous answer ie. code and log file since this is a problem that I've encountered in different code. – Teererai Marange Jan 26 '17 at 7:59
  • 1
    \nocite{*} command should be in the document environment, right? – Jérôme Dequeker Jan 26 '17 at 8:00
  • 3
    In general, for next time yes, edit an existing question, but as I've answered here, I've voted to close the previous one as duplicate of this now. – David Carlisle Jan 26 '17 at 8:02
  • 1
    I filed a bug report to the maintainer of apacite.sty. – egreg Jan 26 '17 at 12:10
9

You get the error with just

\documentclass[11pt,twoside]{article}
\usepackage{apacite}

\nocite{*}
\begin{document}



\end{document}

moving no cite avoids it

\documentclass[11pt,twoside]{article}
\usepackage{apacite}


\begin{document}
\nocite{*}




\end{document}
5

With the standard setup, \nocite{*} before \begin{document} would raise an error. The apacite style modifies \nocite so as to make it usable also in the preamble (which is not unreasonable) but it uses the wrong test for it.

Indeed the code for \nocite tests whether \document has become equivalent to \@onlypreamble, which means the document has started, and in this case it does the normal job; otherwise it issues \AtBeginDocument{\nocite{...}} (the argument is the same as the one of \nocite. However, when the tokens for \AtBeginDocument are executed, \document hasn't yet become equivalent to \@preamble. Which means that \nocite{*} will do \AtBeginDocument{\nocite{*}}, which… Infinite loop, because at that moment \AtBeginDocument is define to simply deliver its argument.

A fix for the code can be to execute \AtBeginDocument only if \AtBeginDocument has not become equivalent to \@firstofone.

\begin{filecontents*}{\jobname.bib}
@misc{wikipedia1,
  title = "Scripting language",
  author = "Wikipedia",
  url = {http://en.wikipedia.org/wiki/Scripting_language},
  year = 2014,
}
\end{filecontents*}

\documentclass[11pt,twoside]{article}
\usepackage{apacite}
\usepackage{etoolbox}

\makeatletter
\patchcmd{\nocite}
  {\AtBeginDocument{\nocite{#1}}}
  {\ifx\AtBeginDocument\@firstofone\else\AtBeginDocument{\nocite{#1}}\fi}
  {}{}
\makeatother

\nocite{*}

\begin{document}

% title page. Edit as needed for future publications. 
\title{Research Proposal}
\author{Teererai Marange \\
Department of Computer Science \\
University of Auckland\\
\texttt{t.marange@auckland.ac.nz}}
\date{January 26, 2017}
\maketitle
% end title page. 

% abstract goes here
\newpage
\begin{abstract}
Abstract goes here 
\end{abstract}
\newpage


% table of contents 
\tableofcontents
\newpage


%begin introduction 
\section {Introduction}
Lorem Ipsum Doremifaso 

%\cite{Nedakeyword} use to cite 



%references our biliography. This must go whereever we use our bibtex references

\bibliography{\jobname}
\bibliographystyle{apacite}


\end{document}

Of course, it is simpler to move \nocite{*} after \begin{document}. However, this might be fixed in the code for apacite.

Note that this patch won't work if multibbl is loaded. For that it would be much more complex, because the redefinition of \nocite is done at begin document.

I filed a bug report to the maintainer of apacite.sty.

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.