# How to color text and fill cells with color in a table/subtable environment

I have a question related to making posters using LaTeX. I am using the following website for the poster. Everything is OK, but I am stuck at a point where I want to insert 2 tables next to each other. After googling, I discovered how to do it (using subtables).

However, I get a bunch of errors (see below) when I compile it. I think that my table code is fine (see below), but I don't know why I get that error. I can live with these errors as they don't affect the final output.

(/usr/share/texmf-texlive/tex/latex/amsfonts/umsb.fd)
! Undefined control sequence.
<argument>  \subtable
{ \begin {tabular}{|c|c|c|} \par \multicolumn {3}{c}{\...
l.226  }

?
! Missing $inserted. <inserted text>$
l.226  }

?
! Extra }, or forgotten $. <template> \unskip \hfil } \hskip \tabcolsep \hskip -.5\arrayrulewidth \vrule... l.226 } ? ! Missing$ inserted.
<inserted text>
$l.226 } ? ! Missing } inserted. <inserted text> } l.226 } My main problem is after inserting the tables, I want to color the cells. To this end, I am using xcolor package, but somehow: • it fails to provide the colors • it gives me errors Basically, I want to: • color letters • fill cells of tables with different colors (I got the commands from the xcolor manual) Can any one please help me with this? Any pointers or help is greatly appreciated (I have inserted comments where I get errors, please see: \rowcolor right above the tabular environment). Edit: As @caramdir pointed out that my code was not well written I have hereby tried to make a reproducible example (it is still long because of some of the code already existing the sample poster). I hope this will help you understand my problem better. I have also included the package subfigure. But nothing changed, I still get error messages before. I am not sure what's going on because the table code is similar to what I use in writing papers. The code does compile to .dvi, but with a lot of errors (I just press enter to skip them). But output dvi file is good. When I use xcolors and copy custom commands from the manual. They don't work either. (I get inline text instead of seeing the color) Thanks again for helping me. I am sorry if something is missing. I am not a latex expert, but I am trying hard. \documentclass[landscape,a0b,final]{a0poster} \usepackage{epsfig} \usepackage{subfigure} \usepackage{multicol} \usepackage{graphicx} \usepackage{xcolor} \usepackage{pstricks,pst-grad} \usepackage{amsmath, amsthm, amssymb} \setlength{\columnsep}{3cm} \setlength{\columnseprule}{2mm} \setlength{\parindent}{0.0cm} \newenvironment{poster}{ \begin{center} \begin{minipage}[c]{0.98\textwidth} }{ \end{minipage} \end{center} } \newenvironment{pcolumn}[1]{ \begin{minipage}{#1\textwidth} \begin{center} }{ \end{center} \end{minipage} } \begin{document} \begin{poster} \begin{center} \begin{pcolumn}{0.98} \Large \begin{center} \textbf{Parallels Table} \end{center} \vspace{0.5cm} {\Large \noindent\makebox[\textwidth]{ \subtable{ %\rowcolors{1}{LightBlue1}{DeepPink1} %Gives me errors \begin{tabular}{|c|c|c|} \multicolumn{3}{c}{\textbf{$Data_1$}} \\ \hline \textbf{ID} & \textbf{$Type_1$} & \textbf{$Type_2$} \\$1$&$I_{11}$&$I_{12}$\\ \hline \end{tabular} } \hspace{2cm} \subtable{ %\rowcolors{1}{LightBlue}{DeepSkyBlue} %Gives me errors \begin{tabular}{|c|c|c|} \multicolumn{3}{c}{\textbf{$Data_2$}} \\ \hline \textbf{ID} & \textbf{$Type_1$} & \textbf{$Type_2$} \\$G$&$n_{G1}$&$n_{G2}$\\ \hline \end{tabular} } } } \end{pcolumn} \end{center} \end{poster} \end{document} - Its a wonder, you get any output at all. You are missing a \usepackage{subfigure} in the preamble and \usepackage[table, svgnames]{xcolor} should be before \usepackage{pstricks,pst-grad}. Afterwards, it still doesn't compile for me, but I won't read through all your code. You should post a smaller example and remove all the stuff that is not necessary to demonstrate the problem. If you need advice on building a minimal example, start by reading this post. – Caramdir Feb 9 '11 at 23:21 The subfigure/subfig package is not what you need to put the tables together in this instance. Subfig is designed to work with floating objects (i.e. within a table or figure environment.) For posters, it is unlikely that you would ever want to use floats. So you need to remove the \subtable commands and use some of the techniques shown in this answer to put the tables side by side. – Alan Munn Feb 10 '11 at 4:17 @Alan. Thanks, your suggestion is exactly right. I used your link, and it worked perfectly fine. – suncoolsu Feb 13 '11 at 0:00 @Alan. However, somehow the suggestion did not work with the a0poster documentclass. Can you please tell me why? – suncoolsu Feb 13 '11 at 2:33 @suncoolsu What is wrong with Herb's solution? If you have a different problem, then you should probably post another question (separately from this one.) But first you should try to narrow down the problem to the smallest possible document that shows it. – Alan Munn Feb 13 '11 at 4:39 ## 1 Answer Here is your example as a running document. Coloring tables needs a \usepackage[table,<named color list(s)>]{xcolor}. Next time you shouldn't use the a0poster documentclass. It is easier to find errors with simple classes. \documentclass[landscape,a0b,final]{a0poster} \usepackage{subfig} \usepackage{multicol} \usepackage{graphicx} \usepackage[table,dvipsnames,svgnames,x11names]{xcolor} \setlength{\columnsep}{3cm} \setlength{\columnseprule}{2mm} \setlength{\parindent}{0.0cm} \newenvironment{poster}{% \begin{center} \begin{minipage}[c]{0.98\textwidth} }{% \end{minipage} \end{center} } \newenvironment{pcolumn}[1]{% \begin{minipage}{#1\textwidth} \begin{center} }{% \end{center} \end{minipage} } \begin{document} \begin{poster} \begin{center} \begin{pcolumn}{0.98} \Large \textbf{Parallels Table} \vspace{0.5cm} \rowcolors{1}{LightBlue1}{DeepPink1} %Gives me errors \begin{tabular}{|c|c|c|} \multicolumn{3}{c}{\textbf{$Data_1$}} \\\hline \textbf{ID} & \textbf{$Type_1$} & \textbf{$Type_2$} \$1$&$I_{11}$&$I_{12}$\\\hline \end{tabular} \hspace{2cm} \rowcolors{1}{LightBlue}{DeepSkyBlue} %Gives me errors \begin{tabular}{|c|c|c|} \multicolumn{3}{c}{\textbf{$Data_2$}} \\\hline \textbf{ID} & \textbf{$Type_1$} & \textbf{$Type_2$} \$G$&$n_{G1}$&$n_{G2}\$ \\\hline
\end{tabular}
\end{pcolumn}
\end{center}
\end{poster}

\end{document}

-
Thank you very much for your efforts in making it work through a0poster documentclass. I am sorry but the other poster class that I know of is Baposter, which to me (IMHO), looks less appealing to a0poster class. Did you mean that I should use some other poster class or did you want me to have reproducible examples without using a specific class (here a0poster). I appreciate your help. I must remark, I am not a heavy LaTeX user but I do use it a lot for professional reasons (limited to papers). – suncoolsu Feb 10 '11 at 10:45
@suncoolsu: The problem is not the poster class, it was how you loaded xcolor. The reason why it is not important which documentclass you used. If the poster class itself would be a problem, then it will be ok, if you use it. – Herbert Feb 10 '11 at 10:50
Thanks a lot. Off the topic -- I use PSTricks, I did not know you are on stackexchange. I makes me very happy to see a response from you!! – suncoolsu Feb 12 '11 at 23:50