Forgot password?
 Create new account
View 6063|Reply 7

\foreach 其实是很好用嘀

[Copy link]

700

Threads

110K

Posts

910K

Credits

Credits
94177
QQ

Show all posts

kuing Posted at 2013-12-28 21:35:55 |Read mode
QQ截图20131228213231.gif

用 tikz 画可以这样两句就解决:
  1. \begin{tikzpicture}
  2. \draw (0,0) \foreach \i in {0,1,...,4} {--++(\i*60:1)} --cycle;
  3. \filldraw[fill=gray!50] (0,0) \foreach \i in {0,1,2} {arc (-60+\i*240:60+\i*240:1)};
  4. \end{tikzpicture}
Copy the Code
效果
QQ截图20131228213537.gif
当然这里还差一点点,就是阴影的样式,我忘了怎么弄,因为很少用,一般来说灰色就行了。
再再完美一点,应该在 \filldraw 那行的最后加上 --cycle(原因自己想),不过在这里体现不出来。

当然了,以上这些我并不会回复到那个教师群里,因为肯定没人知道是什么,发在这里只是无聊记录一下罢了。

87

Threads

2383

Posts

110K

Credits

Credits
13325

Show all posts

其妙 Posted at 2013-12-28 23:18:59
回复 1# kuing
发在这里也只有几个人知道,例如isee知道……

801

Threads

4889

Posts

310K

Credits

Credits
36169

Show all posts

isee Posted at 2013-12-29 17:35:49
我的确写过类似的……
的确很方便

87

Threads

2383

Posts

110K

Credits

Credits
13325

Show all posts

其妙 Posted at 2013-12-29 17:44:53
我的确写过类似的……
的确很方便
isee 发表于 2013-12-29 17:35

能不能推广一下?也想学学,以前以为学不会latex的,在kk的推广之下,勉强会了一点,简单、基本的输入问题不大(有问题就查kk的置顶字典),

700

Threads

110K

Posts

910K

Credits

Credits
94177
QQ

Show all posts

 Author| kuing Posted at 2013-12-29 18:12:44
回复 3# isee

\foreach 不一定要用在 tikzpicture 画图环境里,只要加载了 tikz 宏包,在正文的其他地方也可以用。

PS、你知道怎么将那个阴影弄成开头那图的样子?或者斜杠形式也可以。

801

Threads

4889

Posts

310K

Credits

Credits
36169

Show all posts

isee Posted at 2013-12-31 13:01:41
回复 5# kuing

印象中TiKZ有相应的填充“蒙板”(突然不知道怎么叫了),就是像箭头一样,可多样选择的。

不过,至少当时XeLeTeX是不支持的,所以就没多关注。

TiKZ手册(指自带700多页的说明书)里一定有的,我就是在哪儿看到的。

700

Threads

110K

Posts

910K

Credits

Credits
94177
QQ

Show all posts

 Author| kuing Posted at 2013-12-31 14:29:45
回复 6# isee

好吧还是得自己老老实实看文档……

700

Threads

110K

Posts

910K

Credits

Credits
94177
QQ

Show all posts

 Author| kuing Posted at 2013-12-31 23:22:53
回复 6# isee

连插入图片来填充都可以,看来没什么不行……
QQ截图20131231232152.gif

手机版Mobile version|Leisure Math Forum

2025-4-21 01:25 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list