更改嵌套节点中的行距

更改嵌套节点中的行距

我尝试更改嵌套节点中的行距。我尝试使用\linepsread和,\baselineskip但都不起作用。

梅威瑟:

\documentclass[]{standalone}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
\node[rectangle,fill=blue,align=center]() at (5cm,0){coucou\\%
\tikz\node[text width=3cm,align=center](){\setlength{\baselineskip}{1pt}\tiny These certificates can be used to digitally sign and encrypt email, authenticate%
 and authorize users connecting to websites and secure data transmission over%
 the Internet. Any application that supports the Secure Socket Layer (SSL) can%
 make use of certificates signed by CAcert, as can any application that uses%
 X.509 certificates, e.g. for encryption or code signing and document signatures.};};

\end{tikzpicture}
\end{document}

答案1

除了\tiny在文本中设置外,将其放在选项中node font也会进行相应的设置\baselineskip

\documentclass[]{standalone}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
\node[rectangle,fill=blue!50,align=center]() at (5cm,0){%
  coucou\\
  \tikz\node[text width=3cm,align=center, node font=\tiny]{%
    These certificates can be used to digitally sign and encrypt email,
    authenticate and authorize users connecting to websites and secure data
    transmission over the Internet.  Any application that supports the
    Secure Socket Layer (SSL) can make use of certificates signed by CAcert,
    as can any application that uses X.509 certificates, e.g.  for
    encryption or code signing and document signatures.%
};};
\end{tikzpicture}
\end{document}

结果

答案2

如果您不想决定字体大小,您可以让它tcolorbox用其库为您决定fitting

只要\tcboxfit您做出决定widthheight程序就会调整内容文本以适应它。

\documentclass[border=2mm]{standalone}
\usepackage[most]{tcolorbox}

\newtcboxfit{\boxfit}[4][]{width=#2,height=#3,title=#4,halign=center, #1}

\begin{document}

\boxfit{5cm}{5cm}{coucou}{
    These certificates can be used to digitally sign and encrypt email,
    authenticate and authorize users connecting to websites and secure data
    transmission over the Internet.  Any application that supports the
    Secure Socket Layer (SSL) can make use of certificates signed by CAcert,
    as can any application that uses X.509 certificates, e.g.  for
    encryption or code signing and document signatures.%
}

\boxfit[sharp corners, colback=blue!50, size=fbox]{3cm}{6cm}{coucou}{
    These certificates can be used to digitally sign and encrypt email,
    authenticate and authorize users connecting to websites and secure data
    transmission over the Internet.  Any application that supports the
    Secure Socket Layer (SSL) can make use of certificates signed by CAcert,
    as can any application that uses X.509 certificates, e.g.  for
    encryption or code signing and document signatures.%
}

\boxfit[sharp corners, colback=red!50, size=small, colframe=red!70, halign title=center]{6cm}{3cm}{coucou}{
    These certificates can be used to digitally sign and encrypt email,
    authenticate and authorize users connecting to websites and secure data
    transmission over the Internet.  Any application that supports the
    Secure Socket Layer (SSL) can make use of certificates signed by CAcert,
    as can any application that uses X.509 certificates, e.g.  for
    encryption or code signing and document signatures.%
}
\end{document}

在此处输入图片描述

答案3

最后我找到了一个使用setspace包的解决方案。

梅威瑟:

\documentclass[]{standalone}

\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{setspace}
\begin{document}
\begin{tikzpicture}
\node[rectangle,fill=blue,align=center]() at (5cm,0){coucou\\ \tikz\node[text width=3cm,align=center](){\begin{spacing}{0.5}\tiny These certificates can be used to digitally sign and encrypt email, authenticate and authorize users connecting to websites and secure data transmission over the Internet. Any application that supports the Secure Socket Layer (SSL) can make use of certificates signed by CAcert, as can any application that uses X.509 certificates, e.g. for encryption or code signing and document signatures.\end{spacing}};};

\end{tikzpicture}
\end{document}

相关内容