抽奖途中如何制作标签?
目前,我的标签“跨越”了抽签。
这是我的 MWE:
\documentclass{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows,arrows.meta,
backgrounds, bending,
calc, chains,
%decorations.pathmorphing,
fit,
%petri,
positioning,
trees,
quotes,
shapes.misc}
\definecolor{darkblue}{RGB}{31,22,70}
\definecolor{darkblue2}{RGB}{21,126,251}
\usepackage{graphicx}
\usepackage{float}
\begin{document}
\begin{figure}[H]
\centering
\resizebox{\textwidth}{!}{
\begin{tikzpicture}
\coordinate (b) at (current page.center);
\node[minimum height=1cm,minimum width=2cm,rounded corners,draw=white, fill=darkblue2!50,very thick,font=\sffamily\color{white}]at(b)(MQTT){MQTT};
\node[label={[name=1]above:\Large{Orchestrateur}},left=2 cm of MQTT](admin){\includegraphics[scale=0.8]{example-image-b}};
\node[label={[name=1]above:\Large{Edge Node 1}},above right=of MQTT](node1){\includegraphics[scale=0.8]{example-image-b}};
\node [label={[name=1]below:deviceTwin}]at(node1)(dt1){\includegraphics[scale=0.04]{example-image-a}};
\node [label={[name=1]below:\Large{Edge Node 2}},below right=of MQTT](node2){\includegraphics[scale=0.8]{example-image-a}};
\node [label={[name=1]below:deviceTwin}]at(node2)(dt2){\includegraphics[scale=0.04]{example-image-a}};
\draw[arrows={-triangle 90}, darkblue, thick](admin)--node[above]{Publish}(MQTT);
\draw[arrows={triangle 90-triangle 90}, darkblue, thick](MQTT)--node[above]{Publish/Subscribe}(dt1);
\draw[arrows={triangle 90-triangle 90}, darkblue, thick](MQTT)--node[above]{Publish/Subscribe}(dt2);
\end{tikzpicture}
}
\end{figure}
\end{document}
谢谢!
答案1
该选项sloped
似乎正是您要找的。请参阅相关邮政,您可以简单地使用:
node[above, sloped] {Publish/Subscribe}
您的代码及应用选项:
\documentclass{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows,arrows.meta,
backgrounds, bending,
calc, chains,
%decorations.pathmorphing,
fit,
%petri,
positioning,
trees,
quotes,
shapes.misc}
\definecolor{darkblue}{RGB}{31,22,70}
\definecolor{darkblue2}{RGB}{21,126,251}
\usepackage{graphicx}
\usepackage{float}
\begin{document}
\begin{figure}[H]
\centering
\resizebox{\textwidth}{!}{
\begin{tikzpicture}
\coordinate (b) at (current page.center);
\node[minimum height=1cm,minimum width=2cm,rounded corners,draw=white, fill=darkblue2!50,very thick,font=\sffamily\color{white}]at(b)(MQTT){MQTT};
\node[label={[name=1]above:\Large{Orchestrateur}},left=2 cm of MQTT](admin){\includegraphics[scale=0.8]{example-image-b}};
\node[label={[name=1]above:\Large{Edge Node 1}},above right=of MQTT](node1){\includegraphics[scale=0.8]{example-image-b}};
\node [label={[name=1]below:deviceTwin}]at(node1)(dt1){\includegraphics[scale=0.04]{example-image-a}};
\node [label={[name=1]below:\Large{Edge Node 2}},below right=of MQTT](node2){\includegraphics[scale=0.8]{example-image-a}};
\node [label={[name=1]below:deviceTwin}]at(node2)(dt2){\includegraphics[scale=0.04]{example-image-a}};
\draw[arrows={-triangle 90}, darkblue, thick](admin)--node[above]{Publish}(MQTT);
\draw[arrows={triangle 90-triangle 90}, darkblue, thick](MQTT)--node[above, sloped]{Publish/Subscribe}(dt1);
\draw[arrows={triangle 90-triangle 90}, darkblue, thick](MQTT)--node[above, sloped]{Publish/Subscribe}(dt2);
\end{tikzpicture}
}
\end{figure}
\end{document}
以及相应的输出: