1

I have a problem when using the below code I got an error

TeX capacity exceeded, sorry [input stack size=5000]. \begin

I searched and I found another question here. It is a similar issue but did not solve my problem.

Code:

\documentclass{clv3}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{mathtools}
\usepackage[dvipsnames, table]{xcolor}
\usepackage[hyphens]{url}
\usepackage{fontspec}
\usepackage{hyperref}
\hypersetup{colorlinks=true,citecolor=darkblue, linkcolor=darkblue, urlcolor=darkblue}
\usepackage[font=footnotesize]{caption}
\usepackage{tipa}
\input{preamble_tikz.tex}
\input{figures/pgfplot_configurations.tex}

\let\numdef\relax%@@@Fix conflict with @polyglossia
\usepackage{forest}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{arabic}
\newfontfamily\arabicfont[Script=Arabic]{Amiri}
\setmainfont[Scale=0.925]{heuristica}
\usepackage{bidipoem}
\newcommand*\samethanks[1][\value{footnote}]{\footnotemark[#1]}
\begin{document}



\author{author1}\thanks{thank1}}
\affil{aff1}
%%%
\author{author2\thanks{thank2}%
\thanks{thank3}}
\affil{aff2}
%%%
\author{author3\thanks{thank3}%
\samethanks[3]}
\affil{aff3}
%%%
\author{author4\thanks{thank4}%
\samethanks[3]}
\affil{aff4}%%%%
%%%%%%%
\author{author5\thanks{thank5}%
\samethanks[5]}
\affil{aff5}

\title{XYX}
\maketitle
\end{document}

The problem could be fixed in the below cases

  1. Remove \usepackage{hyperref} but the links will not work.
  2. Remove \maketitle command.

After some searching, I found it could be a conflict because hyperref redefined \maketitle and bidi does the same. But I can't figure out how to fix that.

enter image description here

2

1 Answer 1

1

The problem is with bidi that gets confused with the nonstandard definition of \maketitle.

If you don't plan to use Arabic in the header, you can fix the issue by saving and restoring the meaning of \maketitle (actually the copy maintained by hyperref).

\documentclass{clv3}
%\documentclass{article}

\let\numdef\relax

\usepackage{polyglossia}
\usepackage{fontspec}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{mathtools}
\usepackage[dvipsnames, table]{xcolor}
\usepackage[hyphens]{url}
\usepackage[font=footnotesize]{caption}
\usepackage{tipa}
\usepackage{bidipoem}
\usepackage{forest}
\usepackage{hyperref}

\makeatletter
\let\clvHyOrg@maketitle\HyOrg@maketitle
\makeatother

\hypersetup{colorlinks=true,citecolor=darkblue, linkcolor=darkblue, urlcolor=darkblue}

%\input{preamble_tikz.tex}
%\input{figures/pgfplot_configurations.tex}

\setmainlanguage{english}
\setotherlanguage{arabic}
\newfontfamily\arabicfont[Script=Arabic]{Amiri}
\setmainfont[Scale=0.925]{heuristica}

\makeatletter
\AtBeginDocument{\let\HyOrg@maketitle\clvHyOrg@maketitle}
\makeatother


\begin{document}

\title{XYZ}

\maketitle

\end{document}

I have also reorganized the preamble to be more consistent.

7
  • I am using Arabic and Poem in my code. What do you recommend? Commented Dec 2, 2019 at 21:03
  • @MoustafaMahmoud Also in the title?
    – egreg
    Commented Dec 2, 2019 at 21:03
  • No inside the text only the title doesn’t contain Arabic Commented Dec 2, 2019 at 21:04
  • @MoustafaMahmoud Then you shouldn't worry; the “fix” just affects the data needed for \maketitle.
    – egreg
    Commented Dec 2, 2019 at 21:05
  • Thanks for your reply, I will try it and feedback soon Commented Dec 2, 2019 at 21:06

You must log in to answer this question.

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