当我尝试为包含换行符("\\ "
)的 tikz 节点设置字体大小时,仅为第一行设置字体大小:
\documentclass{article}
\usepackage{tikz}
\usepackage{fontspec}
\setmainfont{Arial}
\begin{document}
\begin{tikzpicture}
\begin{scope}
\node[align=left] at (0,0) {\fontsize{5pt}{5pt}\selectfont first line\\ second line};
\end{scope}
\end{tikzpicture}
\end{document}
如何设置整个节点的字体大小?
答案1
font=\fontsize{5pt}{5pt}\selectfont
在节点选项中使用。
\documentclass{article}
\usepackage{tikz}
%\usepackage{fontspec} %commented because it's not really relevant
%\setmainfont{Arial}
\begin{document}
\begin{tikzpicture}
\begin{scope}
\node[align=left,font=\fontsize{5pt}{5pt}\selectfont] at (0,0) {first line\\ second line};
\end{scope}
\end{tikzpicture}
\end{document}
(\fontsize{size}{baselineskip}
)