1

While it was possible to remove the spacing between paragraphs, I could not figure out how to remove the spacing between lines (line breaks / new lines).

As shown in the first section of the following example \parskip allows to have the tikzpictures without a gap inbetween, but both explicit newlines (\\) in the second section, as well as automatic line breaks as seen in the third section introduce a gap.

\documentclass[a4paper,parskip]{scrartcl}
\usepackage{tikz}
\begin{document}
\setlength{\parskip}{-1pt} 

%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\card}[1] {%
    \begin{tikzpicture}%
        \fill[#1] (0,0) rectangle (5 cm,2 cm);
    \end{tikzpicture}%
}%

%%%%%%%%%%%%%%%%%%%%%%%%%%%

\card{black}%
\card{red}%
\card{blue}%
\card{red}%

\card{blue}%
\card{black}%
\card{red}%

\vspace{.5cm}

\card{red}%
\card{blue}%
\card{black}\\%
\card{blue}%
\card{black}%

\vspace{.5cm}

\card{red}\hspace{0pt}%
\card{blue}\hspace{0pt}%
\card{black}\hspace{0pt}%
\card{blue}\hspace{0pt}%
\card{black}\hspace{0pt}%

%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{document}

Adjusting \baselineskip had no effect....

Thruston
  • 42,268
M.S.
  • 133
  • 1
    Use \lineskip=0pt. Boxes larger than \baselineskip are separated by \lineskip instead. – John Kormylo Jul 26 '17 at 13:16
  • Does using option parskip but setting \parskip to a value <= 0 make sense? Wouldn't it be better to remove option parskip? – Schweinebacke Jul 26 '17 at 13:19
  • @Schweinebacke Only with that negative parskip could I remove the gap between the paragraphs, that was the reason. – M.S. Jul 26 '17 at 14:16
  • @JohnKormylo Thanks, that one worked, I am wondering why I did not found anything about that earlier.... If you write an answer I can accept it or otherwise answer it myself now... – M.S. Jul 26 '17 at 14:17
  • But you don't need option parskip. And the vertical space between paragraphs in this case is the same a in the paragraphs: \lineskip. Using option parskip but then setting \parskip to something <= 0 (or even something << .5\baselineskip) does not make sense. – Schweinebacke Jul 26 '17 at 16:23

1 Answers1

0

Baselines are normally spaced \baselineskip apart, but when needed \lineskip is added between the bottom of one line and the top of the next. (The actual test involves \lineskiplim.)

\documentclass[a4paper,parskip]{scrartcl}
\usepackage{tikz}
\begin{document}
\setlength{\parskip}{-1pt} 

%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\card}[1] {%
    \begin{tikzpicture}%
        \fill[#1] (0,0) rectangle (5 cm,2 cm);
    \end{tikzpicture}%
}%

%%%%%%%%%%%%%%%%%%%%%%%%%%%

\card{black}%
\card{red}%
\card{blue}%
\card{red}%

\card{blue}%
\card{black}%
\card{red}%

\vspace{.5cm}

\bgroup% make change local to group
\lineskip=0pt
\card{red}%
\card{blue}%
\card{black}\\%
\card{blue}%
\card{black}%

\vspace{.5cm}

\card{red}\hspace{0pt}%
\card{blue}\hspace{0pt}%
\card{black}\hspace{0pt}%
\card{blue}\hspace{0pt}%
\card{black}\hspace{0pt}%
\par\egroup

%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{document}

demo

John Kormylo
  • 79,712
  • 3
  • 50
  • 120