使用 tikz 制作的标签更改行间距

使用 tikz 制作的标签更改行间距

我有以下带有命令的脚本tag

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{natbib}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{setspace}
\usepackage{dashrule}

\newcommand{\tag}[1]{%
{
  \tikz[baseline]\node[anchor=base,draw=black!30,rounded corners,inner xsep=1ex,inner ysep =0.75ex, text height=1.5ex,text depth=.25ex]{#1};
  }
}

\newcommand{\divider}{\textcolor{black!30}{\hdashrule{\linewidth}{0.6pt}{0.5ex}}\medskip}

\begin{document}

\divider
\tag{Lorem}
\tag{Ipsum}
\tag{Dolor}
\tag{Lorem}
\tag{Ipsum}
\tag{Dolor}
\tag{Lorem}
\tag{Ipsum}
\tag{Dolor}
\tag{Lorem}
\tag{Ipsum}
\tag{Dolor}
\tag{Lorem}
\tag{Ipsum}
\tag{Dolor}
\tag{Lorem}
\tag{Ipsum}
\tag{Dolor}
\divider

\end{document}

它的输出是:

define 命令的多种用法

我想增加标签之间的垂直间距,但不增加标签和分隔符之间的间距。

我尝试通过以下示例来实现这一点,但是它们未能满足关于不改变标签和分隔符之间的间距的第二个要求:

\divider
{ \setstretch{2}
\tag{Lorem}
\tag{Ipsum}

}
\divider
\divider
\begin{spacing}{2}
\tag{Lorem}
\tag{Ipsum}
\end{spacing}
\divider

检查示例:https://www.overleaf.com/read/bcfqkznypjbn

答案1

你想要这样的东西吗?

改变一些间距

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{setspace}
\usepackage{dashrule}

\newcommand{\tag}[1]{%
  \tikz[baseline]\node[anchor=base,draw=black!30,rounded corners,inner xsep=1ex,inner ysep =0.75ex, text height=1.5ex,text depth=.25ex]{#1};
}

\newcommand{\divider}{\par\noindent\textcolor{black!30}{\hdashrule{\linewidth}{0.6pt}{0.5ex}}\medskip\par\noindent}

\begin{document}

\divider
\tag{Lorem}
\tag{Ipsum}
\tag{Dolor}
\tag{Lorem}
\tag{Ipsum}
\tag{Dolor}
\tag{Lorem}
\tag{Ipsum}
\tag{Dolor}
\tag{Lorem}
\tag{Ipsum}
\tag{Dolor}
\tag{Lorem}
\tag{Ipsum}
\tag{Dolor}
\tag{Lorem}
\tag{Ipsum}
\tag{Dolor}
\divider

\divider
{\setstretch{2}%
\tag{Lorem}
\tag{Ipsum}
\tag{Dolor}
\tag{Lorem}
\tag{Ipsum}
\tag{Dolor}
\tag{Lorem}
\tag{Ipsum}
\tag{Dolor}
\tag{Lorem}
\tag{Ipsum}
\tag{Dolor}
\tag{Lorem}
\tag{Ipsum}
\tag{Dolor}
\tag{Lorem}
\tag{Ipsum}
\tag{Dolor}\par}
\divider
\divider

\end{document}

相关内容