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:
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.
which gives
I have not tried to tune the widths of different columns, so they are different from what you were getting in LaTeX.