3

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

\documentclass{article}
\usepackage{accents}
\usepackage{hyperref}
\begin{document}
\subsection{Estimate on $\tilde{\alpha}$}
\end{document}

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

\usepackage{accents}

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

(./epsilon_closeloop.toc
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.
)
\tf@toc=\write6
\openout6 = `epsilon_closeloop.toc'.

 [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]
LaTeX Font Info:    Try loading font information for T1+lmtt on input line 187.

 (/usr/share/texmf/tex/latex/lm/t1lmtt.fd
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> 
                   \HyPsd@@LetCommand 
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})$}

\begin{lemma}  
  \begin{equation}  
    \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)  
  \end{equation}  
\end{lemma}  

Lemma part End

Full Preamble

\documentclass[reqno]{amsart}


\usepackage[utf8]{inputenc}

\usepackage[T1]{fontenc}

\usepackage{xcolor}

\usepackage{accents}

\usepackage{lmodern}

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

\usepackage{hyperref}
\hypersetup{%
  colorlinks=true,%
  linkcolor=teal,%
  urlcolor=teal%
}%


\usepackage{amsmath}
\numberwithin{equation}{section}
\usepackage{amsthm} % for proof environment.
\usepackage{amssymb}

\usepackage{graphicx}

\usepackage{float}

\usepackage[backend=biber]{biblatex}

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

\usepackage[left=1.2in,right=1.2in,top=1in,bottom=1in]{geometry}

\makeatletter
\newcommand{\leqnomode}{\tagsleft@true}
\newcommand{\reqnomode}{\tagsleft@false}
\makeatother

\newcommand{\weak}{\Rightarrow}
\newcommand{\ind}[1]{{\bf 1}_{\left\{ {#1} \right\}} }
\newcommand{\mb}[1]{\mathbb{#1}}
\newcommand{\mc}[1]{\mathcal{#1}}
%% \newcommand{\an}{\{a_n\}_{n=0}^{\infty}}

%% \DeclareMathOperator{\csch}{csch}

\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator{\Id}{Id}
\DeclareMathOperator*{\esssup}{ess\,sup}
\DeclareMathOperator*{\supp}{supp}


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

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


\newtagform{roman}[\renewcommand{\theequation}{\roman{equation}}]()

\title{Close Loop}
\date{\today}

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

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

Full Preamble

7
  • 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 at 8:00

1 Answer 1

3

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)

\documentclass[reqno]{amsart}

\let\preAccentstilde\tilde
\let\preAccentsbar\bar
\usepackage{accents}

\usepackage{hyperref}
\pdfstringdefDisableCommands
  {%
    \let\tilde\preAccentstilde
    \let\bar\preAccentsbar
  }

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

\newcommand{\mc}[1]{\mathcal{#1}}


%% Stochastic Specific
\newcommand\h{\hat}

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

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

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$}

use

\section{\texorpdfstring{Some section $\alpha$}{Some section a}}
2
  • 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, 2019 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, 2019 at 9:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .