TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


share|improve this question
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Will this symbol only be used in math mode? – Herr K. Dec 9 '13 at 4:47
If you need it for annuities, look at tex.stackexchange.com/questions/140065/… – egreg Dec 9 '13 at 8:59
up vote 3 down vote accepted

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}:



\def\BX#1{\setbox\tmp=\hbox{$\overline{\scriptstyle #1}$}
              \advance\dropdist by .7pt
              \advance\height by \dp\tmp
              \lower \dropdist \hbox{\vrule height
              \height width .25pt\relax}

{\bx x+y+z\,}

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.

share|improve this answer
That's brilliant. It was indeed for typesetting an actuarial science document which I am helping out with. – user42427 Dec 9 '13 at 8:58
The rules have different widths. There are far better solutions around – egreg Dec 9 '13 at 9:00
@egreg Yes, these solutions look nicer. However, for some reason the author made such a box. With the suggested knowledge OP can seek for the best solution. And an argument only for fun: the hunting for two gold badges begun. ;-) – Przemysław Scherwentke Dec 11 '13 at 16:30

A TikZ approach.



  \tikz[baseline=(n.base)]{\node(n)[inner sep=1pt]{$#1$};
    \draw[line cap=round](n.north west)--(n.north east)--(n.south east);




enter image description here

share|improve this answer

The following takes most of the elements from the LaTeX kernel \framebox to construct a \halfbox:

enter image description here




\fbox{abc}\ \halfbox{abc}


Since it uses the same construction as \framebox, lengths \fboxrule and \fboxsep can be adjusted in the same way.

share|improve this answer
this would look nicer if there wasn't quite so much white space between the rules and the expression. – barbara beeton Dec 9 '13 at 15:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.