我正在嘗試在 TikZ 中繪製 Kripke 結構,雖然我在很大程度上是成功的,但我對結果不太滿意。這是我的序言:
\documentclass[10pt,letterpaper]{amsart}
% Personal Packages
\usepackage{notation}
% TikZ Drawing packages
\usepackage{tikz}
\usetikzlibrary{arrows}
% Font and Typography Settings
\usepackage{concrete}
\usepackage{euler}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[babel=true]{microtype}
接下來是我的 MWE:
\begin{figure}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
thick,base node/.style={circle,draw}, real node/.style={double,circle,draw}]
\node[real node] (1) {$s(C)$};
\node[base node] (2) [below left of=1] {$s(\alpha)$};
\node[base node] (3) [below right of=1] {$\neg{s(\alpha)}$};
\path[]
(1) edge node[left] {$L,J$} (2)
edge node[right] {$L,J$} (3)
edge [loop above] node {$C$} (1)
(2) edge [bend left] node {$C,L,J$} (3)
edge [loop left] node {$C,L,J$} (2)
(3) edge [bend left] node {$C,L,J$} (2)
edge [loop right] node {$C,L,J$} (3);
\end{tikzpicture}
\caption{The initial state of the domain in Ex.~\ref{ex:whisper}.}
\end{figure}
我遇到的困難是節點3
比節點大2
(大概是因為它正在調整自身大小以適應標籤文字)。有什麼辦法可以讓節點都有相同的大小嗎?另外,任何有關如何使圖表更美觀的建議將不勝感激(我來自 OmniGraffle,過渡有點困難)。
答案1
您可以使用以下minimum size=
密鑰:
\documentclass[10pt,letterpaper]{amsart}
% Personal Packages
%\usepackage{notation}
% TikZ Drawing packages
\usepackage{tikz}
\usetikzlibrary{arrows}
% Font and Typography Settings
\usepackage{concrete}
\usepackage{euler}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[babel=true]{microtype}
\begin{document}
\begin{figure}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
thick,base node/.style={circle,draw,minimum size=35pt}, real node/.style={double,circle,draw,minimum size=35pt}]
\node[real node] (1) {$s(C)$};
\node[base node] (2) [below left of=1] {$s(\alpha)$};
\node[base node] (3) [below right of=1] {$\neg{s(\alpha)}$};
\path[]
(1) edge node[left] {$L,J$} (2)
edge node[right] {$L,J$} (3)
edge [loop above] node {$C$} (1)
(2) edge [bend left] node {$C,L,J$} (3)
edge [loop left] node {$C,L,J$} (2)
(3) edge [bend left] node {$C,L,J$} (2)
edge [loop right] node {$C,L,J$} (3);
\end{tikzpicture}
\caption{The initial state of the domain in Ex.~\ref{ex:whisper}.}
\end{figure}
\end{document}
來自 pgf 手冊:
最好使用該
minimum size
選項。此選項允許 > Hagen 指定節點應具有的最小大小。如果由於文字較長而節點實際上需要更大,則節點會更大,但如果文字為空,則節點將具有最小大小。此選項還可用於確保包含不同文字量的多個節點具有相同的大小。