如何在 LaTeX 中绘制图形? [英] How to draw a graph in LaTeX?
本文介绍了如何在 LaTeX 中绘制图形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
首先,让我说我正在使用 LyX,虽然我使用 ERT 没有问题.
First of all, let me say I'm using LyX, though I have no problem using ERT.
其次,在 Latex 中绘制这样一个简单图形的最简单方法是什么?
Secondly, what is the most simplest way to draw a simple graph like this in Latex?
我看过一些带有图表的文档和一些例子,但我不知道如何只绘制一个简单的图表——我需要什么包等等?
I've seen some documents with graphs and I've seen some examples, but I couldn't figure out how to just draw a simple graph - what packages do I need, etc?
推荐答案
TikZ 可以做到.
快速演示:
documentclass{article}
usepackage{tikz}
egin{document}
egin{tikzpicture}
[scale=.8,auto=left,every node/.style={circle,fill=blue!20}]
ode (n6) at (1,10) {6};
ode (n4) at (4,8) {4};
ode (n5) at (8,9) {5};
ode (n1) at (11,8) {1};
ode (n2) at (9,6) {2};
ode (n3) at (5,5) {3};
foreach from/ o in {n6/n4,n4/n5,n5/n1,n1/n2,n2/n5,n2/n3,n3/n4}
draw (from) -- ( o);
end{tikzpicture}
end{document}
产生:
更多示例@http://www.texample.net/tikz/examples/标签/图表/
关于 TikZ 的更多信息:http://sourceforge.net/projects/pgf/ 我在哪里猜猜还会有安装指南.
More information about TikZ: http://sourceforge.net/projects/pgf/ where I guess an installation guide will also be present.
这篇关于如何在 LaTeX 中绘制图形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文