我还有另一个与“思维导图”相关的问题。我修改了一个例子texample.net得到以下内容:
\documentclass[10pt]{standalone}
\usepackage[svgnames]{xcolor}
% Font Settings
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{stix}
\usepackage{csquotes}
\usepackage[english]{babel}
\usepackage[protrusion,expansion,babel,final]{microtype}
\usepackage{tikz}
\usetikzlibrary{mindmap}
% Information Boxes
\newcommand*{\info}[4][16.3]{%
\node [ annotation, #3, scale=0.9, text width = #1em,
inner sep = 2mm ] at (#2) {%
\list{$\bullet$}{\topsep=0pt\itemsep=0pt\parsep=0pt
\parskip=0pt\labelwidth=8pt\leftmargin=8pt
\itemindent=0pt\labelsep=2pt}%
#4
\endlist
};
}
\begin{document}
\begin{tikzpicture}
\path[mindmap,concept color=Gainsboro,text=Black]
node[concept] (CORE) {CS Core}
[clockwise from=0]
child[concept] { node[concept] (AI) {AI Track} }
child[concept] { node[concept] (Theory) {Theory Track} }
child[concept] { node[concept] (Systems) {Systems Track} }
child[concept] { node[concept] (Games) {Game Programming Track} }
child[concept] { node[concept] (SE) {Software Engineering Track} }
child[concept] { node[concept] (IT) {Internet Technologies Track} }
;
\info{CORE.north east}{above,yshift=2em}{
\item Mathematical Foundations
\item Imperative Programming
\item Introduction to Algorithms
\item Data Structures
\item Systems Programming
\item Theory of Computation
\item Intro to Computer Architecture
}
\info{IT.north east}{right}{
\item Computer Networks
\item Programming on the Internet
\item Advanced Java Programming
\item \dots
}
\info{AI.north east}{above}{
\item Concepts of Programming Languages
\item Natural Language Processing
\item Introduction to AI
\item \dots
}
\info{Theory.north east}{right}{
\item Concepts of Programming Languages
\item Graph Theory
\item \dots
}
\info{Systems.north east}{above}{
\item Computer Networks
\item Operating Systems
\item Advanced Computer Architecture
\item \dots
}
\info{Games.north east}{above}{
\item Intro to Game Programming
\item Advanced Game Programming
\item Computer Graphics
\item \dots
}
\info{SE.north east}{right}{
\item Software Engineering
\item Software Carpentry
\item \dots
}
;
\end{tikzpicture}
\end{document}
其结果如下:
这一切都很好,但我想修改信息框,使其轮廓清晰,并更靠近各自的节点居中。例如,对于软件工程和互联网技术,我希望信息框位于相应节点的正上方,而理论和系统则位于正下方。人工智能和游戏编程分别位于右侧和左侧的中心。
我尝试在信息框周围绘制以下框:
\documentclass[10pt]{standalone}
\usepackage[svgnames]{xcolor}
% Font Settings
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{stix}
\usepackage{csquotes}
\usepackage[english]{babel}
\usepackage[protrusion,expansion,babel,final]{microtype}
\usepackage{tikz}
\usetikzlibrary{mindmap}
% Information Boxes
\newcommand*{\info}[4][16.3]{%
\node [ annotation, #3, scale=0.9, text width = #1em,
inner sep = 2mm ] at (#2) {%
\list{$\bullet$}{\topsep=0pt\itemsep=0pt\parsep=0pt
\parskip=0pt\labelwidth=8pt\leftmargin=8pt
\itemindent=0pt\labelsep=2pt}%
#4
\endlist
};
}
\begin{document}
\begin{tikzpicture}[every annotation/.style = {draw,fill=white}]
\path[mindmap,concept color=Gainsboro,text=Black]
node[concept] (CORE) {CS Core}
[clockwise from=0]
child[concept] { node[concept] (AI) {AI Track} }
child[concept] { node[concept] (Theory) {Theory Track} }
child[concept] { node[concept] (Systems) {Systems Track} }
child[concept] { node[concept] (Games) {Game Programming Track} }
child[concept] { node[concept] (SE) {Software Engineering Track} }
child[concept] { node[concept] (IT) {Internet Technologies Track} }
;
\info{CORE.north east}{above,yshift=2em}{
\item Mathematical Foundations
\item Imperative Programming
\item Introduction to Algorithms
\item Data Structures
\item Systems Programming
\item Theory of Computation
\item Intro to Computer Architecture
}
\info{IT.north east}{right}{
\item Computer Networks
\item Programming on the Internet
\item Advanced Java Programming
\item \dots
}
\info{AI.north east}{above}{
\item Concepts of Programming Languages
\item Natural Language Processing
\item Introduction to AI
\item \dots
}
\info{Theory.north east}{right}{
\item Concepts of Programming Languages
\item Graph Theory
\item \dots
}
\info{Systems.north east}{above}{
\item Computer Networks
\item Operating Systems
\item Advanced Computer Architecture
\item \dots
}
\info{Games.north east}{above}{
\item Intro to Game Programming
\item Advanced Game Programming
\item Computer Graphics
\item \dots
}
\info{SE.north east}{right}{
\item Software Engineering
\item Software Carpentry
\item \dots
}
;
\end{tikzpicture}
\end{document}
但这会产生太宽并与主图形重叠的节点:
我该如何修复过宽的框轮廓和信息框定位?
答案1
欢迎!您可以利用这样一个事实:您可以使用角度作为锚点,并以above
正或负距离的形式提供相对位置,使注释text width
更小,而不是绘制它们的边界。
\documentclass[10pt]{standalone}
\usepackage[svgnames]{xcolor}
% Font Settings
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{stix}
\usepackage{csquotes}
\usepackage[english]{babel}
\usepackage[protrusion,expansion,babel,final]{microtype}
\usepackage{tikz}
\usetikzlibrary{mindmap}
% Information Boxes
\newcommand*{\info}[4][7]{%
\node [ annotation, scale=0.9, text width = #1em, #3,
inner sep = 2mm ] at (#2) {%
\list{$\bullet$}{\topsep=0pt\itemsep=0pt\parsep=0pt
\parskip=0pt\labelwidth=8pt\leftmargin=8pt
\itemindent=0pt\labelsep=2pt}%
#4
\endlist
};
}
\begin{document}
\begin{tikzpicture}[every annotation/.style = {draw=none}]
\path[mindmap,concept color=Gainsboro,text=Black]
node[concept] (CORE) {CS Core}
[clockwise from=0]
child[concept] { node[concept] (AI) {AI Track} }
child[concept] { node[concept] (Theory) {Theory Track} }
child[concept] { node[concept] (Systems) {Systems Track} }
child[concept] { node[concept] (Games) {Game Programming Track} }
child[concept] { node[concept] (SE) {Software Engineering Track} }
child[concept] { node[concept] (IT) {Internet Technologies Track} }
;
\info{IT.165}{anchor=north east,xshift=1.5em}{
\item Mathematical Foundations
\item Imperative Programming
\item Introduction to Algorithms
\item Data Structures
\item Systems Programming
\item Theory of Computation
\item Intro to Computer Architecture
}
\info{IT.north east}{right}{
\item Computer Networks
\item Programming on the Internet
\item Advanced Java Programming
\item \dots
}
\info{AI.north east}{above=1ex}{
\item Concepts of Programming Languages
\item Natural Language Processing
\item Introduction to AI
\item \dots
}
\info{Theory.north east}{right}{
\item Concepts of Programming Languages
\item Graph Theory
\item \dots
}
\info{Systems.north}{above left=-1.5em}{
\item Computer Networks
\item Operating Systems
\item Advanced Computer Architecture
\item \dots
}
\info{Games.north east}{above=1ex}{
\item Intro to Game Programming
\item Advanced Game Programming
\item Computer Graphics
\item \dots
}
\info{SE.north east}{right}{
\item Software Engineering
\item Software Carpentry
\item \dots
}
;
\end{tikzpicture}
\end{document}
如果您确实需要在注释周围添加框,您可以这样做,但恕我直言,这看起来不太好。
\documentclass[10pt]{standalone}
\usepackage[svgnames]{xcolor}
% Font Settings
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{stix}
\usepackage{csquotes}
\usepackage[english]{babel}
\usepackage[protrusion,expansion,babel,final]{microtype}
\usepackage{tikz}
\usetikzlibrary{mindmap}
% Information Boxes
\newcommand*{\info}[4][7]{%
\node [ annotation, scale=0.9, text width = #1em, #3,
inner sep = 2mm ] at (#2) {%
\list{$\bullet$}{\topsep=0pt\itemsep=0pt\parsep=0pt
\parskip=0pt\labelwidth=8pt\leftmargin=8pt
\itemindent=0pt\labelsep=2pt}%
#4
\endlist
};
}
\begin{document}
\begin{tikzpicture}[every annotation/.style = {draw,fill=white}]
\path[mindmap,concept color=Gainsboro,text=Black]
node[concept] (CORE) {CS Core}
[clockwise from=0]
child[concept] { node[concept] (AI) {AI Track} }
child[concept] { node[concept] (Theory) {Theory Track} }
child[concept] { node[concept] (Systems) {Systems Track} }
child[concept] { node[concept] (Games) {Game Programming Track} }
child[concept] { node[concept] (SE) {Software Engineering Track} }
child[concept] { node[concept] (IT) {Internet Technologies Track} }
;
\info{IT.165}{anchor=north east,xshift=0.2em}{
\item Mathematical Foundations
\item Imperative Programming
\item Introduction to Algorithms
\item Data Structures
\item Systems Programming
\item Theory of Computation
\item Intro to Computer Architecture
}
\info{IT.north east}{right=1em}{
\item Computer Networks
\item Programming on the Internet
\item Advanced Java Programming
\item \dots
}
\info{AI.north east}{above=2ex}{
\item Concepts of Programming Languages
\item Natural Language Processing
\item Introduction to AI
\item \dots
}
\info{Theory.north east}{right=1ex}{
\item Concepts of Programming Languages
\item Graph Theory
\item \dots
}
\info{Systems.north}{above left}{
\item Computer Networks
\item Operating Systems
\item Advanced Computer Architecture
\item \dots
}
\info{Games.north east}{above=2ex}{
\item Intro to Game Programming
\item Advanced Game Programming
\item Computer Graphics
\item \dots
}
\info{SE.north east}{above right}{
\item Software Engineering
\item Software Carpentry
\item \dots
}
;
\end{tikzpicture}
\end{document}