COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

How to put a box of frame around paragraph which is inside a tabular ?

• Email
• Follow

Hello;

I am using tabular, because that worked best for what I do, better
than tabularx (I use Latex2html to export to HTML later on, and
tabular works better with latex2html).

I am able to make paragraphs inside table, add enumeration lists,
and such, and all of this is working fine.

I wanted to see if I can also put a box or frame around
each 'cell' in the table to make the table looks nicer.

So that each cell in the table will have a complete frame
around it, separate from each other cell's frame.

But all my attempts failed. Below is what I tried. It seems
fbox works, but only when its argument is simple text, but nothing
advanced liked enumeration or paragraph. I tried to make each cell
as minipage and put frame around the minipage, but not working, errors,
or I am not doing it right.

Any idea if such a thing is possible?

thanks

----------------------------------------
\documentclass{article}%
\usepackage{enumerate}
\usepackage{html}
\begin{document}
\begin{tabular}{  p{2in} p{2in} p{2in}}

\parbox{4in}{  %------- does not work
first column
}

&

\fbox{second column}  %------ this works

&

fbox{   %------------------- this does not work
\begin{enumerate}
\item A
\item B
\end{enumerate}
}

\end{tabular}
\end{document}
--------------------------

--Nasser

 0

See related articles to this posting

I thought to show what I'd like it to look like.

Running this:

----------------------
\documentclass{article}%
\usepackage{enumerate}
\usepackage{html}

\begin{document}
\begin{center}
my table
\end{center}

\begin{tabular}{  p{2in} p{2in} p{2in}}
\fbox{A} & \fbox{B} & \fbox{C}\\
\fbox{A2} & \fbox{B2} & \fbox{C2}
\end{tabular}

\end{document}
----------------------

Will produce something like what I want. But again, the above
works only with the argument to fbox is simple text, and
nothing more complicated.

If you want to see the output of the above, here is a screen shot
from my output:

http://12000.org/tmp/march_21_2011/table.png

Thanks
--Nasser

On 3/21/2011 4:41 AM, Nasser M. Abbasi wrote:
>
> Hello;
>
> I am using tabular, because that worked best for what I do, better
> than tabularx (I use Latex2html to export to HTML later on, and
> tabular works better with latex2html).
>
> I am able to make paragraphs inside table, add enumeration lists,
> and such, and all of this is working fine.
>
> I wanted to see if I can also put a box or frame around
> each 'cell' in the table to make the table looks nicer.
>
> So that each cell in the table will have a complete frame
> around it, separate from each other cell's frame.
>
> But all my attempts failed. Below is what I tried. It seems
> fbox works, but only when its argument is simple text, but nothing
> advanced liked enumeration or paragraph. I tried to make each cell
> as minipage and put frame around the minipage, but not working, errors,
> or I am not doing it right.
>
> Any idea if such a thing is possible?
>
> thanks
>
> ----------------------------------------
> \documentclass{article}%
> \usepackage{enumerate}
> \usepackage{html}
> \begin{document}
> \begin{tabular}{  p{2in} p{2in} p{2in}}
>
> \parbox{4in}{  %------- does not work
> first column
> }
>
> &
>
> \fbox{second column}  %------ this works
>
> &
>
> fbox{   %------------------- this does not work
> \begin{enumerate}
> \item A
> \item B
> \end{enumerate}
> }
>
> \end{tabular}
> \end{document}
> --------------------------
>
> --Nasser


 0

Le 21/03/2011 12:41, Nasser M. Abbasi a �crit :
>
> Hello;
>
> I am using tabular, because that worked best for what I do, better
> than tabularx (I use Latex2html to export to HTML later on, and
> tabular works better with latex2html).
>
> I am able to make paragraphs inside table, add enumeration lists,
> and such, and all of this is working fine.
>
> I wanted to see if I can also put a box or frame around
> each 'cell' in the table to make the table looks nicer.

I'm convinced it will look uglier than ever ! because your frames
will be of different sizes in each cell.

> So that each cell in the table will have a complete frame
> around it, separate from each other cell's frame.
>
> But all my attempts failed. Below is what I tried. It seems
> fbox works, but only when its argument is simple text, but nothing
> advanced liked enumeration or paragraph. I tried to make each cell
> as minipage and put frame around the minipage, but not working, errors,
> or I am not doing it right.

Normal: \fbox is \hbox and cannot not contain vertical material.

> Any idea if such a thing is possible?

Yes: but it's not a "regular preamble" if you permit.

\documentclass{article}
\usepackage {enumerate}
\usepackage {array}
\usepackage {xcolor}

\begin{document}

\begin{tabular}{|  *3{>{\begin{lrbox}0} m{1.5in}

<{\end{lrbox}\indent\hfill\copy0\hfill
\llap{\boxframe{1.5in}

{\dimexpr\ht0+2mm}

{\dimexpr\dp0+2mm}} } | }}
\hline
A & B & C           \\
A2 & B2 & \vbox{\advance\hsize -\tabcolsep\begin{itemize}
\item one
\item two
\end{itemize}} \\ \hline
\end{tabular}

