在這張圖中,我試圖創建我的論文所涵蓋的主題地圖。我只是複製並更改了該網站上已有內容的元素。我將不勝感激任何進一步的修改,透過減少盒子來縮小整體圖片。我想刪除 A、B、C 和鴨子的註釋(它們可以用第 2、3、4 和 5 章代替,其中中心章節已經是第 1 章了。
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes.misc}
\tikzset{
figNode/.style={
path picture={
\node at (path picture bounding box.center) {#1};}}
}
\begin{document}
\begin{tikzpicture}[thick]
\node (a) at (60:10){};
\node (b) at (20:10){};
\node (c) at (-20:10){};
\node (d) at (-60:10){};
%\node (e) at (-80: 10){};
\foreach \r/\c in {90/blue,45/green,0/red,-45/yellow}{
\fill[\c!50] (0,0) -- (\r:4) arc (\r:\r-45:4) -- cycle;
};
\foreach \r/\c/\p in {67.5/blue/a,22.5/green/b,-22.5/red/c,-67.5/yellow/d}{
\draw[\c] (\r:4) -- (\p);
\fill[gray!50] (\r:4) circle (0.5);
\fill[\c] (\r:4) circle (0.25);
};
\draw[fill=white] (0,0) circle (3) node[align=center]{Chapter 1: Campactness};
\draw[rounded corners=25pt, fill=gray!50] (3.5,7) rectangle ++(7,3.5);
\draw[fill=blue!50, figNode={\includegraphics[width=0.2\textwidth]{example-image-a}}]
(a) circle (1);
\node[right=2 of a, rounded rectangle=25pt, rounded rectangle west arc=none, draw, fill=blue!50,
minimum height=2cm, minimum width=3cm] {Chapter 2: Degrees of compactness (Schauder's theorem and s-numbers)};
\draw[rounded corners=25pt, fill=gray!50] (7.8,1.6) rectangle ++(7,3.5);
\draw[fill=green!50, figNode={\includegraphics[width=0.2\textwidth]{example-image-b}}]
(b) circle (1);
\node[right=2 of b, rounded rectangle=25pt, rounded rectangle west arc=none, draw, fill=green!50,
minimum height=2cm, minimum width=3cm] {Chapter 3: Approximation Schemes ( Q-Compactness, Degrees of Q-compactness) };
\draw[rounded corners=25pt, fill=gray!50] (8,-5) rectangle ++(7,3.5);
\draw[fill=red!50, figNode={\includegraphics[width=0.2\textwidth]{example-image-c}}]
(c) circle (1);
\node[right=2 of c, rounded rectangle=25pt, rounded rectangle west arc=none, draw, fill=red!50,
minimum height=2cm, minimum width=3cm] {Chapter 4: Realizing certain approximation spaces as interpolation spaces (Applications of interpolation theory to PDEs)};
\draw[rounded corners=25pt, fill=gray!50] (3.2,-10.4) rectangle ++(7,3.5);
\draw[fill=yellow!50, figNode={\includegraphics[width=0.2\textwidth]{example-image-duck}}]
(d) circle (1);
\node[right=2 of d, rounded rectangle=25pt, rounded rectangle west arc=none, draw, fill=yellow!50,
minimum height=2cm, minimum width=3cm] {Chapter 5: H-Operators as applications of interpolation theory};
\end{tikzpicture}
\end{document}
答案1
這裡有一種方法可以為您提供更好的起點。
主要步驟:
- 將重構套用至您的程式碼,請參閱例如此處了解更多信息
\tikzset
已經figNode
過時了(圖像消失了)- 巨集並
\newcommand
簡化您的程式碼\graybox
\colorcirc
- 類似的(新)樣式
cmnnode
和cmnbox
- 使您的“章節節點”能夠使用更大的字體進行多行顯示
- 重構仍然可以更進一步,例如吸收多個
font
語句(但這始終取決於程式設計師)
筆記:宏已經提供了;
tikz 急需的分號。但如果您願意,您可以更改它,例如\graybox{(3.5,7)};
(只需將其放在那裡)。
記住:內部的節點文字{ }
接受任何 LaTeX“文字”,例如將某些單字加粗、在內部放置表格或圖像等。
您從這種方法中可以獲得什麼:
- 更乾淨的程式碼(美麗密碼),更多“口頭”地說明它將顯示的內容
- 「只改變一處」方法 (
styles
,\newcommand
) - 更容易進一步調整以滿足您的需求
建議:如果您還沒有完成,請花一些時間閱讀本文開頭的教程PGF手冊,並尋找此處使用的 tikz 命令,例如透過 pdf 中的搜尋/尋找或索引。
\documentclass[12pt,border=3mm]{standalone}% <<<---
\usepackage{tikz}
\usetikzlibrary{positioning,shapes.misc}
%\tikzset{% <<<--- became irrelevant from REFACTORING
% figNode/.style={
% path picture={
% \node at (path picture bounding box.center) {#1};}}
%}
% ~~~ macros (shorthand notations) from REFACTORING ~~~~~~~~~~~~~~~~~~~~~~~
\newcommand\graybox[1]{\draw[cmnbox] #1 rectangle ++(7,3.5);}% the gray boxes
\newcommand\colcirc[3]{% #1=color, #2=nodes name, #3=text
\draw[#1] (#2) circle (1);%
\node [font=\Large] at (#2) {#3};}% to put text, like 2, ch 2 etc.
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\begin{document}
\begin{tikzpicture}
[thick,
cmnnode/.style={rounded rectangle=25pt,% common node style
rounded rectangle west arc=none,
draw,
minimum height=2cm, minimum width=3cm,% these you had already
font=\Large,% larger fonts; \LARGE would be maximum
align=left,% for multilines, indicated by \\
inner sep=1em% give it a bit more space to breath
},
cmnbox/.style= {rounded corners=25pt,% common box style
fill=gray!50}
]
\node (a) at (60:10){};
\node (b) at (20:10){};
\node (c) at (-20:10){};
\node (d) at (-60:10){};
%\node (e) at (-80: 10){};
% ~~~ colored arc segments ~~~~~~~~~~~~~~~~~~~~
\foreach \r/\c in {90/blue,45/green,0/red,-45/yellow}{
\fill[\c!50] (0,0) -- (\r:4) arc (\r:\r-45:4) -- cycle;
};
% ~~~ small gray and colored circles ~~~~~~~~~~~~~~
\foreach \r/\c/\p in {67.5/blue/a,22.5/green/b,-22.5/red/c,-67.5/yellow/d}{
\draw[\c] (\r:4) -- (\p);
\fill[gray!50] (\r:4) circle (0.5);
\fill[\c] (\r:4) circle (0.25);
};
% ~~~ root-circle ~~~~~~~~~~~~~~~~
\draw[fill=white,font=\Large] (0,0) circle (3) node[align=center]{\textbf{Chapter 1}:\\ Campactness};% augmented: font, \\ (multiline), \textbf{} for bold text-part
% ~~~ 1st, blue ~~~~~~~~~~~~~~~~
\graybox{(3.5,7)} % simplified, see macro above
\colcirc{fill=blue!50}{a}{2} % simplified, see macro above
% reusing common node style, some bold text, \\ (multiline)
\node[right=2 of a, cmnnode, fill=blue!50] {\textbf{Chapter 2}: Degrees of compactness\\(Schauder's theorem and s-numbers)};
% ~~~ 2nd, green ~~~~~~~~~~~~~~~~~
\graybox{(7.8,1.6)}
\colcirc{fill=green!50}{b}{3}
\node[right=2 of b, cmnnode, fill=green!50] {\textbf{Chapter 3}: Approximation Schemes\\( Q-Compactness, Degrees of Q-compactness) };
% ~~~ 3rd, red ~~~~~~~~~~~~~~~~~
\graybox{(8,-5)}
\colcirc{fill=red!50}{c}{4}
\node[right=2 of c, cmnnode, fill=red!50] {Chapter 4: Realizing certain approximation spaces as interpolation\\spaces (Applications of interpolation theory to PDEs)};
% ~~~ 4th, yellow ~~~~~~~~~~~~~~~~~~~~~
\graybox{(3.2,-10.4)}
\colcirc{fill=yellow!50}{d}{5}
\node[right=2 of d, cmnnode, fill=yellow!50] {Chapter 5: H-Operators as applications of interpolation theory};
\end{tikzpicture}
\end{document}