I would like to use underset and overset together above and below the word. Current output looks like this:


enter image description here

I would like both the superset and the underset to be placed exactly above and below the max.


2 Answers 2


Welcome to TeX.SE! As egreg pointed out in the comments, you can achieve what you want using \max_{i=1}^{N}, like so:

\usepackage{amsmath} % Only for the equation* environment

    v_t(j) = \max_{i=1}^{N}v_{t-1}(i)a_{ij}b_j(o_t)

  • This is exactly what I tried to use, and jupyter lab still rendered overset and underset symbols to the right of the sum symbol (in my case), so I had to use \overset{N}{\underset{i=1}\sum}
    – ruslaniv
    Mar 30, 2021 at 9:41
  • If you want to define a new operator, like avg you can use: \DeclareMathOperator*{\avg}{avg}. The asterisk (*) is needed for the subscript to work properly
    – xdola
    Jan 10, 2022 at 16:40

Here is maybe an easier fix yet - just nest overset in underset, or the other way around, as in:

v_t(j)=\overset{N}{ \underset{i=1}{max}} \hspace{0.1cm} v_{t-1}(i)a_{ij}b_j(o_t)
  • 3
    Welcome! I'm not sure how this can be easier than \max_{i=1}^N
    – egreg
    Dec 28, 2020 at 21:36
  • \max_{i=1}^N is not rendered the same in all libraries. In Katex, for instance, it could be rendered to the right. So this solution here works. – Note: The hack to render above and below constantly with Katex is to use: \max \limits_{i=1}^N
    – Avatar
    Sep 10, 2021 at 19:49

You must log in to answer this question.

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