我使用tkiz
LaTeX 绘制图片。它与我一起使用\documentclass[border=5pt,tikz]{standalone}
。但是,当我尝试在原始 LaTeX 文件中使用相同的代码时\documentclass[english]{IEEEtran}
,它不适合论文。我如何编辑以下代码以在我的 LaTeX 文件中使用它?
\documentclass[border=5pt,tikz]{standalone}
\usetikzlibrary{arrows,positioning}
\newcommand{\parallelsum}{\mathbin{\|}}
\newcommand{\point}{\textbullet\hspace{1em}}
\everymath{\displaystyle}
\begin{document}
\begin{tikzpicture}[every node/.style={inner sep=6pt,draw,anchor=east},>=triangle 60]
\node[xshift=1cm] (a) {\textcolor{red}{$V_1$ generate a temporary key pairs} $[Pk^{1}_{v_{1}}, Pr^{1}_{v_{1}}]$};
\draw[->,cyan] ([yshift=.3cm,xshift=2cm]a.east) --+ (5,0) node[black,midway,above=.1cm] {$Pk^{1}_{v_{1}}$};
\draw[<-,cyan] ([yshift=-.3cm,xshift=2cm]a.east) --+ (5,0) node[black,midway,below=.1cm] {$\mathcal{T}_{1}= {M_{1} || Sh_{R_{1}}}$};
\node[right=9.5 of a,yellow!70!black,fill=yellow] (b) {\Huge\textcolor{white}{$R_1$}};
\node[right=1 of b] {
\begin{tabular}{l}
\point Generate: $M_1 = \{Pk^{1}_{v_{1}}, \textcolor{red}{\mathrm{tag}_{\mathrm{he}_1,R_1}}\}$ \\
\point Calculate: $\mathrm{S}_{R_1}(M_1)$
\end{tabular}
};
\begin{scope}[yshift=-3cm]
\node (a) {
\begin{tabular}{p{7cm}}
\textcolor{blue}{\point Run the PoW algorithm to get $S_{\mathcal{T}_{1}}$} \\
\point $L_{R_{1}}=({\mathcal{T}_{1}||S_{\mathcal{T}_{1}}|| Pk^{2}_{v_{1}} ) || \sigma_{Pr^{1}_{v_{1}}}(\mathcal{T}_{1}||S_{\mathcal{T}_{1}}|| Pk^{2}_{v_{1}}}) $
\end{tabular}
};
\draw[->,cyan] ([yshift=.3cm,xshift=1cm]a.east) --+ (5,0) node[black,midway,above=.1cm] { $\mathrm{L}_{R_1}$};
\draw[<-,cyan] ([yshift=-.1cm,xshift=1cm]a.east) --+ (5.8,0) node[text width=5.8cm,black,midway,below=.1cm] { $\mathcal{T}_{2}= \{\mathcal{T}_{1} ||Sh_{R_{2}}(M_{1}) || M_{2} || Sh_{R_{2}}(M_{2} )\} $};
\node[right=8.5 of a,yellow!70!black,fill=yellow] (b) {\Huge\textcolor{white}{$R_2$}};
\node[right=1 of b] (c) {
\begin{tabular}{l}
\point Verify $\mathrm{L}_{R_1}$ and Shares. \\
\point Checks if: $(t_r-t_1)<\mathrm{Certain\ target\ value}$ \\
\point $M_{2}=\{Pk^{2}_{v_{1}} || (t_{1}, Tag_{R_{1}}) || (t_{2}, Tag_{R_{2}})\}$ \\
\point Calculate: $Sh_{R_{3}}(M_{2})$ \\
\point Calculate: $Sh_{R_{3}}(M_{3})$\\
\end{tabular}
};
\end{scope}
\draw[o-o,dashed] ([yshift=1.5cm]a.west) -- ([yshift=1.5cm]c.east);
\end{tikzpicture}
\end{document}
答案1
这是你想要的?
\documentclass[conference]{IEEEtran}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning}
\newcommand{\parallelsum}{\mathbin{\|}}
\newcommand{\point}{\textbullet\hspace{1em}}
\everymath{\displaystyle}
\usepackage{lipsum}% MWE only
\begin{document}
\begin{figure*}[tp]
\resizebox{\textwidth}{!}{%
\begin{tikzpicture}[every node/.style={inner sep=6pt,draw,anchor=east},>=triangle 60]
\node[xshift=1cm] (a) {\textcolor{red}{$V_1$ generate a temporary key pairs} $[Pk^{1}_{v_{1}}, Pr^{1}_{v_{1}}]$};
\draw[->,cyan] ([yshift=.3cm,xshift=2cm]a.east) --+ (5,0) node[black,midway,above=.1cm] {$Pk^{1}_{v_{1}}$};
\draw[<-,cyan] ([yshift=-.3cm,xshift=2cm]a.east) --+ (5,0) node[black,midway,below=.1cm] {$\mathcal{T}_{1}= {M_{1} || Sh_{R_{1}}}$};
\node[right=9.5 of a,yellow!70!black,fill=yellow] (b) {\Huge\textcolor{white}{$R_1$}};
\node[right=1 of b] {
\begin{tabular}{l}
\point Generate: $M_1 = \{Pk^{1}_{v_{1}}, \textcolor{red}{\mathrm{tag}_{\mathrm{he}_1,R_1}}\}$ \\
\point Calculate: $\mathrm{S}_{R_1}(M_1)$
\end{tabular}
};
\begin{scope}[yshift=-3cm]
\node (a) {
\begin{tabular}{p{7cm}}
\textcolor{blue}{\point Run the PoW algorithm to get $S_{\mathcal{T}_{1}}$} \\
\point $L_{R_{1}}=({\mathcal{T}_{1}||S_{\mathcal{T}_{1}}|| Pk^{2}_{v_{1}} ) || \sigma_{Pr^{1}_{v_{1}}}(\mathcal{T}_{1}||S_{\mathcal{T}_{1}}|| Pk^{2}_{v_{1}}}) $
\end{tabular}
};
\draw[->,cyan] ([yshift=.3cm,xshift=1cm]a.east) --+ (5,0) node[black,midway,above=.1cm] { $\mathrm{L}_{R_1}$};
\draw[<-,cyan] ([yshift=-.1cm,xshift=1cm]a.east) --+ (5.8,0) node[text width=5.8cm,black,midway,below=.1cm] { $\mathcal{T}_{2}= \{\mathcal{T}_{1} ||Sh_{R_{2}}(M_{1}) || M_{2} || Sh_{R_{2}}(M_{2} )\} $};
\node[right=8.5 of a,yellow!70!black,fill=yellow] (b) {\Huge\textcolor{white}{$R_2$}};
\node[right=1 of b] (c) {
\begin{tabular}{l}
\point Verify $\mathrm{L}_{R_1}$ and Shares. \\
\point Checks if: $(t_r-t_1)<\mathrm{Certain\ target\ value}$ \\
\point $M_{2}=\{Pk^{2}_{v_{1}} || (t_{1}, Tag_{R_{1}}) || (t_{2}, Tag_{R_{2}})\}$ \\
\point Calculate: $Sh_{R_{3}}(M_{2})$ \\
\point Calculate: $Sh_{R_{3}}(M_{3})$\\
\end{tabular}
};
\end{scope}
\draw[o-o,dashed] ([yshift=1.5cm]a.west) -- ([yshift=1.5cm]c.east);
\end{tikzpicture}
}
\caption{Sort of obligatory}
\end{figure*}
\lipsum[1-16]
\end{document}
答案2
我尝试重新设计你的图片,并提前为所犯的所有错误道歉,例如错误地破坏了你的公式。
\documentclass[english]{IEEEtran}
\usepackage{tikz,tikzpagenodes} % tikzpagenodes only for illustration
\usetikzlibrary{arrows.meta,positioning}
\newcommand{\parallelsum}{\mathbin{\|}}
\everymath{\displaystyle}
\begin{document}
\begin{tikzpicture}[every node/.style={inner sep=2pt,draw,anchor=east},
>={Triangle},R-block/.style={text width=0.35\textwidth},
L-block/.style={text width=0.25\textwidth}]
% start with the R nodes
\node[yellow!70!black,fill=yellow,text=white,font=\Huge] (b){$R_1$};
\node[left=4cm of b,L-block] (a) {\textcolor{red}{$V_1$ generate a temporary key pairs} $[Pk^{1}_{v_{1}}, Pr^{1}_{v_{1}}]$};
\draw[->,cyan] ([yshift=.3cm]a.east) -- ([yshift=.3cm]a.east -|b.west)
node[black,midway,above=.1cm] {$Pk^{1}_{v_{1}}$};
\draw[<-,cyan] ([yshift=-.3cm]a.east) -- ([yshift=-.3cm]a.east -|b.west)
node[black,midway,below=.1cm] {$\mathcal{T}_{1}= {M_{1} || Sh_{R_{1}}}$};
\node[right=2mm of b,R-block] (c) {\vspace{-1ex}\begin{itemize}
\item Generate: $M_1 = \{Pk^{1}_{v_{1}}, \textcolor{red}{\mathrm{tag}_{\mathrm{he}_1,R_1}}\}$ \\
\item Calculate: $\mathrm{S}_{R_1}(M_1)$
\end{itemize}
};
\node[below=2.5cm of b,text=white,font=\Huge,fill=yellow] (b') {$R_2$};
\node[left=4cm of b',L-block] (a') {\vspace{-1ex}\begin{itemize}
\item Run the PoW algorithm to get $S_{\mathcal{T}_{1}}$
\item $L_{R_{1}}=(\mathcal{T}_{1}||S_{\mathcal{T}_{1}}||Pk^{2}_{v_{1}} )$
$ ||\sigma_{Pr^{1}_{v_{1}}}(\mathcal{T}_{1}||S_{\mathcal{T}_{1}}|| Pk^{2}_{v_{1}})$
\end{itemize}
};
\draw[->,cyan] ([yshift=.3cm]a'.east) -- ([yshift=.3cm]a'.east -|b'.west)
node[black,midway,above=.1cm] { $\mathrm{L}_{R_1}$};
\draw[<-,cyan] ([yshift=-.3cm]a'.east) -- ([yshift=-.3cm]a'.east -|b'.west)
node[text width=3cm,black,midway,below=.1cm,align=center]
{ $\mathcal{T}_{2}= \{\mathcal{T}_{1} |$ $|Sh_{R_{2}}(M_{1}) |$ $| M_{2} || Sh_{R_{2}}(M_{2} )\} $};
\node[right=2mm of b',R-block] (c') {\vspace{-1ex}\begin{itemize}
\item Verify $\mathrm{L}_{R_1}$ and Shares.
\item Checks if: $(t_r-t_1)<\mathrm{Certain\ target\ value}$
\item $M_{2}=\{Pk^{2}_{v_{1}} || (t_{1}, Tag_{R_{1}}) || (t_{2}, Tag_{R_{2}})\}$
\item Calculate: $Sh_{R_{3}}(M_{2})$
\item Calculate: $Sh_{R_{3}}(M_{3})$
\end{itemize}
};
\path (c'.north east) -- (c.south east) coordinate[midway] (R);
\draw[{Circle[open]}-{Circle[open]},dashed] (R) -- (R-|a.west);
\end{tikzpicture}
% only for illustation
\begin{tikzpicture}[overlay,remember picture]
\draw[red,dashed] (current page text area.south west) rectangle
(current page text area.north east);
\end{tikzpicture}
\end{document}