7

In my documents, I define \argmin with the following command.

\DeclareMathOperator*{\argmin}{arg\,min}

IMO, the subscript (in display mode) is too far from the operator (because of the depth of the "g" presumably). I am trying to find a way to "smash" the \argmin command so that the subscript can be typeset closer. I tried naively \smashing the command but this results in the subscript no longer being typeset below the operator.

MWE:

\documentclass{minimal}

\usepackage{amsmath}

\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator*{\arfmin}{arf\,min}

\begin{document}

\[\argmin_\gamma \gamma^2\]  % the subscript is too low
\[\arfmin_\gamma \gamma^2\]  % the subscript is in the right place

\end{document}
3
  • 2
    Don't use minimal for examples. It's not meant for such jobs.
    – egreg
    Commented May 7 at 8:40
  • My bad — I'll stick to article. But what is minimal meant for?
    – inavda
    Commented May 7 at 9:05
  • 1
    It's for experimenting class options.
    – egreg
    Commented May 7 at 9:10

2 Answers 2

7

You need to reinstate \operator@font inside \smash, which uses the standard math fonts.

\documentclass{article}

\usepackage{amsmath}

\makeatletter
\DeclareMathOperator*{\argmin}{\smash[b]{\operator@font arg\,min}}
\makeatother

\begin{document}

\[\argmin_\gamma \gamma^2 \quad \min_\gamma \gamma^2\]

\end{document}

enter image description here

If you're bold, you could patch \smash so that it keeps track of the current math group.

\documentclass{article}

\usepackage{amsmath}
\usepackage{xpatch}

\makeatletter
\xpatchcmd{\smash}{\ifmmode}{\ifmmode\count@=\fam}{}{}
\xpatchcmd{\mathsm@sh}{\m@th}{\m@th\fam=\count@}{}{}
\makeatother

\DeclareMathOperator*{\argmin}{\smash[b]{arg\,min}}

\begin{document}

\[\argmin_\gamma \gamma^2 \quad \min_\gamma \gamma^2\]

\end{document}

On the other hand, this might lead to bad output, so I recommend you not to do this: look at the following picture to know why.

enter image description here

6

Perhhaps this? Smash just the g and make sure it is presented as text (roman) rather than math (italic).

EDITED per the advice of campa to use \mathrm instead of \text and of barbara to \smash only the bottom, using the [b] option (see comments below).

\documentclass{minimal}

\usepackage{amsmath}

\DeclareMathOperator*{\argmin}{ar\smash[b]{\mathrm{g}}\,min}
\DeclareMathOperator*{\arfmin}{arf\,min}

\begin{document}

\[\argmin_\gamma \gamma^2\]  % the subscript is too low
\[\arfmin_\gamma \gamma^2\]  % the subscript is in the right place

\end{document}

enter image description here

3
  • 5
    Better would be to smash just the bottom: \smash[b]{...}; this is described in the amsmath user guide (texdoc amsldoc) in section 4.13 (page 17). Commented May 7 at 2:05
  • These are actually operators which in TeX terminology have limits, is it correct mathematically to call them subscripts?
    – yannisl
    Commented May 7 at 7:06
  • 2
    +1 but please use \mathrm instead of \text. Your current definition e.g. in a thereom with italic font will have bad consequences...
    – campa
    Commented May 7 at 8:02

You must log in to answer this question.

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