\end{document}\endinput


 0

On 3/21/2011 5:53 AM, GL wrote:

>
> Yes: but it's not a "regular preamble" if you permit.
>
> \documentclass{article}
> \usepackage {enumerate}
> \usepackage {array}
> \usepackage {xcolor}
>
> \begin{document}
>
> \begin{tabular}{|  *3{>{\begin{lrbox}0} m{1.5in}
>
> <{\end{lrbox}\indent\hfill\copy0\hfill
>                                                   \llap{\boxframe{1.5in}
>
> {\dimexpr\ht0+2mm}
>
> {\dimexpr\dp0+2mm}} } | }}
>                \hline
> A&  B&  C           \\
>                               \item one
>                               \item two
>                           \end{itemize}} \\ \hline
> \end{tabular}
>
> \end{document}\endinput
>

Thanks.

I am a newbie in Latex, but I made sure I copied the above
OK, and I get an error when I run it on my linux box:

---------------------
$latex index.tex This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian) restricted \write18 enabled. entering extended mode (./index.tex LaTeX2e <2009/09/24> ...... (/usr/share/texmf-texlive/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texmf-texlive/tex/latex/base/size10.clo)) (/usr/share/texmf-texlive/tex/latex/tools/enumerate.sty) (/usr/share/texmf-texlive/tex/latex/tools/array.sty) (/usr/share/texmf/tex/latex/xcolor/xcolor.sty (/etc/texmf/tex/latex/config/color.cfg) (/usr/share/texmf-texlive/tex/latex/graphics/dvips.def)) (./index.aux) Runaway argument? {| *3{>{\begin {lrbox}0} m{1.5in} ! Paragraph ended before \@@array was complete. <to be read again> \par l.9 ? ------------------ This is the code again, I copied it from my latex file to make sure ------------------------------ \documentclass{article} \usepackage {enumerate} \usepackage {array} \usepackage {xcolor} \begin{document} \begin{tabular}{| *3{>{\begin{lrbox}0} m{1.5in} <{\end{lrbox}\indent\hfill\copy0\hfill\llap{\boxframe{1.5in} {\dimexpr\ht0+2mm} {\dimexpr\dp0+2mm}} } | }} \hline A & B & C \\ A2 & B2 & \vbox{\advance\hsize -\tabcolsep\begin{itemize} \item one \item two \end{itemize}} \\ \hline \end{tabular} \end{document} -------------------------- (Tried with or without the \endinput you had there at the end, no difference).$ which latex
/usr/bin/latex
$latex -v pdfTeX 3.1415926-1.40.10-2.2 (TeX Live 2009/Debian) --Nasser   0 Reply Nasser 3/21/2011 2:41:53 PM Le 21/03/2011 15:41, Nasser M. Abbasi a �crit : > On 3/21/2011 5:53 AM, GL wrote: > Runaway argument? > {| *3{>{\begin {lrbox}0} m{1.5in} > ! Paragraph ended before \@@array was complete. > <to be read again> > \par > l.9 > ? Yes of course, this is TeX standard mechanism. You copied wrong: the preamble must not contain \par and a blank line is equivalent to \par. Thus make sure the preamble is one single paragraph in the sense of TeX, ie: there are no \par nor blank lines in it. TeXnically, the error means: I stop because the argument of \@@array contains \par and should not because \@@array is not a long macro. For example : \begin{tabular} {l\par l} \end{tabular} leads to the same error. > > ------------------ > > This is the code again, I copied it from my latex file > to make sure > > ------------------------------ > \documentclass{article} > \usepackage {enumerate} > \usepackage {array} > \usepackage {xcolor} > > \begin{document} > > \begin{tabular}{| *3{>{\begin{lrbox}0} m{1.5in} > > <{\end{lrbox}\indent\hfill\copy0\hfill\llap{\boxframe{1.5in} > > {\dimexpr\ht0+2mm} > > {\dimexpr\dp0+2mm}} } | }} > \hline > A & B & C \\ > A2 & B2 & \vbox{\advance\hsize -\tabcolsep\begin{itemize} > \item one > \item two > \end{itemize}} \\ > \hline > \end{tabular} > > \end{document} > -------------------------- > > (Tried with or without the \endinput you had there at the > end, no difference). > >$ which latex
> /usr/bin/latex
> $latex -v > pdfTeX 3.1415926-1.40.10-2.2 (TeX Live 2009/Debian) > > > --Nasser   0 Reply GL 3/21/2011 3:12:27 PM GL wrote: > Le 21/03/2011 15:41, Nasser M. Abbasi a �crit : >> On 3/21/2011 5:53 AM, GL wrote: >> Runaway argument? >> {| *3{>{\begin {lrbox}0} m{1.5in} >> ! Paragraph ended before \@@array was complete. >> <to be read again> >> \par >> l.9 >> ? > > > Yes of course, this is TeX standard mechanism. You copied wrong: > the preamble must not contain \par and a blank line is equivalent > to \par. > > Thus make sure the preamble is one single paragraph in the sense > of TeX, ie: there are no \par nor blank lines in it. > > TeXnically, the error means: I stop because the argument of \@@array > contains \par and should not because \@@array is not a long macro. > > For example : > \begin{tabular} {l\par l} \end{tabular} > leads to the same error. > > seems to be a problem with the news reader, mine also showed your code with blank lines within the vital parts of the code. > > > > >> >> ------------------ >> >> This is the code again, I copied it from my latex file >> to make sure >> >> ------------------------------ >> \documentclass{article} >> \usepackage {enumerate} >> \usepackage {array} >> \usepackage {xcolor} >> >> \begin{document} >> >> \begin{tabular}{| *3{>{\begin{lrbox}0} m{1.5in} >> >> <{\end{lrbox}\indent\hfill\copy0\hfill\llap{\boxframe{1.5in} >> >> {\dimexpr\ht0+2mm} >> >> {\dimexpr\dp0+2mm}} } | }} >> \hline >> A & B & C \\ >> A2 & B2 & \vbox{\advance\hsize -\tabcolsep\begin{itemize} >> \item one >> \item two >> \end{itemize}} \\ >> \hline >> \end{tabular} >> >> \end{document} >> -------------------------- >> >> (Tried with or without the \endinput you had there at the >> end, no difference). >> >>$ which latex
>> /usr/bin/latex
>> \$ latex -v
>> pdfTeX 3.1415926-1.40.10-2.2 (TeX Live 2009/Debian)
>>
>>
>> --Nasser
>

--

/daleif (remove RTFSIGNATURE from email address)

Memoir and mh bundle maintainer
LaTeX FAQ:      http://www.tex.ac.uk/faq
LaTeX book:     http://www.imf.au.dk/system/latex/bog/  (in Danish)
Remember to post minimal examples, see URL below
http://www.minimalbeispiel.de/mini-en.html

 0

Le 21/03/2011 16:27, Lars Madsen a �crit :
> GL wrote:
>> Le 21/03/2011 15:41, Nasser M. Abbasi a �crit :
>>> On 3/21/2011 5:53 AM, GL wrote:
>>> Runaway argument?
>>> {| *3{>{\begin {lrbox}0} m{1.5in}
>>> ! Paragraph ended before \@@array was complete.
>>> \par
>>> l.9
>>> ?
>>
>>
>> Yes of course, this is TeX standard mechanism. You copied wrong:
>> the preamble must not contain \par and a blank line is equivalent
>> to \par.
>>
>> Thus make sure the preamble is one single paragraph in the sense
>> of TeX, ie: there are no \par nor blank lines in it.
>>
>> TeXnically, the error means: I stop because the argument of \@@array
>> contains \par and should not because \@@array is not a long macro.
>>
>> For example :
>> \begin{tabular} {l\par l} \end{tabular}
>> leads to the same error.
>>
>>
>
> seems to be a problem with the news reader, mine also showed your code
> with blank lines within the vital parts of the code.

I only copied-pasted from my text editor without much care.

Such like "runaway argument" / "Paragraph ended before ... was complete"
and \@ -> you can't \spacefactor in vertical / math mode must be known
soon or later by any user.

Yours sincerely.

 0

On 21/03/11 11:41, Nasser M. Abbasi wrote:
>
> Hello;
>
> I am using tabular, because that worked best for what I do, better
> than tabularx (I use Latex2html to export to HTML later on, and
> tabular works better with latex2html).
>
> I am able to make paragraphs inside table, add enumeration lists,
> and such, and all of this is working fine.
>
> I wanted to see if I can also put a box or frame around
> each 'cell' in the table to make the table looks nicer.
>
> So that each cell in the table will have a complete frame
> around it, separate from each other cell's frame.

If you can ignore the error messages at the end of each cell...

\documentclass{article}
\usepackage{fancybox,array,lipsum}
\usepackage[margin=2cm]{geometry}
\begin{document}
\begin{tabular}{*3{>{\begin{Sbox}\vbox to6cm\bgroup
\hsize4cm\tiny\raggedright\arraybackslash}l<{\egroup
\end{Sbox}\fbox{\TheSbox}}}c}
\lipsum[1]&\lipsum[2]&\lipsum[3]&\\[\tabcolsep]
\lipsum[4]&\lipsum[5]&\lipsum[6]&\\[\tabcolsep]
\lipsum[7]&\lipsum[8]&\lipsum[9]&\\[\tabcolsep]
\end{tabular}
\end{document}

///Peter

 0

7 Replies
691 Views

Similar Articles

11/30/2013 1:46:43 AM
page loaded in 33727 ms. (0)