[Tex/LaTex] Bar over/under integral symbol

math-modesymbols

I try to typeset bar over/under integral symbol with

\overline\int,\underline\int

But the line looks too long, any solution?

Best Answer

This should do (not in script styles)

\documentclass{article}

\makeatletter
\newcommand\tint{\mathop{\mathpalette\tb@int{t}}\!\int}
\newcommand\bint{\mathop{\mathpalette\tb@int{b}}\!\int}
\newcommand\tb@int[2]{%
  \sbox\z@{$\m@th#1\int$}%
  \if#2t%
    \rlap{\hbox to\wd\z@{%
      \hfil
      \vrule width .35em height \dimexpr\ht\z@+1.4pt\relax depth -\dimexpr\ht\z@+1pt\relax
      \kern.05em % a small correction on the top
    }}
  \else
    \rlap{\hbox to\wd\z@{%
      \vrule width .35em height -\dimexpr\dp\z@+1pt\relax depth \dimexpr\dp\z@+1.4pt\relax
      \hfil
    }}
  \fi
}
\makeatother

\begin{document}
\[
\tint_a^b f(t)\,dt=\bint_a^b f(t)\,dt
\textstyle
\tint_a^b f(t)\,dt=\bint_a^b f(t)\,dt
\]
\end{document}

enter image description here