Forgot password?
 Create new account
View 1319|Reply 1

tikz的grid与remember picture

[Copy link]

700

Threads

110K

Posts

910K

Credits

Credits
94177
QQ

Show all posts

kuing Posted at 2018-2-12 16:29:15 |Read mode
如下代码:
  1. oo%
  2. \tikz{
  3. \coordinate (A1) at (0,0);
  4. \coordinate (A2) at (3,2);
  5. \draw (A1) rectangle (A2);
  6. }%
  7. oo%
  8. \tikz[remember picture,overlay]{
  9. \coordinate (B1) at (0,0);
  10. \coordinate (B2) at (3,2);
  11. }%
  12. oo%
  13. \tikz[remember picture,overlay]{
  14. \draw (B1) rectangle (B2);
  15. }
Copy the Code
编译两次后生成:
QQ截图20180212161524.png
这是正确的结果,然而,将代码中的 rectangle 改成 grid,却变成:
QQ截图20180212161546.png

也就是说,当 tikz 画 grid 的网格线时,“原点”是以画的那条命令为准的,所以是最后 oo 的右边,而不是 (B1)。

这一点是我前两天在解决这帖 bbs.ctex.org/forum.php?mod=viewthread&tid=154905 时发现的,开始时我直接写 \draw (current page marginpar area.north west) grid [xstep=\marginparwidth, ystep=\baselineskip] (current page marginpar area.south east); 结果不正确,只好改成 \draw (0,0) grid [xstep=\marginparwidth, ystep=\baselineskip] (\marginparwidth,-\textheight); 并把它保存为一个盒子再放到边上去。

801

Threads

4889

Posts

310K

Credits

Credits
36169

Show all posts

isee Posted at 2018-2-12 16:39:32
remember picture 好像不能顾思义了

手机版Mobile version|Leisure Math Forum

2025-4-21 01:21 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list