2

I have been using

\newcommand{\lrscript}[3]{\raisebox{.5ex}{\llap{\scriptsize$#2$}}#1\raisebox{.5ex}{\rlap{\scriptsize$#3$}}}

to produce the middle segment of things like this:

\begin{array}{c}[\Gamma]\\lrscript{\vdots}{\pi}{\exists\text{-free}}\\hline\phi\end{array}

Produced with

\[
\begin{array}{c}
[\Gamma]\\
\lrscript{\vdots}{\pi}{\exists\text{-free}}\\
\hline
\phi
\end{array}
\]

which uses the amsmath package.

It works fine most of the time but I prefer to avoid manually raising boxes when I can, so I keep wondering if there is a smarter way to reach this kind of horizontal and vertical alignment. (Note that this command is often deeply nested in more complex constructs.)

2
  • 1
    Can you please show a use case of your macro? – egreg Jul 16 '13 at 15:22
  • @egreg: I added the code I used to generate the example. – François G. Dorais Jul 16 '13 at 15:52
2

You can exploit \vcenter:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\lrscript}[3]{%
  \vcenter{\llap{$\scriptstyle\mathstrut#2$}}
  \vcenter{\hbox{$#1$}}
  \vcenter{\rlap{$\scriptstyle\mathstrut#3$}}
}
\makeatletter % Hendrik Vogt (https://tex.stackexchange.com/a/4827)
\def\vcdots{\vbox{\baselineskip4\p@ \lineskiplimit\z@
    \kern3\p@\hbox{.}\hbox{.}\hbox{.}\kern3\p@}}
\makeatother

\newcommand{\existsfree}{\exists\text{-free}}

\begin{document}
$\begin{array}{c}
[\Gamma] \\
\lrscript{\vcdots}{\pi}{\existsfree} \\
\hline
\phi
\end{array}$
\end{document}

The macro \vcdots for better vertical dots is by Hendrik Vogt

enter image description here

2
  • Neat! Is there a \vbottom too? – François G. Dorais Jul 16 '13 at 16:03
  • @FrançoisG.Dorais It's \vbox. – egreg Jul 16 '13 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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