【LaTeX应用】LaTeX绘图
在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绘图相关推荐
- 【TikZ 简单学习(下):基础绘制】Latex下的绘图宏包
[TikZ 简单学习[下]:基础绘制]Latex下的绘图宏包 上文 绘制多个节点 给节点添加统一样式 给节点命名 使用相对位置绘制 给节点标签 链接边的绘制 在线边上添加标签 绘制蛇形线和多行文本 层 ...
- Latex技巧:LaTex插图命令includegraphics参数详解
转自:https://www.cnblogs.com/yifdu25/p/8326025.html Latex技巧:LaTex插图命令includegraphics参数详解 Latex插图的命令是\i ...
- 【LaTex】LaTex 极简安装教程
文章目录 Latex 安装教程 1. 下载texlive.iso 2. 点击装载 3. 运行 install-tl-windows.bat 进行安装 4. 验证是否安装成功 5. 安装开发工具 Lat ...
- 【LaTex】LaTex 极简使用教程(后续加附视频讲解链接)
文章目录 LaTex 基础常识 文档类 编译类型 命令格式 环境介绍 简单书写 1. 正文文本 2. 正文符号 标题作者 1. 导入宏包 2. 标题.作者.机构 3. 正文显示 章节.目录和列表 1. ...
- 【工具篇-LaTeX】LaTeX语法
[工具篇-LaTeX]LaTeX语法 文章目录 [工具篇-LaTeX]LaTeX语法 1 快速入门 1.1 简介 1.2 入门示例 1.2.1 导言和正文 1.2.2 环境 2 基础知识 2.1 命令 ...
- 【LaTeX】LaTeX入门
文章目录 简介 文章结构 基本要素 处理问题 添加文档标题 章节 创建标签 生成目录(TOC) 文字处理 中文字体支持 字体效果 彩色字体 字体大小 段落缩进 列表 注释和空格 特殊字符 表格 图表 ...
- LaTeX中TikZ绘图备忘一
LaTeX中的TikZ绘图功能很强,为了方便以后用到的时候好查询,所以这里把自己绘制过的内容记录在CSDN博客中. 在以下环境测试过 操作系统:Ubuntu 16.04 64位桌面版 LaTe ...
- LaTeX 嵌入MATLAB 绘图的字体
两次遇到使用Ctex生成PDF没有嵌入MATLAB字体的问题,解决方案分别如下: 第一次: 编辑Ctex的配置文件:CTEX\MiKTeX\dvipdfm\config\dvipdfmx.cfg 将下 ...
- LaTeX中TikZ绘图备忘二
在以下环境测试过 操作系统:Ubuntu 16.04 64位桌面版 LaTeX工具:TeXstudio 2.10.8 编译方式:LuaLaTeX 示例四.chains库的使用 完整代码 \do ...
- 【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 ...
最新文章
- 系统芯片(SOC)架构- Aviral Mittal
- CSS 文字溢出显示省略号
- 进制转换converse
- python数学公式代码导入_在Matplotlib图中插入LaTex公式实例
- Cambridge Judge Business school faculty review
- Android之提示Method return type must not include a type variable or wildcard:
- javascript实现页面中回到顶部功能
- 【BZOJ1226】学校食堂(动态规划,状态压缩)
- vi 之行号操作---显示行号、跳到指定行
- java并发编程(4)--单例模式的安全问题 volatile
- 诺基亚智能手机知识大全
- Win7下64位扫雷逆向以及辅助制作
- Altium Designer入门与进阶教程系列
- java 控制层和业务层,控制层、业务层和数据访问层
- English语法_形容词/副词3级 - 原级
- 中国电信“公板”计划主攻中端市场
- MySQL(数据库)
- 南加大计算机工程院排名,南加州大学工程学院排名好的专业有哪些?
- 搭建 Mellanox ConnectX-3 EN 10/40 Gbps 网卡 DPDK 运行环境
- Task09文件与文件系统