# parcolumn nofirstindent not working well?

The following code leaves some extra space in front of the start of each box... nofirstindent should, I imagine, set it to 0 but it is not:

\documentclass{article}
\usepackage{tikz}
\usepackage{parcolumns}
\scrollmode

\begin{document}
\newcommand{\drawrect}[1]{\begin{tikzpicture} \draw (-1.5,-1.5) rectangle (1.5,1.5); \node at (0,0) {#1}; \end{tikzpicture}}

\begin{parcolumns}[nofirstindent,rulebetween,distance=0pt]{3}
\colchunk{
\drawrect{1}\\
\drawrect{2}\\
\drawrect{3}\\
}
\colchunk{
\drawrect{4}\\
\drawrect{5}\\
\drawrect{6}\\
}
\colchunk{
\drawrect{7}\\
\drawrect{8}\\
\drawrect{9}\\
}
\colplacechunks
\end{parcolumns}

\end{document}


It would also be nice if parcolumns would center itself between the margins.

-
modifying parcolumn.sty by adding \spaceskip-0.00001em right after \if@tempswa to the nofirstindent macro removes the gap created. Not sure why it it works the way it does(basically adding -0 makes it align correctly even though it shouldn't do anything). –  Uiy May 10 '12 at 4:21

You don't have to modify the parcolumn.sty for this. Just put a % after \colchunk{.

\documentclass{article}
\usepackage{tikz}
\usepackage{parcolumns}
\scrollmode

\begin{document}
\newcommand{\drawrect}[1]{\begin{tikzpicture} \draw (-1.5,-1.5) rectangle (1.5,1.5); \node at (0,0) {#1}; \end{tikzpicture}}

\begin{parcolumns}[nofirstindent,rulebetween,distance=0pt,]{3}
\colchunk{%
\centering
\drawrect{1}\\
\drawrect{2}\\
\drawrect{3}\\
}
\colchunk{%
\centering
\drawrect{4}\\
\drawrect{5}\\
\drawrect{6}\\
}
\colchunk{%
\centering
\drawrect{7}\\
\drawrect{8}\\
\drawrect{9}\\
}
\colplacechunks
\end{parcolumns}

\end{document}


To center the rectangle just use \centering inside column chunks.

-
I learned this lesson about trailing % the hard way: Tex Capacity Exceeded (if remove % after use of macro), and this is a useful reference When is it harmful to add percent character at end of lines in a \newcommand, or similar. –  Peter Grill May 10 '12 at 5:16
Unfortunately % doesn't always seem to work ;/ it works in MWE but not in my production code(I thought it did but it's still there). As far as the centering goes, I do not want to center all the cells but just the parcolumn. Unfortunately it seems to add a little extra whitespace(an extra columnspace) after the 3rd column which causes the centering to be off. Probably an issue with the code where they loop over adding the columns + columnspace and do not remove the last columnspace. Basically Width/3 = columnsize is not the best way to calculate the columnsize. –  Uiy May 10 '12 at 5:29
@Uiy: Unfortunately, I don't have any idea about your production code. And your second comment,... I don't get it clearly. –  Harish Kumar May 10 '12 at 5:58
Of course you don't ;) The point is that it doesn't work... who knows why but my original solution does work and is good enough for me... hopefully no drawbacks. If you use the showframe package and left justify the boxes you'll see that the last column as unnecessary whitespace after it. Basically the last column as the same column space(to separate columns) BUT there is no need for the last column to have this. [* * * ] should be [* * *]. (unless you are centering cells then it should have it) –  Uiy May 10 '12 at 6:05