
PGFマニュアルから引用すると、
\begin{tikzpicture}
\draw [help lines] (0,0) grid (3,3);
\coordinate (a) at (rnd,rnd);
\coordinate (b) at (3-rnd,3-rnd);
\draw (a) -- (b);
\node (c) at (1,2) {x};
\draw let \p1 = ($ (a)!(c)!(b) - (c) $),
\n1 = {veclen(\x1,\y1)}
in circle [at=(c), radius=\n1];
\end{tikzpicture}
のサイズを大きくしたいのですが、x
同じ図に複数の円があることが問題です。一部の円には大きいサイズのフォントが必要ですが、他の円にはデフォルトで問題ありません。どうすればいいでしょうか?
答え1
通常の LaTeX と同じように、tikZ ノード内のフォント サイズを変更できます。次のいずれかを使用します。
\tiny
\scriptsize
\footnotesize
\small
\normalsize
\large
\Large
\LARGE
\huge
\Huge
例えば
\node (c) at (1,2) {\large x};
または
\node (c) at (1,2) {\large $x$}; %note the \large *outside* the inline math
編集: フォントサイズを変更するには内部数式モードでは、LaTeX は次のコマンドを提供します。
\displaystyle
\textstyle
\scriptstyle
\scriptscriptstyle
tikZ/pgf が提供するスケーリング アルゴリズム (例scale=...
) を使用すると、「文字全体」がスケーリングされるため、スケーリングをやりすぎると見苦しくなることがあります。上記のコマンドでフォント サイズを設定すると、LaTeX は異なるフォント サイズに対して異なるシンボルを選択します。これにより、フォントが読みやすくなり、十分な「詳細」が得られます。より極端なスケーリングが必要な場合は、scale=3.0
ノードのオプションを使用します。
答え2
後で使用するために新しいスタイルを設定します。
例えば:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{relsize}
\tikzset{fontscale/.style = {font=\relsize{#1}}
}
\begin{document}
\begin{tikzpicture}
\draw [help lines] (0,0) grid (3,3);
\coordinate (a) at (rnd,rnd);
\coordinate (b) at (3-rnd,3-rnd);
\draw (a) -- (b);
\node (c) at (1,2) [fontscale=4] {x};
\draw let \p1 = ($ (a)!(c)!(b) - (c) $),
\n1 = {veclen(\x1,\y1)}
in circle [at=(c), radius=\n1];
\end{tikzpicture}
\end{document}
答え3
一番上に書いて
\begin{tikzpicture}[thick,scale=1, every node/.style={scale=1.3}]
\draw [help lines] (0,0) grid (3,3);
\coordinate (a) at (rnd,rnd);
\coordinate (b) at (3-rnd,3-rnd);
\draw (a) -- (b);
\node (c) at (1,2) {x};
\draw let \p1 = ($ (a)!(c)!(b) - (c) $),
\n1 = {veclen(\x1,\y1)}
in circle [at=(c), radius=\n1];
\end{tikzpicture}
thick は矢印を変更し、最初の scale は描画のスケールを変更しますが、2 番目の引数はノード (おそらくテキストがある場所) のサイズを変更します。これはすべてのノードに対して変更されます。
答え4
font
コマンドのオプションを使用できます\node
。オプションは、(巨大なフォント サイズ、太字、サンセリフ)font
などの一般的なフォント コマンドを受け入れます。\node[font = {\Huge\bfseries\sffamily}, red]
(マニュアル。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\draw [help lines] (0,0) grid (3,3);
\coordinate (a) at (rnd,rnd);
\coordinate (b) at (3-rnd,3-rnd);
\draw (a) -- (b);
\node[font = {\normalfont}, red] (c) at (1,2) {x}; % <=== See here!
\draw let \p1 = ($ (a)!(c)!(b) - (c) $),
\n1 = {veclen(\x1,\y1)}
in circle [at=(c), radius=\n1];
\end{tikzpicture}
\begin{tikzpicture}
\draw [help lines] (0,0) grid (3,3);
\coordinate (a) at (rnd,rnd);
\coordinate (b) at (3-rnd,3-rnd);
\draw (a) -- (b);
\node[font = {\Huge\bfseries\sffamily}, red] (c) at (1,2) {x}; % <=== See here!
\draw let \p1 = ($ (a)!(c)!(b) - (c) $),
\n1 = {veclen(\x1,\y1)}
in circle [at=(c), radius=\n1];
\end{tikzpicture}
\end{document}
\tiny
\scriptsize
\footnotesize
\small
\normalsize
\large
\Large
\LARGE
\huge
\Huge
(マニュアル。