Use different math font in inline-style and display-style formulas for \int symbol

displaystylemath-fontsmath-modemathabx

I have seen Use different math font in inline-style and display-style formulas, but here I just want one symbol to be different inline vs display. In Borrowing the integral and summation signs from mathabx package, we are taught how to use the integral symbol in the mathabx package, but what if I want to use the standard integral sign in inline TeX, i.e. \textstyle, but the mathabx integral in \displaystyle? I don't want two different commands that produce each respective symbol, but instead just one command \int that changes its behavior based on the context in which it is called.

Best Answer

I'm not a fan of mixing glyphs from different fonts, but here you go...

\documentclass{article}

\usepackage{amsmath} % for \ilimits@

\DeclareFontFamily{U}{mathx}{\hyphenchar\font45}
\DeclareFontShape{U}{mathx}{m}{n}{<->mathx10}{}
\DeclareFontSubstitution{U}{mathx}{m}{n}

\DeclareSymbolFont{mathx}{U}{mathx}{m}{n}
\DeclareMathSymbol{\mathxintop}{\mathop}{mathx}{"B3}

\makeatletter
\renewcommand*{\int}{\DOTSI\mathop{\mathchoice{\mathxintop}{\intop}{\intop}{\intop}}\ilimits@}
\makeatother

\begin{document}

See $\int$ and $\displaystyle\int_{\int_{\int}}$

\end{document}

enter image description here

Related Question