1

I've been trying to align my document precisely. I've come across a weird issue. What i'm trying to achieve is: 1) I want to have a top page header - this is drawn with tikz 2) I want to be able to precisely set the distance to the next entity(text or table) 3) So i've started with reducing the distance so i have clean start.

BUT im unable to remove the space before first \par:

\setlength{\parindent}{0em}
\setlength{\parskip}{0.0em}
\setlength{\topskip}{0.0em}
\setlength{\parsep}{0.0em}
\setlength{\partopsep}{0.0em}
\setlength{\topsep}{0.0em}
\def\arraystretch{0}%
\setlength\tabcolsep{0pt}
\begin{document}
  {\Large\bfseries \cvHeader{}{Header h}{header r}  }
  \par
  Why is there space above me?
  \par
  ...

This is rendered as following(please note that i have dark background in editor):Damn that space!

I've tried all of the settings i could find that apply to \par spacing, but im not sure what is the issue.

This is how i draw the header:

\newcommand{\cvHeader}[3]{
  %First thing to do, Set the keys 
  %from the single parameter input
  \setkeys[CV]{top}{#1}
  \noindent
  \begin{tikzpicture}
    \color{\cvBgColor}
    \filldraw
    (0,0) rectangle (\paperwidth,\cvHeight);
    \draw node[color=\cvTextColor,anchor=west] at (\cvTextIndent,\cvHeight/2) {#2};
    \draw node[color=\cvTextColor,anchor=east] at (\paperwidth - \cvTextIndent,\cvHeight/2) {#3};
  \end{tikzpicture}
}

Weird thing is that the next \par does not have any space before it, which would maybe point to the drawing - but i've also checked the boxes there.

Only way how I managed to overcome this is by setting \vspace{-0.4cm} but that is not a robust solution.

Any help is highly appreciated!!

1
  • 1
    please fix your examples so that people can run them and see the issue. Commented Oct 26, 2016 at 18:41

1 Answer 1

2

It is not vertical space, it is a horizontal line of a paragraph with the space characters from your source, I commented them out with %%%space

\documentclass{article}
\usepackage{tikz}


\setlength{\parindent}{0em}
\setlength{\parskip}{0.0em}
\setlength{\topskip}{0.0em}
\setlength{\parsep}{0.0em}
\setlength{\partopsep}{0.0em}
\setlength{\topsep}{0.0em}
\def\arraystretch{0}%
\setlength\tabcolsep{0pt}

\def\cvBgColor{red}
\def\cvTextColor{blue}
\def\cvHeight{30pt}
\def\cvTextIndent{0pt}
\newcommand{\cvHeader}[3]{%%%%%%%%%space
  %First thing to do, Set the keys 
  %from the single parameter input
%  \setkeys[CV]{top}{#1}
  \noindent
  \begin{tikzpicture}
    \color{\cvBgColor}%%%space
    \filldraw
    (0,0) rectangle (\paperwidth,\cvHeight);
    \draw node[color=\cvTextColor,anchor=west] at (\cvTextIndent,\cvHeight/2) {#2};
    \draw node[color=\cvTextColor,anchor=east] at (\paperwidth - \cvTextIndent,\cvHeight/2) {#3};
  \end{tikzpicture}%%%% space
}
\begin{document}
  {\Large\bfseries \cvHeader{}{Header h}{header r}}%
  \par
  Why is there space above me?
  \par

\end{document}

The heading line is overfull as it is \paperwidth wide but starting at the edge of the text block not the edge of the page, you might want to add a negative space to account for the left margin.

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .