如何為「全域」心智圖中的節點設定任意字體大小

如何為「全域」心智圖中的節點設定任意字體大小

我在 tex.stackexchange.com 上沒有發現嘗試定義字體大小(包括任何字體大小)設定的問題。我發布的問題有可能會變得“重複”,但無論如何我都會發布。我的問題是如何以“全局”方式設定心智圖節點的任何字體大小。雖然這是一件簡單的事情,但我認為其中還是有一些微妙之處的。

這是我的例子

這是我的 MWE:

\documentclass{article}
\usepackage{anyfontsize}
\usepackage{tikz}
\usepackage[paperwidth=5cm,paperheight=5cm]{geometry}
\usetikzlibrary{mindmap}
\begin{document}
\centering\begin{tikzpicture}[mindmap]
    \tikzstyle{every node}=[text width=1cm,align=flush center,minimum size=1cm]
         \node [concept, text=white] at (0,0) 
      {any other text}
    child [concept color=blue!50, grow=0,level distance=80]
    {node [concept] (text) {Text}}; 
\end{tikzpicture}
\end{document}

答案1

這是我自己的答案,使用\fontselect{X-size-unitdimen}{X-size-unitdimen}\selectfont.我認為要產生效果,有必要使用\selectfont

\documentclass{article}
\usepackage{anyfontsize}
\usepackage{tikz}
\usepackage[paperwidth=5cm,paperheight=5cm]{geometry}
\usetikzlibrary{mindmap}
\begin{document}
\centering\begin{tikzpicture}[mindmap]
    \tikzstyle{every node}=[font=\fontsize{2mm}{3mm}\selectfont,text width=1cm,align=flush center,minimum size=1cm]
         \node [concept, text=white] at (0,0) 
      {any other text}
    child [concept color=blue!50, grow=0,level distance=80]
    {node [concept] (text) {Text}}; 
\end{tikzpicture}
\end{document}

我自己回答時的圖

答案2

如果您願意lualatex使用 OpenType 字體(而不是舊的 TeX Type 1 字體)進行編譯,您可以獲得您喜歡的任何大小和間距,甚至是非整數值。使用像這樣的包,textpos您可以將文字放置在任何地方,但我不會在這裡編寫程式碼。微量元素:

\documentclass{article} % Default font size. Process with lualatex.
\usepackage{fontspec}
\makeatletter
\renewcommand\normalsize{\@setfontsize\normalsize{11.43pt}{15.824pt}}
\normalsize
\makeatother
\begin{document}
\setlength\parindent{0pt}
Hello World.\\
Hello World\\
Hello World\par
\makeatletter
\renewcommand\normalsize{\@setfontsize\normalsize{13.723bp}{17.448bp}}
\normalsize
\makeatother
Hello Again\\
Hello Again\\
Hello Again\par
\end{document}
\\\
Compile that with `lualatex` and look at the resulting PDF.

相關內容