A fairly general facility.
Note the type=\mathpunct for undersetting the comma; try without it and you'll see that the spacing is wrong. The \underset and \overset commands are only able to recognize relations or operators, not other math atoms.
By default, \pointer uses text mode for the annotation, but one can use the key math to turn into math mode (see the examples).
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[italian]{babel}
\usepackage{amsmath,mathtools}
\ExplSyntaxOn
\NewDocumentCommand{\pointer}{O{}mm}
{% #1 = options, #2 = text of pointer, #3 = symbol
\sebastiano_pointer:nnn {#1} {#2} {#3}
}
\keys_define:nn { sebastiano/pointer }
{
up .bool_set:N = \l__sebastiano_pointer_up_bool,
up .default:n = true,
down .bool_set_inverse:N = \l__sebastiano_pointer_up_bool,
down .default:n = true,
width .dim_set:N = \l__sebastiano_pointer_width_dim,
width .initial:n = 0pt,
type .tl_set:N = \l__sebastiano_pointer_type_tl,
math .bool_set:N = \l__sebastiano_pointer_math_bool,
math .default:n = true,
}
\cs_new_protected:Nn \sebastiano_pointer:nnn
{
\group_begin:
\keys_set:nn { sebastiano/pointer } {#1}
\bool_if:NTF \l__sebastiano_pointer_up_bool
{
\__sebastiano_pointer_up:nn {#2} {#3}
}
{
\__sebastiano_pointer_down:nn {#2} {#3}
}
\group_end:
}
\cs_new_protected:Nn \__sebastiano_pointer_up:nn
{
\tl_if_blank:VTF \l__sebastiano_pointer_type_tl
{
\__sebastiano_pointer_up_aux:nn {#1} {#2}
}
{
\tl_use:N \l__sebastiano_pointer_type_tl { \__sebastiano_pointer_up_aux:nn {#1} {#2} }
}
}
\cs_new_protected:Nn \__sebastiano_pointer_up_aux:nn
{
\underset
{
\mathmakebox[\l__sebastiano_pointer_width_dim][c]
{
\substack
{
\uparrow \\
\bool_if:NTF \l__sebastiano_pointer_math_bool
{ #1 }
{ \__sebastiano_pointer_text:n {#1} }
}
}
}{#2}
}
\cs_new_protected:Nn \__sebastiano_pointer_down:nn
{
\tl_if_blank:VTF \l__sebastiano_pointer_type_tl
{
\__sebastiano_pointer_down_aux:nn {#1} {#2}
}
{
\tl_use:N \l__sebastiano_pointer_type_tl { \__sebastiano_pointer_down_aux:nn {#1} {#2} }
}
}
\cs_new_protected:Nn \__sebastiano_pointer_down_aux:nn
{
\overset
{
\mathmakebox[\l__sebastiano_pointer_width_dim][c]
{
\substack
{
\bool_if:NTF \l__sebastiano_pointer_math_bool
{ #1 }
{ \__sebastiano_pointer_text:n {#1} }
\\
\downarrow
}
}
}{#2}
}
\cs_new_protected:Nn \__sebastiano_pointer_text:n
{
\fontsize{\use:c{sf@size}}{\fp_eval:n {1.2*\use:c{sf@size}}}\normalfont
\begin{tabular}{@{}c@{}}#1\end{tabular}
}
\ExplSyntaxOff
\begin{document}
\[
(-\infty\pointer[up,type=\mathpunct,math]{\frac{\pi}{2n}}{,} a]
\text{ oppure }
[a\pointer[up,type=\mathpunct]{$\frac{\pi}{2n}$}{,}+\infty)
\]
Ora in $x\in(-\infty,a]$, la funzione $f_n(x)$ è crescente
($k=0$) in $(-\pi/2n,\pi/2n)$, decrescente altrove, se
\[
-\infty < \pointer[up]{punto di \\ massimo}{\frac{\pi}{2n}} < a
\]
allora
\[
\sup_{\substack{(-\infty,a]\\ \frac {\pi}{2n}<a}} f_n(x)
\pointer[down,width=2em]{relazione \\ fondamentale}{=} f_n(c_n)=1/n^2
\]
e qui si ha uniforme convergenza
\end{document}

\mathclapfrom mathtools to hide them.