我有一些节点只包含文本。据我所知,我需要使用节点在 中写入简单文本tikz
。问题是,单词之间的间距对我来说太大了(这绝对不是我的文档/图表所有其他部分的正常间距)。可以以某种方式修复这个问题吗?
以下是一个例子:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,positioning, arrows.meta}
\usepackage{calc}
\usepackage{mathptmx}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}
\node[text width=6cm] at (0,1) {\tiny \parbox{4cm}{1. Distance between words too large}};
\end{tikzpicture}
\end{document}
答案1
使字体变小的“正确”方法是使用font=\tiny
(而不仅仅是添加\tiny
节点)。(您也可以自定义\spaceskip
。)
\documentclass{standalone}
\usepackage{tikz}
\usepackage{mathptmx}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
\begin{tikzpicture}
\path (0,1) node[right,text width=6cm] {\tiny \parbox{4cm}{1. Distance between words too large}}
node[left,font=\sffamily]{original:}
(0,0) node[right,text width=6cm,font=\tiny] {\parbox{4cm}{2. Distance between words too large}}
node[left,font=\sffamily]{use the \texttt{font=\textbackslash tiny} key:}
(0,-1) node[right,text width=6cm] {\tiny\spaceskip=2pt \parbox{4cm}{3. Distance between words too large}}
node[left,font=\sffamily]{using \texttt{\textbackslash spaceskip}:};
\end{tikzpicture}
\end{document}