\begin{figure}
\hfill\parbox{\linewidth}{\begin{tabbing}
< text for tabbing >
\end{tabbing}}\hfill
\caption{< caption text >}
\end{figure}
In order to avoid typing "\hfill\parbox ..." each time, I would prefer to
make an evironment, say `ctabbing', and write:
\begin{figure}
\begin{ctabbing}
< text for tabbing >
\end{ctabbing}
\caption{< caption text >}
\end{figure}
The problem is in how to put the left brace in the envrionments `begin'
code and the right one in the `end' code. I thought that \begingroup and
\endgroup would work. So:
\newenvironment{ctabbing}%
{\hfill\parbox{\textwidth}\begingroup\begin{tabbing}}
{\end{tabbing}\endgroup\hfill}
However, I get the following error message when running LaTeX:
! Extra }, or forgotten \endgroup.
\@iparbox ...{\hsize #2\@parboxrestore #3}
\if@pboxsw $\fi
\prog ...\parbox {\textwidth }\begingroup
\begin {tabbing}
l.142 \begin{ctabbing}
How should I implement what I want to do? (Note: what I want to do is
somewhat more complicated than described above, but I have left out those
parts that don't contribute in the problem.)
Could you mail me your reactions directly? I will summarize to the newsgroup
if there is enough interest. Thank you.
Sabih H. Gerez, University of Twente, Faculty of Electr. Engineering (EL-BSC),
P.O. Box 217, 7500 AE Enschede, The Netherlands. Tel.: X-31-53-893156.
Fax.: X-31-53-340045. E-mail: sa...@nt.el.utwente.nl
Alternative: sabih%thtel...@hp4nl.nluug.nl (...!hp4nl.nluug.nl!thtel!sabih)
> I want to center text created by the `tabbing' environment in LaTeX, for
> the purpose of putting it in a figure. It cannot be centered directly,
> but putting this text in a `parbox' seems to help. I can e.g. write:
>
> \begin{figure}
> \hfill\parbox{\linewidth}{\begin{tabbing}
> < text for tabbing >
> \end{tabbing}}\hfill
> \caption{< caption text >}
> \end{figure}
>
> In order to avoid typing "\hfill\parbox ..." each time, I would prefer to
> make an evironment, say `ctabbing', and write:
>
> \begin{figure}
> \begin{ctabbing}
> < text for tabbing >
> \end{ctabbing}
> \caption{< caption text >}
> \end{figure}
>
> The problem is in how to put the left brace in the envrionments `begin'
> code and the right one in the `end' code. I thought that \begingroup and
> \endgroup would work. So:
>
> \newenvironment{ctabbing}%
> {\hfill\parbox{\textwidth}\begingroup\begin{tabbing}}
> {\end{tabbing}\endgroup\hfill}
>
> [ ... ]
I would try to skip the \parbox and use minipage, I would also drop
the \hfill and replace it by center, or \centering:
Try:
\newenvironment{ctabbing}%
{\begin{center}\begin{minipage}{\textwidth}\begin{tabbing}}
{\end{tabbing}\end{minipage}\end{center}}
If you drop the \begin{center} .. \end{center} in the new environment,
I think that you must place the \centering outside the environment and
write:
\begin{figure}\centering
\begin{ctabbing}
<text>
\end{ctabbing}
\end{figure}
I should say that I have not try to compile any text with these
commands defined, but I can not see any problems with the combination.
Bj{\o}rn
--
______________________________________________________________________
s-mail: e-mail:
| | | Bjorn B. Larsen bjorn.b...@delab.sintef.no
|__ |__ | SINTEF DELAB
| \| \| N-7034 TRONDHEIM tel: +47-7-592682 / 592600
|__/|__/|_ NORWAY fax: +47-7-591039 / 594302
______________________________________________________________________
.> {\end{tabbing}\end{minipage}\end{center}}
.>
.>
.>I should say that I have not try to compile any text with these
.>commands defined, but I can not see any problems with the combination.
[I personally am mildly irritated by folks who propose solutions, but
then can't take the time to test them. As one who primarily uses
LaTeX to write with and does not like to change things and has never
had time to read thoroughly the manual, it is frustrating to have
to figure out something simple like this. If you're taking the
time to give the world an answer, how about taking the time to
check your work! Thanks. ]
--Martin Davis
--
Davis, Jr., Martin H.
Georgia Institute of Technology, Atlanta Georgia, 30332
uucp: ...!{allegra,amd,hplabs,seismo,ut-ngp}!gatech!prism!gt4589b
ARPA: gt4...@prism.gatech.edu
>Try:
> \newenvironment{ctabbing}%
> {\begin{center}\begin{minipage}{\textwidth}\begin{tabbing}}%
> {\end{tabbing}\end{minipage}\end{center}}
The solution above works. However, what I actually want to do is somewhat
more complicated. I would like to put the whole centered tabbing
environment in a framebox. How do I proceed if I want to put the opening
brace '{' of \fbox in the begin code of ctabbing and the closing brace '}'
in the end code? I did not manage to make it work with the commands
\begingroup or \bgroup and \endgroup, \endgroup.