虽然可以删除段落之间的间距,但我不知道如何删除行之间的间距(换行符/新行)。
如以下示例的第一部分所示,\parskip
允许tikzpictures
中间没有间隙,但第二部分中的显式换行符(\\
)以及第三部分中的自动换行符都会引入间隙。
\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}
调整了\baselineskip
也没效果....
答案1
基线通常是分开\baselineskip
的,但必要时\lineskip
会添加在一行的底部和下一行的顶部之间。(实际测试涉及\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}