[comp.text] Underbraces in LaTeX

ertem@polya.Stanford.EDU (Tuna Ertemalp) (01/16/89)

Hi,

While I was preparing a handout for Logic students, I had two write
the following formula with the underbraces (consider lines as
undebraces, it is difficult to simulate them using characters):

((P --> Q) v (P -->R)) --> (P --> (Q & R))
                                   -   -
                                   F   T
                            -     -------
                            T        F
----------------------     ---------------
          T                       F

Using,

$\underbrace{((P \rightarrow Q) \vee (P \rightarrow R))}_{T}
\rightarrow \underbrace{(\underbrace{P}_{T} \rightarrow 
\underbrace{(\underbrace{Q}_{F} \wedge \underbrace{R}_{T})}_{F})}_{F}$

I get,

((P --> Q) v (P -->R)) --> (P --> (Q & R))
----------------------      -      -   -
           T                T      F   T
                                  -------
                                     F
                           ---------------
                                  F

as  expected (note the  difference between the  "heights" of the first
two underbraces of the result and my  intent).  Is there any trick (or
something I  missed  in the book)   which  could  make it  possible to
specify the "height"   of   the underbrace   with respect   to   other
underbraces, or have unvisible underbraces?

-- 
| Mr. Tuna Ertemalp        | Mailbox #659            | Small things together |
| Stanford University      | Crothers Memorial Hall  |   form the quality,   |
| Computer Science MS      | Stanford, CA 94305, USA | But quality is not a  |
| Ertem@Polya.Stanford.Edu | (415) 328-8515          |     small thing!      |

dlau@cs.utexas.edu (David Lau) (01/16/89)

In a previous article, ertem@polya.Stanford.EDU (Tuna Ertemalp) wrote:

>>                                          ....  Is there any trick (or
>>something I  missed  in the book)   which  could  make it  possible to
>>specify the "height"   of   the underbrace   with respect   to   other
>>underbraces, or have unvisible underbraces?

The trick is you have to fool TeX into thinking that both sides of the
logical expressions have the same depth:

\newsavebox{\lhs}\newsavebox{\rhs}%
\sbox{\rhs}{$(\underbrace{Q}_F \wedge \underbrace{R}_T)$}%
\sbox{\lhs}{$P$}%
\dp\lhs=\dp\rhs % <-- fake box depth
\sbox{\rhs}{$(\underbrace{\usebox{\lhs}}_T\rightarrow\underbrace{\usebox{\rhs}}_F)$}%
\sbox{\lhs}{$((P\rightarrow Q) \vee (P\rightarrow R))$}%
\dp\lhs=\dp\rhs % <-- same as before
$\underbrace{\usebox{\lhs}}_T\rightarrow\underbrace{\usebox{\rhs}}_F$


--David (dlau@cs.utexas.edu)