Shouldn't this table span the whole page width?
ltablex
is the culprit here, as it modifies the tabularx
environment. If you're not using it, remove it, or consider ltxtable
which provides similar functionality using a different environment.
You may be interested in the following definition of \Rechnungstabelle
(note the paragraph break before \noindent
):
% https://tex.stackexchange.com/a/58638/5764
\makeatletter
\def\ifemptyarg#1{%
\if\relax\detokenize{#1}\relax % H. Oberdiek
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi}
\makeatother
\newcommand{\Rechnungstabelle}[4]{%
vielen Dank für Ihren Auftrag.
\noindent
\begin{tabularx}{\linewidth}{lXrr}%
\toprule%
\textbf{Anzahl} & \textbf{Bezeichnung} & \textbf{Einzelpreis} & \textbf{Gesamtpreis} \\%
\midrule%
#1%
\bottomrule%
& \textbf{Rechnungsbetrag} & & \textbf{\EUR{#2}} \\%
\ifemptyarg{#3}{}{& Enthaltene MwSt. 19\% & & \EUR{#3} \\}%
\ifemptyarg{#4}{}{& * Enthaltene MwSt. 7\% & & \EUR{#4}}%
\end{tabularx}%
}
I've dropped the use of \ifthenelse
(see Why is the ifthen
package obsolete?) and used \ifemptyarg
from Different command definitions with and without optional argument.
You can fix it with the \keepXColumns
command provided by ltablex
itself (rtfm ;-) )
Another feature that has been added is to treat the X columns like
l
columns if the table contents would allow that to happen without exceeding the specified width of the table. In other words, the specified width is treated as the maximum allowed and not the exact width of the table. This feature is the default but can be disabled (or enabled) with\keepXColumns
(or\convertXColumns
).
Best, Chris