[Tex/LaTex] How to Produce a Half-Box Symbol

boxes

Does anyone know how to produce a half-box symbol in LaTeX which comprises a bar over an entire expression and a vertical line on the right meeting in the corner, like the top and the right edge of a box?

I currently use \overline{abc}\vert as a compromise (say, abc is the text I wish to enclose) but clearly the bar and the vertical line do not meet each other in the top-right corner.

Thanks

Best Answer

You probably want an actuarial symbol annuity. One of the solutions is the following macro, taken from ftp://ftp.mackichan.com/swandswp30/support/actuarial.tex,‎ with the usage {\bx argument}:

\documentclass{article}


\begin{document}

\newbox\tmp
\newdimen\height
\newdimen\dropdist
\def\BX#1{\setbox\tmp=\hbox{$\overline{\scriptstyle #1}$}
              \height=\ht\tmp
              \dropdist=\dp\tmp
              \advance\dropdist by .7pt
              \advance\height by \dp\tmp
              \box\tmp
              \lower \dropdist \hbox{\vrule height
              \height width .25pt\relax}
              \ifnum0=`{\else}\fi
}
\def\bx{\expandafter\BX\expandafter{\ifnum0=`}\fi}

\[
{\bx x+y+z\,}
\]
\end{document}

enter image description here

If it will not be used in such a context, some modifications are needed, in particular remowing \scriptstyle before an argument.

Related Question