[comp.text.tex] Need help using tabular environment

jack@stevie.cs.unlv.edu (Jack Alexander) (05/31/90)

When using the tabular environment, I am having difficulty using as
much of the page as I need to.  I would like to be able to set the
left margin of the tabular environment to maximize page usage.

Any helpful hints?
				-- Jack Alexander
				jack@jimi.cs.unlv.edu

dhosek@sif.claremont.edu (Hosek, Donald A.) (05/31/90)

In article <1843@jimi.cs.unlv.edu>, jack@stevie.cs.unlv.edu (Jack Alexander) writes...
>When using the tabular environment, I am having difficulty using as
>much of the page as I need to.  I would like to be able to set the
>left margin of the tabular environment to maximize page usage.

What I teach in my LaTeX classes:


The tabular environment is normally treated as just a big letter.
For example, it's possible to get LaTeX to typeset something that
            4  1    ii
looks like 123 345 fgh in the middle of a paragraph. This is
            7  12    q
seldom actually desired, but useful to know. Where this becomes
particularly noticable is that a tabular environment in its own
paragraph is typeset with paragraph indentation, viz:

    4  1    ii
   123 345 fgh 
    7  12    q

rather than flush left as you might prefer. The best way to deal
with this problem is to define an aroundtbl environment which
will tell LaTeX how to postion the tabular. The reason for
defining an environment in this fashion is that it makes it
easier to change how the tabulars will be placed: if one simply
told LaTeX to center each tabular and then decided to typeset all
tabulars flushleft, every instance of tabular would need to be
changed. Defining the aroundtbl environment would reduce the work
to simply changing a single definition.

Using the aroundtbl environment, one would simply type something
along the lines of the following for each tabular:

\begin{aroundtbl}
\begin{tabular}{cc}
These columns & are \\
lined up      & and centered 
\end{tabular}
\end{aroundtbl}


The following definitions are three possibilities for definining
the aroundtbl environment:

\newenvironment{aroundtbl}{\begin{center}}{\end{center}}

will center each tabular.

\newenvironment{aroundtbl}{\begin{flushright}}{\end{flushright}}

will place each tabular flush against the right margin.

\newenvironment{aroundtbl}{\begin{flushleft}}{\end{flushleft}}

will place each tabular flush against the left margin.

n.b. You should never use the center, flushright, or flushleft
environments outside of the definition of a new command or
environment.


The above text is copyright 1990 by Don Hosek. It may be
distributed without charge over the Usenet network, but must not
be reproduced in another form without the prior written
permission of Don Hosek. The definitions of the aroundtbl
environment may be used freely. This text will appear in a
textbook on LaTeX to appear in late 1990/early 1991.

-dh

---
Don Hosek                         "When I was younger, I would throw
dhosek@ymir.claremont.edu          spitballs at girls that I liked. Now,
dhosek@ymir.bitnet                 I beg and plead for dates. Frankly, the
uunet!jarthur!ymir                 old way was more satisfying."