Seite 1 von 1

hline schießt über Tabellenrand

Verfasst: Mi 22. Jul 2015, 12:09
von elloro
Hallo zusammen und wie sollte es anderes sein, ich habe ein Problem mit \hline in der Tabelle bzw. mit dem rechten Rand der Tabelle. Dieser ist nach Links eingerückt. Ich habe keine Ahnung wie ich hline dazu bekomme nicht über den rechten Tabellenrand raus zuschießen oder den Tabellen Rand auf das ende von hline setze.
Mein "minimal"Beispiel. Es können zwar ein paar usepackage weg, die verkürzen dann allerdings hline so das die Tabelle nur zu 3/4 horizontale Linien hat.
\documentclass[11pt,a4paper]{article} % Use A4 paper with a 11pt font size - different 

\usepackage{marginnote} % Required for margin notes
\usepackage{wallpaper} % Required to set each page to have a header-logo
\usepackage[left=2.0cm,right=1.0cm,top=1.8cm,bottom=1.8cm,marginparwidth=3.4cm]{geometry} % Adjust page margins
\usepackage{amsmath} % Required for equation customization
\usepackage{amssymb} % Required to include mathematical symbols
\usepackage{xcolor} % Required to specify colors by name
\usepackage{epstopdf} % Required to include logo
\usepackage{fancyhdr} % Required to customize headers
\usepackage[colorlinks=false, pdfborder={0 0 0}]{hyperref}  % this is needed for forms and links within the text
\usepackage[latin1]{inputenc} % this is needed for german umlauts
\usepackage[T1]{fontenc} % this is needed for german umlauts
\usepackage{pgfplots}
\usepackage{tabularx}
\usepackage{fixltx2e}
\usepackage{selinput}
\usepackage{graphicx}

\setlength{\headheight}{70pt} % Increase the size of the header to accommodate meta-information
\pagestyle{fancy}\fancyhf{} % Use the custom header specified below
\renewcommand{\headrulewidth}{0pt} % Remove the default horizontal rule under the header

\setlength{\parindent}{0cm} % Remove paragraph indentation
\newcommand{\tab}{\hspace*{2em}} % Defines a new command for some horizontal space

\newcommand\BackgroundStructure{ % Command to specify the background of each page
\setlength{\unitlength}{1mm} % Set the unit length to millimeters
\put(153, 270){\includegraphics[height=15mm,keepaspectratio]{logo.eps}} % Logo box - maximum height/width: 
}


\newcommand{\underlineLength}{4}
\newcommand{\tfw}{10mm}
%“running in backwards compatibility mode” Compiler Warning
\pgfplotsset{compat=newest,compat/show suggested version=false}




%	HEADER INFORMATION

\fancyhead[L]{\begin{tabular}{l r  l r} % The header is a table with 4 columns
\textbf{Firma:} & $\rule{\underlineLength cm}{0.15mm}$ & \textbf{Name:} & $\rule{\underlineLength cm}{0.15mm}$ \\ % 
\textbf{Straße:} & $\rule{\underlineLength cm}{0.15mm}$ & \textbf{Vorname} & $\rule{\underlineLength cm}{0.15mm}$ \\ % 
\textbf{PLZ/Ort:} & $\rule{\underlineLength cm}{0.15mm}$ & \textbf{Tel.:} & $\rule{\underlineLength cm}{0.15mm}$ \\ % 
\textbf{Land:} & $\rule{\underlineLength cm}{0.15mm}$ & \textbf{E-Mail:} &  $\rule{\underlineLength cm}{0.15mm}$ \\ 
\end{tabular}}


\begin{document}
\begin{Form}
\noindent\makebox[\linewidth]{\rule{\paperwidth}{0.4pt}} % Horizontal Line

\AddToShipoutPicture{\BackgroundStructure} % Set the background of each page to that specified above in the header information section



\section{Technische Daten}		
\begin{tabularx}{\textwidth}{|llr|llc|}\hline
	Induktivität bei Nennstrom L\textsubscript{N}&\TextField[name=IN,width=\tfw]{}& $\mu$H&Nennstrom:&\TextField[name=Nennstrom,width=\tfw]{}&A\textsubscript{eff}\\\hline
\end{tabularx}


\end{Form}
\end{document}

Verfasst: Mi 22. Jul 2015, 12:33
von esdd
Du gibst für die tabularx Tabelle die Breite \textwidth vor. Entsprechend lang werden die horizontalen Linien gezeichnet. Deine Spalten sind aber insgesamt schmaler als \textwidth ...

Entweder Du verwendest einfach nur tabular ohne Breitenangabe oder Du sorgst dafür, dass die Tabelle genau die gewünschte Breite hat. Dazu musst Du mindestens einer Spalte den dehnbaren Typ X zu weisen. Mit anderen Worten: die Verwendung von tabularx ohne wenigstens eine Spalte vom Typ X macht eigentlich keinen Sinn.

Eine weitere Möglichkeit wäre
\begin{tabular*}{\textwidth}{|l@{\extracolsep{\fill}}lr|llc|}\hline 
Dabei wird der überschüssige Freiraum auf alle Spalten gleichmäßig verteilt.

Gruß
Elke

Verfasst: Mi 22. Jul 2015, 13:11
von elloro
Vielen Dank das hat geholfen und ich werde wohl mir noch mal tabularx genauer anscheuen.