There seems to be a clash between hyperref and accents. Reduced MWE:

\subsection{Estimate on $\tilde{\alpha}$}

Commenting out either of \usepackage{accents} and \usepackage{hyperref} removes the error (but does not solve the problem).

I am trying to use accents package in my document and when I include


to my original document, I got an error as

! TeX capacity exceeded, sorry [input stack size=5000]. \HyPsd@@LetCommand l.205 \begin{lemma}
! ==> Fatal error occurred, no output PDF file produced!

I tried to open a fresh document and copied the initial parts (up to \begin{document}).
I am including \usepackage{accents} to same line as in my original document and there is no error.

I don't really know what to include here but I can provide any information that might be useful.

Let me add;
End of Log File

LaTeX Font Info:    External font `lmex10' loaded for size
(Font)              <10> on input line 7.
LaTeX Font Info:    External font `lmex10' loaded for size
(Font)              <7> on input line 7.
\openout6 = `epsilon_closeloop.toc'.

LaTeX Font Info:    Try loading font information for T1+lmtt on input line 187.

File: t1lmtt.fd 2009/10/30 v1.6 Font defs for Latin Modern
! TeX capacity exceeded, sorry [input stack size=5000].
<to be read again> 
l.205 \begin{lemma}

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:
 15098 strings out of 494923
 238621 string characters out of 6180741
 684258 words of memory out of 5000000
 18040 multiletter control sequences out of 15000+600000
 54559 words of font info for 52 fonts, out of 8000000 for 9000
 175 hyphenation exceptions out of 8191
 5000i,18n,8735p,922b,742s stack positions out of 5000i,500n,10000p,200000b,80000s
!  ==> Fatal error occurred, no output PDF file produced! 

Lemma part

\subsection{Estimate on $\mc{W}_2(\mu_t^{N,\a,\t\a},\bar{\mu}_t^{N,\a})$}

    \frac{1}{N}\sum_j |X_t^{N,\a,\t\a,j} - \bar{X}_t^{N,\a,j}|^2 \leq
    \delta^2 + \int_0^t \mc{W}_2^2(\mu_s^{N,\a,\t\a},\mu_s^\a)  

Lemma part End

Full Preamble







\usepackage{mathtools} %%used for \usetagform{roman}


\usepackage{amsthm} % for proof environment.




\usepackage{showlabels}%For writing purposes. Comment at the end.



\newcommand{\ind}[1]{{\bf 1}_{\left\{ {#1} \right\}} }
%% \newcommand{\an}{\{a_n\}_{n=0}^{\infty}}

%% \DeclareMathOperator{\csch}{csch}


%% Stochastic Specific
\def\b{\overline} % First defined for bar.
\def\ub{\underline} %First defined for underbar, however underbar
                    %converts to text mode!

%% \newcommand{\ub}[1]{\underaccent{\bar}{#1}} %%Requires accents package.


\title{Close Loop}

\newtheorem{theorem}{Theorem} %%included in init
\newtheorem{lemma}{Lemma} %%included in init

\newtheorem{definition}{Definition} %%included in init
\newtheorem{note}{Note} %%included in init
\newtheorem{example}{Example} %%included in init 
\newtheorem{assumption}{Assumption} %%included in init

Full Preamble

  • 2
    Welcome! Can you perhaps try to share the log file of the run that causes an error? Or just try to produce a minimal document where you do as you describe above but also add the lemma and the stuff right before the lemma?
    – user194703
    Dec 29 '19 at 1:58
  • It fails on \subsection{Estimate on $\mc{W}_2(\mu_t^{N,\a,\t\a},\bar{\mu}_t^{N,\a})$}.
    – Jo'
    Dec 29 '19 at 2:49
  • 1
    You can reduce the problematic example to \documentclass{article} \usepackage{accents} \usepackage{hyperref} \begin{document} \subsection{Estimate on $\tilde{\alpha}$} \end{document}. Dropping either \usepackage{accents} or \usepackage{hyperref} makes the error go away (but does of course not solve the problem). I will edit your question by adding this MWE at the beginning but you can of course reverse the edit (yet I think it will be cleaner to remove everything else, at least temporarily).
    – user194703
    Dec 29 '19 at 3:06
  • 1
    I stop after this comment. Workaround: \documentclass{article} \usepackage{hyperref} \let\oldtilde\tilde \usepackage{accents} \begin{document} \subsection{Estimate on $\oldtilde{\alpha}$} \end{document}. So you could add \let\t\tilde before loading \usepackage{accents} and remove \def\t{\tilde} from your document. This should remove this error. Having said this, I would like to discourage you from defining one-letter macros in the way you do.
    – user194703
    Dec 29 '19 at 3:22
  • 2
    It is a bad idea to do \def\a, \def\t, \def\b, \def\h, etc. You should initialize one letter macros with \newcommand and if that gives errors because they're already defined, don't redefine them, they are most likely needed for font/input specific stuff.
    – Skillmon
    Dec 29 '19 at 8:00

Aside from the problematic redefinition of \a, \t and \b, and the misplaced \usepackage{hyperref} and \usepackage{showlabels} (hyperref should be the last package in the preamble in general, but there are some exceptions, like showlabels which must be loaded after hyperref).

To still use the definitions of accents (because I guess that's what you want, when you load it), but have a functional hyperref with the macros of accents in captions, section headings, etc. you have to make sure that hyperref doesn't use the macros it can't handle to create bookmarks. This can be done on a manual basis with \texorpdfstring, but I'd suggest setting up rules directly for the offending macros so that you don't have to care for them later. For this hyperref provides the \pdfstringdefDisableCommands macro, which we use to locally redefine \tilde and \bar, so that for PDF-bookmarks the standard version is used, but for the rest of your document the versions provided by accents.

(In the following I removed everything that isn't directly related to the problem at hand)




\usepackage{showlabels}%For writing purposes. Comment at the end.


%% Stochastic Specific

\title{Close Loop}
\author{Melih Iseri}

\subsection{Estimate on $\mc{W}_2(\mu_t^{N,\alpha,\tilde{\alpha}},\bar{\mu}_t^{N,\alpha})$}

Note that while this does solve the problem and makes your document at least compilable, it's still best to manually clean bookmarks using \texorpdfstring, e.g., instead of

\section{Some section $\alpha$}


\section{\texorpdfstring{Some section $\alpha$}{Some section a}}
  • Is it ok to define them as \let\olda\a \renewcommand\a{\alpha} Notations are messy and one letter definitions are a great simplification. Thank you.
    – Jo'
    Dec 29 '19 at 23:49
  • @Jo' no, that's not ok, as that doesn't set up anything that tells the internals to use \olda instead of \a when \a would be used. I'd suggest you check whether your editor of choice allows to create shortcuts (e.g., in my VIM, if I type `a this becomes \alpha).
    – Skillmon
    Dec 30 '19 at 9:50

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.