在LaTeX中直接绘制图形,非常方便,缺点是代码不熟练,需要一些案例辅助

\begin{tikzpicture}[auto,
box/.style = {draw, minimum height=17mm, align=left, outer sep=0pt},
lbl/.style = {anchor=north west, outer sep=0mm},
pin edge = {Straight Barb-, draw=black},
every edge/.style = {draw, semithick, -Straight Barb}
]\node (n1)  [box,
label={[lbl] north west:$\mathcal{C}_{\PRF}$},
pin=$1^n$]
{$\begin{aligned}\\K \leftarrow \gen(1^n)     \\b \xleftarrow{r} \{0,1\}   \\\text{Wenn } b = 0  \text{ denn } \vartheta_0 = F_K(\cdot)  \\\text{Wenn } b = 1  \text{ denn } \vartheta_1 = f(\cdot)    \\[1ex]\text{Wenn } b' = b \text{return } 1\\\text{Wenn } b' \neq b \text{ return } 0\\[5ex]\end{aligned}$
};\node (n3)  [box,
label={[lbl]north west:$\mathcal{A}$},
pin=$ k $,
right=9mm of n1 -| n1.east]
{$\begin{aligned}\\x = 0 \quad b                  \\x = 1 \quad a+b \rightarrow b  \\x = 2 \quad 2a+b               \\[1ex]\text{Wenn } b' = 0            \\\text{ sonst } b' = 1       \\\text{ return } b'          \\[5ex]\end{aligned}$
};\draw ([yshift=7mm] n1.east) coordinate (aux1) edge["$x$"] (aux1 -| n3.west)
([yshift=0mm] n1.east) coordinate (aux2) (aux2 -| n3.west) edge["$y$"] (aux2)
([yshift=-7ex] n3.west) edge["$b'$" '] ([yshift=-7ex] n1.east);
\end{tikzpicture}

代码导言区需要加入一些说明

\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning,quotes}
\usepackage{mathtools, amssymb}
\DeclareMathOperator{\gen}{Gen}
\DeclareMathOperator{\PRF}{PRF}

再画一个复杂点的图像

