1

The code below makes the output figure to be in full page width. I need to have the same output figure with the width of column (width of 3.9 in).

I tried to use this command for the figure produced by the below code \includegraphics[width=0.45\textwidth]{figures/selection.pdf} But the picture was relatively small and the text size was not readable as in following picture. How to use tkiz package to draw the same protocol but within the column width of 2 column paper with having readable text inside? enter image description here

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{positioning,calc,arrows.meta}
\begin{document}
\begin{tikzpicture}[%
block/.style={rectangle, draw, fill=blue!10, text width=5em, text centered,
rounded corners},line/.style={draw, -latex},arrow/.style={draw, -latex}]

  \node[block,text width=3.cm, align=center,font=\bfseries](man) at (0,0){Device A};
  \node[block,text width=3cm,right=5cm of man, align=center,font=\bfseries](smart) {Device B};
  \node[block,text width=3cm,right=5cm of smart,align=center,font=\bfseries](recv) {Device C};

  \path[line, line width=0.5mm] (man.south) -- ($(man)+(0,-8)$);
  \path[line, line width=0.5mm] (smart.south) -- ($(smart)+(0,-8)$);
  \path[line, line width=0.5mm] (recv.south) -- ($(recv)+(0,-8)$);

  \path [arrow, text width=4.5cm, align=left] ($(man)+(0,-0.5)$) -- ++(0.5cm,0cm) |- node[near start, right] { 
  \begin{tabular}{ll}
   Computes & $G^R_0= M^R_0$ \\  Computes & $G^R_n = l^R_n$\\ Picks & $I^R_0  = t^R_0$
   \end{tabular}} ($(man)+(0,-1.7)$);
  \draw[-{Latex[length=3mm, width=2mm]}] ($(man)+(0,-3)$) to node [above, black]{$T(R)=X^R_0, X^R_0, Y^R_d $} ($(smart)+(0,-3)$);
  \path [arrow, text width=4.5cm, align=left] ($(recv)+(0,-1.5)$) -- ++(0.5cm,0cm) |- node[near start, right] 
  {\begin{tabular}{ll}
    Picks & $Z^R_0 \leftarrow l^R_0$ \\ 
    computes & $Z^R_n \leftarrow l^R_n$\\ 
    & $I^R_0  \leftarrow t^R_0$
    \end{tabular}} ($(recv)+(0,-2.9)$);
  \draw[-{Latex[length=3mm, width=2mm]}] ($(recv)+(0,-3.8)$) to 
  node[above, black]{$S^{D_1}_0, S^{D_1}_n, t^{D_1}_0, t^{M_1}_n, F_{M_1}$} ($(smart)+(0,-3.8)$);
  \path [arrow, text width=4.5cm, align=left] ($(smart)+(0,-4.5)$) 
  -- ++(0.5cm,0cm) |- node[near start, right] {
  \begin{tabular}{ll}
   Picks & $Z^R_0 \leftarrow l^R_0$ \\ 
   computes &  $Z^R_n \leftarrow l^R_n$\\ 
   & $I^R_0  \leftarrow t^R_0$
  \end{tabular}} ($(smart)+(0,-5.9)$);
\end{tikzpicture}
\end{document}

Note that: this nice answer from Is there an efficient way to edit the following UML

0

1 Answer 1

2

try

\includegraphics[width=\columnwidth]{figures/selection.pdf}

and set in standalone image border=0pt.

if you provide example of document (with dummy text) than i will be able to test how will works the following improvements of your image code in your document:

\documentclass[tikz,border=0pt]{standalone}
\usetikzlibrary{arrows.meta, calc, positioning, quotes}

\begin{document}
    \begin{tikzpicture}[
node distance = 3mm and 17mm,
 block/.style = {draw, rounded corners, fill=blue!10,
                 font=\bfseries},
  line/.style = {line width=0.5mm, -Latex},
 arrow/.style = {draw, -Latex}
                    ]
\node (man)   [block]                {Device A};
\node (smart) [block,right=of man]   {Device B};
\node (recv)  [block,right=of smart] {Device C};
%
\draw[line] (man.south)   edge ++ (0,-6.6)
            (smart.south) edge ++ (0,-6.6)
            (recv.south)   to  ++ (0,-6.6);
%
\draw[arrow]
    ($(man)+(0,-0.5)$) -- ++(0.4,0)
                        |- node[near start, right] {\begin{tabular}{@{} l @{\ }l@{}}
                                   Computes & $G^R_0= M^R_0$ \\
                                   Computes & $G^R_n = l^R_n$\\
                                   Picks & $I^R_0  = t^R_0$
                                                \end{tabular} }
    ($(man)+(0,-1.7)$);
\draw[arrow,thick]
    ($(man)+(0,-3)$)     to ["${T(R)=X^R_0, X^R_0, Y^R_d}$"] ($(smart)+(0,-3)$);
\draw[arrow,thick]
    ($(recv)+(0,-3.8)$)  to ["${S^{D_1}_0, S^{D_1}_n, t^{D_1}_0, t^{M_1}_n, F_{M_1}}$" '] ($(smart)+(0,-3.8)$);
\draw[arrow]
    ($(recv)+(0,-1.5)$) -- ++(0.4,0)
                        |- node[near start, right] {\begin{tabular}{@{} l @{\ }l@{}}
                                  Picks     & $Z^R_0 \leftarrow l^R_0$ \\
                                  Computes  & $Z^R_n \leftarrow l^R_n$\\
                                            & $I^R_0 \leftarrow t^R_0$
                                                    \end{tabular}}
    ($(recv)+(0,-2.9)$);
\path[arrow]
    ($(smart)+(0,-4.5)$) -- ++(0.4cm,0cm)
                        |- node[near start, right] {\begin{tabular}{@{} l @{\ }l@{}}
                                   Picks    & $Z^R_0 \leftarrow l^R_0$ \\
                                   Computes &  $Z^R_n \leftarrow l^R_n$\\
                                            & $I^R_0  \leftarrow t^R_0$
                                                    \end{tabular}}
    ($(smart)+(0,-5.9)$);
\end{tikzpicture}
\end{document}

which widths is about 113mm.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .