[comp.lang.apl] TeX Puzzle II

c3ar@zaphod.uchicago.edu (Walter C3arlip) (10/03/90)

Since I got such fine suggestions for my last TeX problem, I thought I'd
post another.  I posted a similar question a few years ago and got no help!
I'm writing up a proof that requires some manipulation of generators of an
algebraic system.  The proof requires long expressions that get regrouped
in various ways, and in looking at one expression grouped in two different
ways.  I would like to use braces above and below the expression to
identify the groupings.  Something like this:

               p           q 
         |-----------||-----------|
      abcdefgaaaabbbbccccdefghabecde
      |-----||----------||---------|
         x        y          z

where the "|-------|" represent braces.  (This would indicate something
like "xyz = abcpqe".  Done in this way, the proof becomes much more
visual--which really helps for this sort of calculation.)

While I have been able to put the braces on top *or* the braces on the
bottom *or* braces on top and bottom as long as they don't overlap,
the particular configuration I need has eluded me for several years now.

Any suggestions would be received with delight!

Thanks,

--Walter
_____________________________________________________________________________
Walter Carlip 				**** c3ar@finite.chi.il.us ****
(the "3" is invisible)    **** c3ar%finite.chi.il.us@gargoyle.uchicago.edu ****
_____________________________________________________________________________



_____________________________________________________________________________
Walter Carlip 				**** c3ar@finite.chi.il.us ****
(the "3" is invisible)    **** c3ar%finite.chi.il.us@gargoyle.uchicago.edu ****
_____________________________________________________________________________

duchier@cs.yale.edu (Denys Duchier) (10/04/90)

In article <1990Oct3.024630.6222@midway.uchicago.edu> c3ar@zaphod.uchicago.edu (Walter C3arlip) writes:
 >   ways.  I would like to use braces above and below the expression to
 >   identify the groupings.  Something like this:
 >
 >		  p           q 
 >	    |-----------||-----------|
 >	 abcdefgaaaabbbbccccdefghabecde
 >	 |-----||----------||---------|
 >	    x        y          z
 >
 >   where the "|-------|" represent braces.  (This would indicate something
 >   like "xyz = abcpqe".

There is a trivial solution if you are willing to use a fixed-width
font such as \tt (otherwise, you can use the same technique, but the
specifications become more cumbersome, e.g. you might have to specify
the actual substring rather than just the number of characters).

\documentstyle{article}
\begin{document}
%%
%% define new length \foo to be as wide as a letter in \tt.
%%
\newlength{\foo}
\settowidth{\foo}{\tt a}
%%
%% \O{N}{LABEL} starts an overbrace which extends over the next N
%% characters and has LABEL stacked on top.
%%
\def\O#1#2{\hbox to0pt{$\overbrace
  {\hbox{\strut\hskip#1\foo}}^{\hbox{\tt#2}}$\hss}}
%%
%% \U{N}{LABEL} similarly for an underbrace
%%
\def\U#1#2{\hbox to0pt{$\underbrace
  {\hbox{\strut\hskip#1\foo}}_{\hbox{\tt#2}}$\hss}}
%%
%% Now your example
%%
\begin{center}
  \tt \leavevmode
  \U{7}{x}abc\O{13}{p}defg\U{12}{y}aaaabbbbc\O{13}{q}ccc\U{11}{z}defghabecde
\end{center}
\end{document}

--Denys

ews@CS.Stanford.EDU (Ed Sznyter) (10/04/90)

|> I would like to use braces above and below the expression to
|> identify the groupings.  Something like this:
|> 
|>                p           q 
|>          |-----------||-----------|
|>       abcdefgaaaabbbbccccdefghabecde
|>       |-----||----------||---------|
|>          x        y          z
|> 
|> where the "|-------|" represent braces.  (This would indicate something
|> like "xyz = abcpqe".  Done in this way, the proof becomes much more
|> visual--which really helps for this sort of calculation.)

Too easy. Try

\halign{&#\cr
&\downbracefill\span\omit&\downbracefill\span\omit\cr
abc&defg&aaaabbbbc&ccc&defghabecde\cr
\upbracefill\span\omit&\upbracefill\span\omit&\upbracefill\cr}

----------------
	Ed Sznyter
	Distributed Systems Group
	ews@dsg.stanford.edu