In pdfLaTeX, tabular environment, the first line of each \multirow cell is indented. No matter if I use l, r or p for column specifier. How to get rid of that?!?

Here is the screenshot:

enter image description here

Here is my code:





\hypersetup{pdfborder={0 0 0 0},colorlinks=true,urlcolor=blue}





\newcommand{\vatexempt} {
\pbox[t]{2cm}{Nie podlega\\Exempt}

% table cell with dark background
\newcommand{\itg} {
% table header
\newcommand{\ith} {



\ith\strutA No.&\ith&\multicolumn{1}{p{0.6cm}|}{\multirow{2}{0.6cm}{\ith Q-tity}}&\ith&\ith&\multicolumn{2}{c|}{\ith VAT}&\ith\\
\ith\strutD&\multicolumn{1}{p{4cm}|}{\multirow{-2}{4cm}{\ith Service or commodity name}}&\ith&\multicolumn{1}{p{2cm}|}{\multirow{-2}{2cm}{\ith Net unit price (EUR)}}&\multicolumn{1}{p{2cm}|}{\multirow{-2}{2cm}{\ith Net value (EUR)}}&\multicolumn{1}{p{2cm}|}{\ith Rate (\%)}&\multicolumn{1}{p{1.2cm}|}{\ith Amount (EUR)}&\multicolumn{1}{p{2cm}|}{\multirow{-2}{2cm}{\ith Gross value (EUR)}}\\
\strutD 1 & screwdrivers 10 pack & 1 & 123 & 123 & \vatexempt & 0 & 123\\
\multicolumn{2}{l|}{} & \multicolumn{2}{l}{\itg\strutA SUMA / TOTAL:} & \itg 123 &\itg&\itg 0 &\itg 123\\


I am using those \multicolumn{1} tweaks to have table body cell content aligned to the right (those are amounts) and header cell content justified BUT WITH NO INDENT!

In fact, I would also be satisfied with header cell content flushed to the left BUT WITH HYPHENATION. That could be even better. (How to make that?)

I am using \multirow{-2} to get the content painted over background, not below. :o)

  • BONUS QUESTION (1): why is this \cline{6-7} almost invisible?
    – STF
    Sep 1 '12 at 8:13
  • 3
    What happens if you add % after the { in all your newcommands: for example, \newcommand{ith}{%, etc.
    – Aditya
    Sep 2 '12 at 16:27

For comparison, this is how one can typeset the same table in ConTeXt. Notice that all the setup commands can be moved outside the table, and the table content can be typeset cleanly.

\startsetups invoice
  \setupTABLE[header][background=color,backgroundcolor=gray, align={middle,lohi}]
  \setupTABLE[column][2][width=4cm, align=normal]
  \setupTABLE[3,5,6,7][last][frame=off, topframe=on, bottomframe=on]

      \bTD[ny=2] No.                       \eTD 
      \bTD[ny=2] Service or commodity name \eTD 
      \bTD[ny=2] Q-tity                    \eTD 
      \bTD[ny=2] Net Unit Price (EUR)      \eTD 
      \bTD[ny=2] Net value (EUR)           \eTD 
      \bTD[nx=2] Value                     \eTD 
      \bTD[ny=2] Gross value (EUR)         \eTD 
      \bTD Rate (\%)    \eTD
      \bTD Amount (EUR) \eTD
      \bTD 1                    \eTD 
      \bTD screwdrivers 10 pack \eTD 
      \bTD 1                    \eTD 
      \bTD 123                  \eTD 
      \bTD 123                  \eTD 
           Nie podlega Exempt   \eTD 
      \bTD 0                    \eTD 
      \bTD 123                  \eTD 
      \bTD[nx=2]            \eTD 
      \bTD[nx=2] SUMA/TABLE \eTD 
      \bTD 123              \eTD 
      \bTD                  \eTD 
      \bTD 0                \eTD 
      \bTD 123              \eTD 


which gives

enter image description here

I have not tried to tune the widths of different columns, so they are different from what you were getting in LaTeX.


The "indentation" stems from spurious spaces in your \newcommand definition of \ith (As mentioned by Aditya). The following definition removes this (and doesn't require \setlength{\parindent}{0pt}:

% table header

Note the addition of % at the end of the lines. Of course, the same goes for the other commands defined within your example (\itg, \strutD, \vatexempt, ...).

For motivations behind this, see What is the use of percent signs at the end of lines?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.