I have an overflow problem but I can`t figure out how to solve it. Why is
\rule{\textwidth}{0.6pt}\\[\baselineskip]
\vspace{0.5cm}
giving out an overfull error if the text is not responsible?
I can replicate the OP's issue precisely with the following test code:
\documentclass[12pt]{article}
\begin{document}
\rule{\textwidth}{0.6pt}
\end{document}
Spefically, I get the following warning message:
Overfull \hbox (17.62482pt too wide) in paragraph at lines 5--6
Observe that Overfull \hbox (17.62482pt too wide)
also shows up in the warning message reported by the OP.
The fix? I suggest issuing the instruction \noindent
immediately before the \rule
instruction.
A final comment: It doesn't have to be text that causes the overfull-hbox warning; it can just as well be a horizontal rule.
The overfull is caused by the paragraph indentation. Thus \rule
should be preceded by \noindent
.
But, as you're doing flushleft
things just after that rule, just place the rule inside it.
Also \\[\baselineskip]\vspace{0.5cm}
is not very good programming and \\
shouldn't be used in that context anyway: just use a blank line after the rule followed by the desired amount of vertical space.
Adding columns in the tabular
to get space isn't the best way too: look at the code below where a specific distance between columns is inserted.
\documentclass[a4paper]{book}
\newcommand{\printauthor}{A. Uthor}
\newcommand{\matnr}{176--761}
\newcommand{\abgabedatum}{July 38, 2043}
\begin{document}
\begin{flushleft}
\rule{\textwidth}{0.4pt}
\vspace{1cm}
\begin{tabular}{@{} l @{\hspace{2em}} l @{}}
\textbf{von:} & \printauthor \\
& Matrikelnummer: \matnr \\
\textbf{Betreuer:} & Dr.\ Daniel Brunner \\
\textbf{Abgabedatum:} & \abgabedatum
\end{tabular}
\end{flushleft}
\end{document}
Adjust the lengths to your liking.
\noindent
immediately before\rule
? Incidentally, what's the value of the\parindent
parameter?