[Tex/LaTex] Multirow tabular: un-indent the first line

indentationmultirowtables

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:

\NeedsTeXFormat{LaTeX2e}
\documentclass[a4paper,10pt]{article}
\pagestyle{empty}

\usepackage{array}
\usepackage{multirow}
\usepackage{colortbl}
\usepackage{pbox}

\usepackage[polish]{babel}
\usepackage[utf8]{inputenc}
\usepackage[OT4]{fontenc}

\usepackage[lmargin=2cm,rmargin=2cm,tmargin=1.5cm,bmargin=1.5cm]{geometry}
\usepackage{graphicx}
\usepackage{sectsty}
\allsectionsfont{\underline}

\usepackage[pdftex]{hyperref}
\hypersetup{pdfborder={0 0 0 0},colorlinks=true,urlcolor=blue}

\fontencoding{T1}
\fontfamily{qpl}
\fontseries{m}
\fontshape{n}

\newlength{\rowA}
\setlength{\rowA}{3.5ex}
\newcommand{\strutA}{
\rule[-0.2\rowA]{0pt}{\rowA}
}

\newlength{\rowB}
\setlength{\rowB}{6.5ex}
\newcommand{\strutB}{
\rule[-0.55\rowB]{0pt}{\rowB}
}

\newlength{\rowD}
\setlength{\rowD}{6ex}
\newcommand{\strutD}{
\rule[-0.6\rowD]{0pt}{\rowD}
}

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

% table cell with dark background
\newcommand{\itg} {
\cellcolor[gray]{.8}
\setlength{\parindent}{0pt}
}
% table header
\newcommand{\ith} {
\cellcolor[gray]{.8}
\setlength{\parindent}{0pt}
}

\setlength{\parindent}{0pt}
\setlength{\parskip}{7.2pt}

\begin{document}
\begin{fussy}

\begin{tabular}{|r|p{4cm}|r|r|r|r|r|r|}
\hline
\ith\strutA No.&\ith&\multicolumn{1}{p{0.6cm}|}{\multirow{2}{0.6cm}{\ith Q-tity}}&\ith&\ith&\multicolumn{2}{c|}{\ith VAT}&\ith\\
\cline{6-7}
\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)}}\\
\hline
\strutD 1 & screwdrivers 10 pack & 1 & 123 & 123 & \vatexempt & 0 & 123\\
\hline
\multicolumn{2}{l|}{} & \multicolumn{2}{l}{\itg\strutA SUMA / TOTAL:} & \itg 123 &\itg&\itg 0 &\itg 123\\
\cline{3-8}
\end{tabular}

\end{fussy}
\end{document}

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)

Best Answer

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.

\setupbodyfont[10pt]
\startsetups invoice
  \setupTABLE[column][each][align={flushright}]
  \setupTABLE[header][background=color,backgroundcolor=gray, align={middle,lohi}]
  \setupTABLE[column][2][width=4cm, align=normal]
  \setupTABLE[column][4,5,6,7,8][width=2cm]
  \setupTABLE[row][last][background=color,backgroundcolor=gray]
  \setupTABLE[1,2][last][frame=off,background=]
  \setupTABLE[3,5,6,7][last][frame=off, topframe=on, bottomframe=on]
  \setupTABLE[3,6][last][leftframe=on]
\stopsetups

\starttext
\bTABLE[setups={invoice}]
  \bTABLEhead
    \bTR
      \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 
    \eTR
    \bTR
      \bTD Rate (\%)    \eTD
      \bTD Amount (EUR) \eTD
    \eTR
  \eTABLEhead
  \bTABLEbody
    \bTR
      \bTD 1                    \eTD 
      \bTD screwdrivers 10 pack \eTD 
      \bTD 1                    \eTD 
      \bTD 123                  \eTD 
      \bTD 123                  \eTD 
      \bTD[align=normal] 
           Nie podlega Exempt   \eTD 
      \bTD 0                    \eTD 
      \bTD 123                  \eTD 
    \eTR
  \eTABLEbody
  \bTABLEfoot
    \bTR
      \bTD[nx=2]            \eTD 
      \bTD[nx=2] SUMA/TABLE \eTD 
      \bTD 123              \eTD 
      \bTD                  \eTD 
      \bTD 0                \eTD 
      \bTD 123              \eTD 
    \eTR
  \eTABLEfoot

\eTABLE
\stoptext

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.

Related Question