使用 Latex 绘制并发图
我希望能够在我正在上的课程的作业中画出一个漂亮的并发图。 Ascii 版本如下所示。有什么方法可以使用乳胶来做到这一点,使它看起来非常漂亮和干净吗?
<代码> 线程 A ----|=====read(7)=====|---------------------------- -------->
线程B -------------|======写(-3)=====|-----|===读(-7)=== |--->
或者至少是这样的。
I would like to be able to draw a nice concurrency diagram in my homework for a class I am taking. An ascii version would look something like the following. Is there any way to do this using latex that would make it look really nice and clean?
Thread A ----|=====read(7)=====|----------------------------------->
Thread B -------------|======write(-3)=====|-----|===read(-7)===|--->
Or at least something like this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有相当多的绘图语言集成到 tex 中。
正如评论中所建议的,Dia,至少在 Linux 上,可以转储到 Metapost 代码,该代码可以被处理并插入到你的 tex 文档中。
您还可以从您选择的图形程序创建图形文件(jpg、png、pdf、eps),并仅包含该图形文件。这可能是最简单的路线。
在我的脑海中,与 Latex 兼容的绘图语言(非详尽)是:
前列腺素F,
蒂克兹,
MetaPost
TIKZ 和 PGF 非常强大,您可以在 texample.net 查看大量示例。
您还可以使用 graphviz,以及可选的 dot2tex,它将把您的 graphviz 文件转换为 Latex 可以理解的代码。
There are a quite a few drawing languages that integrate into tex.
As suggested in the comment, Dia, at least on linux, can dump to metapost code, which can be processed and inserted in your tex document.
You can also create a graphics file (jpg, png, pdf, eps) from your graphics program of choice, and just include that graphics file. This is probably the easiest route to go.
Off the top of my head, the drawing languages compatible with latex (non-exhaustive) are:
PGF,
TIKZ,
MetaPost
TIKZ and PGF are pretty powerful, and you can check out a bunch of examples at texample.net
You could also use graphviz, and optionally dot2tex, which will translate your graphviz file into code latex can understand.
时间 PGF/TikZ< 的宏/a> 看起来它们可以用来做你想做的事。
The timing macros for PGF/TikZ look like they could be used to do what you want.
是的,这是一个老问题,但这样的图在今天仍然有用。
Yeah, this is an old question, but such diagram is still useful today.