\begin{figure}\begin{tikzpicture}[auto,box/.style = {draw, minimum height=17mm, align=left, outer sep=0pt},lbl/.style = {anchor=north west, outer sep=0mm},pin edge = {Straight Barb-, draw=black},every edge/.style = {draw, semithick, -Straight Barb}]\node (n1)  [box, label={[lbl] north west:$\mathcal{C}_{\PRF}$},pin=$1^n$]{$\begin{aligned}\\K \leftarrow \gen(1^n)     \\b \xleftarrow{r} \{0,1\}   \\\text{Wenn } b = 0  \text{ denn } \vartheta_0 = F_K(\cdot)  \\\text{Wenn } b = 1  \text{ denn } \vartheta_1 = f(\cdot)    \\[1ex]\text{Wenn } b' = b \text{return } 1\\\text{Wenn } b' \neq b \text{ return } 0\\[5ex]\end{aligned}$};\node (n2)  [box, above right=-1ex and 0pt of n1.east]{$\vartheta_b(\cdot)$};\node (n3)  [box, label={[lbl]north west:$\mathcal{A}$},pin=$ k $,right=9mm of n1 -| n2.east]{$\begin{aligned}\\x = 0 \quad b                  \\x = 1 \quad a+b \rightarrow b  \\x = 2 \quad 2a+b               \\[1ex]\text{Wenn } b' = 0            \\\text{ sonst } b' = 1       \\\text{ return } b'          \\[5ex]\end{aligned}$};\draw   ([yshift=+2mm] n2.east) coordinate (aux1) edge["$x$"] (aux1 -| n3.west)([yshift=-2mm] n2.east) coordinate (aux2) (aux2 -| n3.west) edge["$y$"] (aux2)([yshift=-7ex] n3.west) edge["$b'$" '] ([yshift=-7ex] n1.east);\end{tikzpicture}
\end{figure}

\begin{tikzpicture}[auto,box/.style = {draw, minimum height=17mm, align=left, outer sep=0pt},lbl/.style = {anchor=north west, outer sep=0mm},pin edge = {Straight Barb-, draw=black},every edge/.style = {draw, -Straight Barb}]\node (n1)  [box, label={[lbl] north west:$\mathcal{C}_{\PRF}$},pin=$1^n$]{$\begin{aligned}\\K \leftarrow \gen(1^n)     \\b \xleftarrow{r} \{0,1\}   \\\text{Wenn } b = 0  \text{ denn } \vartheta_0 = F_K(\cdot)  \\\text{Wenn } b = 1  \text{ denn } \vartheta_1 = f(\cdot)    \\[1ex]\text{Wenn } b' = b \text{return } 1\\\text{Wenn } b' \neq b \text{ return } 0\\[5ex]\end{aligned}$};\node (n3)  [box, label={[lbl]north west:$\mathcal{A}$},pin=$ k $, right=9mm of n1 -| n1.east]{$\begin{aligned}\\x = 0 \quad b                  \\x = 1 \quad a+b \rightarrow b  \\x = 2 \quad 2a+b               \\[1ex]\text{Wenn } b' = 0            \\\text{ sonst } b' = 1       \\\text{ return } b'          \\[5ex]\end{aligned}$};\node (n4) [below=5mm of n3]{$ b' $};\draw ([yshift=7mm] n1.east) coordinate (aux1) edge["$x$"] (aux1 -| n3.west)([yshift=0mm] n1.east) coordinate (aux2) (aux2 -| n3.west) edge["$y$"] (aux2)([yshift=-7ex] n3.west) edge["$b'$" '] ([yshift=-7ex] n1.east);\draw[-Straight Barb] (n3) -- (n4);\end{tikzpicture}

改变箭头样式

\begin{tikzpicture}[auto,box/.style = {draw, minimum height=17mm, align=left, outer sep=0pt},lbl/.style = {anchor=north west, outer sep=0mm},pin edge = {<-, draw=black},every edge/.style = {draw, ->}]\node (n1)  [box, label={[lbl] north west:$\mathcal{C}_{\PRF}$},pin=$1^n$]{$\begin{aligned}\\K \leftarrow \gen(1^n)     \\b \xleftarrow{r} \{0,1\}   \\\text{Wenn } b = 0  \text{ denn } \vartheta_0 = F_K(\cdot)  \\\text{Wenn } b = 1  \text{ denn } \vartheta_1 = f(\cdot)    \\[1ex]\text{Wenn } b' = b \text{return } 1\\\text{Wenn } b' \neq b \text{ return } 0\\[5ex]\end{aligned}$};\node (n3)  [box, label={[lbl]north west:$\mathcal{A}$},pin=$ k $,   right=9mm of n1 -| n1.east]{$\begin{aligned}\\x = 0 \quad b                  \\x = 1 \quad a+b \rightarrow b  \\x = 2 \quad 2a+b               \\[1ex]\text{Wenn } b' = 0            \\\text{ sonst } b' = 1       \\\text{ return } b'          \\[5ex]\end{aligned}$};\node (n4) [below=5mm of n3]{$ b' $};\draw ([yshift=7mm] n1.east) coordinate (aux1) edge["$x$"] (aux1 -| n3.west)([yshift=0mm] n1.east) coordinate (aux2) (aux2 -| n3.west) edge["$y$"] (aux2)([yshift=-7ex] n3.west) edge["$b'$" '] ([yshift=-7ex] n1.east);\draw[->] (n3) -- (n4);\end{tikzpicture}

\begin{tikzpicture}[auto,box/.style = {draw, minimum height=4cm, align=left, outer sep=0pt},lbl/.style = {anchor=north west, outer sep=0mm},every edge/.style = {draw, ->}]\node (n1)  [box, label={[lbl] north west:Challenger ~~ $\mathcal{C}$},]{$\begin{aligned}\\k \overset{R}{\leftarrow} K    \\c_i \overset{R}{\leftarrow} E(k,m_i) \end{aligned}$};\node (n3)  [box, label={[lbl]north west:Adversary~~ $\mathcal{A}$},right=9mm of n1 -| n1.east]{$\begin{aligned}\\i=1,2,... \\c \notin \left\lbrace c_1,c_2,... \right\rbrace \end{aligned}$};\node (n4) [below=5mm of n3]{$ b' $};\draw ([yshift=7ex] n3.west) edge["$m_i$" '] ([yshift=7ex] n1.east)([yshift=0ex] n1.east) edge["$c_i$" '] ([yshift=0ex] n3.west)([yshift=-7ex] n3.west) edge["$c$" '] ([yshift=-7ex] n1.east);\draw[->] (n3) -- (n4);\end{tikzpicture}
\begin{figure}[!htbp]\centering\caption{标题}\label{authentication1}
\end{figure}

\begin{figure}[!htbp]\centering\begin{tabular}{|p{3cm}<{\centering}|p{6cm}<{\centering}|p{3cm}<{\centering}|}\hlinetype $\parallel$ ver $\parallel$ len &  data & tag(pad) \rule{0pt}{5mm} \\\hline\end{tabular}\caption{TLS协议数据包}\label{authentication05}
\end{figure}

直接在tikz上画图还是比较方便的,毕竟是latex官方给出的模板

【LaTeX应用】LaTeX绘图相关推荐

  1. 【TikZ 简单学习(下):基础绘制】Latex下的绘图宏包

    [TikZ 简单学习[下]:基础绘制]Latex下的绘图宏包 上文 绘制多个节点 给节点添加统一样式 给节点命名 使用相对位置绘制 给节点标签 链接边的绘制 在线边上添加标签 绘制蛇形线和多行文本 层 ...

  2. Latex技巧:LaTex插图命令includegraphics参数详解

    转自:https://www.cnblogs.com/yifdu25/p/8326025.html Latex技巧:LaTex插图命令includegraphics参数详解 Latex插图的命令是\i ...

  3. 【LaTex】LaTex 极简安装教程

    文章目录 Latex 安装教程 1. 下载texlive.iso 2. 点击装载 3. 运行 install-tl-windows.bat 进行安装 4. 验证是否安装成功 5. 安装开发工具 Lat ...

  4. 【LaTex】LaTex 极简使用教程(后续加附视频讲解链接)

    文章目录 LaTex 基础常识 文档类 编译类型 命令格式 环境介绍 简单书写 1. 正文文本 2. 正文符号 标题作者 1. 导入宏包 2. 标题.作者.机构 3. 正文显示 章节.目录和列表 1. ...

  5. 【工具篇-LaTeX】LaTeX语法

    [工具篇-LaTeX]LaTeX语法 文章目录 [工具篇-LaTeX]LaTeX语法 1 快速入门 1.1 简介 1.2 入门示例 1.2.1 导言和正文 1.2.2 环境 2 基础知识 2.1 命令 ...

  6. 【LaTeX】LaTeX入门

    文章目录 简介 文章结构 基本要素 处理问题 添加文档标题 章节 创建标签 生成目录(TOC) 文字处理 中文字体支持 字体效果 彩色字体 字体大小 段落缩进 列表 注释和空格 特殊字符 表格 图表 ...

  7. LaTeX中TikZ绘图备忘一

      LaTeX中的TikZ绘图功能很强,为了方便以后用到的时候好查询,所以这里把自己绘制过的内容记录在CSDN博客中.   在以下环境测试过 操作系统:Ubuntu 16.04 64位桌面版 LaTe ...

  8. LaTeX 嵌入MATLAB 绘图的字体

    两次遇到使用Ctex生成PDF没有嵌入MATLAB字体的问题,解决方案分别如下: 第一次: 编辑Ctex的配置文件:CTEX\MiKTeX\dvipdfm\config\dvipdfmx.cfg 将下 ...

  9. LaTeX中TikZ绘图备忘二

    在以下环境测试过 操作系统:Ubuntu 16.04 64位桌面版 LaTeX工具:TeXstudio 2.10.8 编译方式:LuaLaTeX   示例四.chains库的使用   完整代码 \do ...

  10. 【LaTex】LaTeX Warning: Citation xxx on page xxx undefined on input line xxx

    学习使用LaTeX时,引用参考文献时出现'?': 在控制台中输出: LaTeX Warning: Citation xxx on page xxx undefined on input line xx ...

最新文章

  1. 系统芯片(SOC)架构- Aviral Mittal
  2. CSS 文字溢出显示省略号
  3. 进制转换converse
  4. python数学公式代码导入_在Matplotlib图中插入LaTex公式实例
  5. Cambridge Judge Business school faculty review
  6. Android之提示Method return type must not include a type variable or wildcard:
  7. javascript实现页面中回到顶部功能
  8. 【BZOJ1226】学校食堂(动态规划,状态压缩)
  9. vi 之行号操作---显示行号、跳到指定行
  10. java并发编程(4)--单例模式的安全问题 volatile
  11. 诺基亚智能手机知识大全
  12. Win7下64位扫雷逆向以及辅助制作
  13. Altium Designer入门与进阶教程系列
  14. java 控制层和业务层,控制层、业务层和数据访问层
  15. English语法_形容词/副词3级 - 原级
  16. 中国电信“公板”计划主攻中端市场
  17. MySQL(数据库)
  18. 南加大计算机工程院排名,南加州大学工程学院排名好的专业有哪些?
  19. 搭建 Mellanox ConnectX-3 EN 10/40 Gbps 网卡 DPDK 运行环境
  20. Task09文件与文件系统

热门文章

  1. 电脑连接手机热点,无法上网
  2. 自己动手将艺术照变成证件照
  3. python 之 怎么卸载
  4. Windbg查看死锁实例
  5. 《Python自然语言处理》-ch1-语料库
  6. 如何配置华为ISIS?理论+实操,可跟做!
  7. 银河麒麟操作系统使用
  8. 大数据精准营销(五)
  9. js 实现微信打飞机小游戏 小练习
  10. 岁月温柔-16 妈妈三天不吃饭再次住院续(1) 感染了鲍曼不动杆菌