Saturday, October 20, 2018

Corner Quotes in LaTeX

I'm posting this just because I had a hard time, today, finding the original source for a macro I've been using for a while in LaTeX. The macro in question typesets 'corner quotes', such as:
⌜A ∧ B⌝
The corners themselves are not hard to create, since LaTeX has \ulcorner and \urcorner macros. That will usually work fine, but there are issues involving the height and spacing of the corners that can arise in some cases. A macro due to Sam Buss solves these problems. (I discovered it here.) I've put the macro in a style file, godelnum.sty, which you can download here. Here's the contents:
\newbox\gnBoxA
\newdimen\gnCornerHgt
\setbox\gnBoxA=\hbox{$\ulcorner$}
\global\gnCornerHgt=\ht\gnBoxA
\newdimen\gnArgHgt


\def\Godelnum #1{%
       \setbox\gnBoxA=\hbox{$#1$}%
       \gnArgHgt=\ht\gnBoxA%
       \ifnum \gnArgHgt<\gnCornerHgt
               \gnArgHgt=0pt%
       \else
               \advance \gnArgHgt by -\gnCornerHgt%
       \fi
       \raise\gnArgHgt\hbox{$\ulcorner$} \box\gnBoxA %
               \raise\gnArgHgt\hbox{$\urcorner$}}
Usage is just: \Godelnum{A \wedge B}, and the like. Note that one can do this outside math, since the macro inserts $s around the argument. (Probably \ensuremath would be better.)

No comments:

Post a Comment

Comments welcome, but they are expected to be civil.
Please don't bother spamming me. I'm only going to delete it.