1

Dear Stackexchange users,

I want to write my thesis with lualatex and as I'm using lualatex I want to use to packages build around it. But I stumpled upon a strange effect: I wanted to redefine the partial-Operator to be upright. So I wrote a renewcommand-line. But if I try to compile the following document

\documentclass{article}

\usepackage{fontspec}
\usepackage{unicode-math}
\AtBeginDocument{\setmathfont{Latin Modern Math}}
\usepackage{polyglossia}
\setdefaultlanguage{english}

\AtBeginDocument{\renewcommand{\partial}{\symup{\partial}}}

\begin{document}

$\partial \symup{\partial}$

\end{document}

I get the following eror

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

and there is no output pdf produced. Has anyone any idea why this happens?

Regards Jakob

PS: The \AtBeginDocument has to be infront of the renewcommand as otherwise the renewcommand does not have any effect. The explanation for this behaviour is (see explanation:

unicode-math waits until \begin{document} to setup the default font and the default definitions.
  • \AtBeginDocument{\let\oldpartial\partial\renewcommand{\partial}{\symup{\oldpartial}}} – moewe May 14 '18 at 15:56
  • 1
    \renewcommand{\partial}{...\partial ...} is defining an infinite loop. – David Carlisle May 14 '18 at 15:59
  • Macro redefinitions that include the macro itself in the definition need to be made with the \let\old... trick, because otherwise TeX ends up in an infinite loop. \renewcommand{\partial}{\symup{\partial}} tells TeX to replace every occurrence of \partial with \symup{\partial}. But then there is a new \partial and so that is replaced with \symup{\partial}, etc, etc. See also https://tex.stackexchange.com/q/47351/35864 – moewe May 14 '18 at 15:59
  • Thanks for the fast response. I'll keep that in mind for future documents. – JakobJakobson13 May 14 '18 at 16:12

1 Answers1

1

There is no need to renewcommand the command. unicode-math has an option to change the symbol:

\documentclass{article}

\usepackage{unicode-math}
\usepackage[english]{babel}
\unimathsetup {partial=upright}

\begin{document}

$\partial \symup{\partial}$

\end{document}

enter image description here

Ulrike Fischer
  • 327,261