# Always a space before embedded figures in table - how do I get rid of it?

I am placing figures in a tabularx and I am having trouble getting them to embed properly. I keep getting an annoying spacer before the figure... Now if only this space could be split evenly before and after the figure I wouldn't mind, but it's always on the LEFT - no matter what I try (>\centering didn't work >\raggedright either).

Do you have any suggestions?

Here is my code and a screenshot :

\begin{table*}[t!]
%make things in tabularx columns vertically centered
\renewcommand{\tabularxcolumn}[1]{>{\small}m{#1}}
\newcolumntype{y}{>{\small\centering\arraybackslash}X}
\centerline{
\begin{small}
\begin{tabularx}{7in}{>{\small\raggedright\arraybackslash}p{0.05\textwidth}|y|y|y|y|y|y|y|y|}
Symbol  &
\includegraphics[width=0.70in]{../images/paper/charlie.jpg}&
\includegraphics[width=0.70in]{../images/paper/charlie.jpg}&
\includegraphics[width=0.70in]{../images/paper/charlie.jpg}&
\includegraphics[width=0.70in]{../images/paper/charlie.jpg}&
\includegraphics[width=0.70in]{../images/paper/charlie.jpg}&
\includegraphics[width=0.70in]{../images/paper/charlie.jpg}&
\includegraphics[width=0.70in]{../images/paper/charlie.jpg}&
\includegraphics[width=0.70in]{../images/paper/charlie.jpg}\\ \hline
B   & & & test & is text centered &
\end{tabularx}
\end{small}}
\caption{RAAAAAAAAAGE}
\label{tab:rage}
\renewcommand{\tabularxcolumn}[1]{>{\small}p{#1}}
\end{table*}


EDIT : After some more toying around, I think these spaces are margins, and it's because my table is too crowded that they were omitted on the right side... so reducing the sizes of my images fixed the whole thing. Over! However if you have anything to add go ahead, I'll be glad to hear what you have to say!

Here it is once I removed one column to make space...

-

I'm not sure what else can be said. You may be interested in controlling the tabcolsep parameter:

\documentclass[10pt]{article}
\usepackage{tabularx}
\usepackage{xcolor}

\begin{document}

\begin{tabular}{c|c|c}
\colorbox{yellow}{point}& \colorbox{yellow}{point}&\colorbox{yellow}{point} \\
\end{tabular}

\setlength\tabcolsep{0pt}
\begin{tabular}{c|c|c}
\colorbox{red}{line}& \colorbox{blue}{line}&\colorbox{green}{line} \\
\end{tabular}

\end{document}

-

Modifying \tabcolsep is a workable solution. However, it is not in general the best way out since it creates 'document-global' rather than 'table-local' effects. In other words, coded this way, all subseqent tabular layouts come under its sway. For this reason, you will rarely see TeX/LaTeX code written like this. The more common approach is to insert @{} in those places in your table column specifier where you want to eliminate the TeX-provided extra columnar padding.

(BTW, you can include whatever you want in between the braces of @{}, e.g., @{:} to introduce : column separators. In your case you don't want anything, hence the empty {} parameter.)

Here's some code to illustrate some somewhat more standard alternatives:

\documentclass[10pt]{article}
\usepackage{tabularx}
\usepackage{xcolor}

\begin{document}

% Problem: unwanted column separator spacing
\begin{tabular}{|c|c|c}
\colorbox{red}{box}&\colorbox{yellow}{box}&\colorbox{green}{box} \\
\end{tabular}\vspace{\baselineskip}

% Solution 1: Eliminates column spacing. However, the effect is global. Unless
%             some care is taken by inserting it in a group or by manually
%             saving and restoring the column separator spacing, it breaks
%             subsequent table layouts.
\setlength\tabcolsep{0pt}
\begin{tabular}{|c|c|c|}
\colorbox{red}{box}&\colorbox{yellow}{box}&\colorbox{green}{box} \\
\end{tabular}\vspace{\baselineskip}

% Solution 1b: fixes the problem introduced in the solution above.
\begingroup
\setlength\tabcolsep{0pt}
\begin{tabular}{|c|c|c|}
\colorbox{red}{box}&\colorbox{yellow}{box}&\colorbox{green}{box} \\
\end{tabular}\vspace{\baselineskip}
\endgroup

% Solution 2: TeX-standard' solution - include @{}' at places where extra
\begin{tabular}{|@{}c@{}|@{}c@{}|@{}c@{}|}
\colorbox{red}{box}&\colorbox{yellow}{box}&\colorbox{green}{box} \\
\end{tabular}\vspace{\baselineskip}

% Solution 2b: Best solution - write *{n}{column pattern}' to repeat the pattern
%              n times (saves a little typing, maybe easier to maintain).
\begin{tabular}{*{3}{|@{}c@{}}|}
\colorbox{red}{box}&\colorbox{yellow}{box}&\colorbox{green}{box} \\
\end{tabular}

\end{document}

-

You do have a space before your pictures, just after the & (a newline, to be more precise). I'm pretty sure just commenting it would do the job :

\includegraphics[width=0.70in]{../images/paper/charlie.jpg}&%
`
-
This was meant as a comment. – Michaël Sep 22 '10 at 1:00