删除图片行距(scrartcl)

删除图片行距(scrartcl)

虽然可以删除段落之间的间距,但我不知道如何删除行之间的间距(换行符/新行)。

如以下示例的第一部分所示,\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}

演示

相关内容