Forgot password?
 Create new account
View 194|Reply 11

node文本|变成—

[Copy link]

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

hbghlyj Posted at 2023-7-24 11:59:49 |Read mode
Last edited by hbghlyj at 2023-7-24 12:31:00TikZ manual第13.2.3节anchor代码复制出来放入standalone形成
  1. \documentclass[tikz]{standalone}
  2. \begin{document}
  3. \usetikzlibrary {arrows.meta}
  4. \begin{tikzpicture}
  5. \node (shape) at (0,2) [draw] {|class Shape|};
  6. \node (rect) at (-2,0) [draw] {|class Rectangle|};
  7. \node (circle) at (2,0) [draw] {|class Circle|};
  8. \node (ellipse) at (6,0) [draw] {|class Ellipse|};
  9. \draw (node cs:name=circle,anchor=north) |- (0,1);
  10. \draw (node cs:name=ellipse,anchor=north) |- (0,1);
  11. \draw [arrows = -{Triangle[open, angle=60:3mm]}]
  12. (node cs:name=rect,anchor=north)
  13. |- (0,1) -| (node cs:name=shape,anchor=south);
  14. \end{tikzpicture}
  15. \end{document}
Copy the Code

texlive.net编译结果:
canvas.png
发现代码中的|变成了—
例如|class Shape|变成了—class Shape—

701

Threads

110K

Posts

910K

Credits

Credits
94145
QQ

Show all posts

kuing Posted at 2023-7-24 13:55:31
与 tikz 无关,你在正常段落输入 | 也会变成 —

701

Threads

110K

Posts

910K

Credits

Credits
94145
QQ

Show all posts

kuing Posted at 2023-7-24 13:59:53
  1. \documentclass{article}
  2. \begin{document}
  3. |
  4. \end{document}
Copy the Code

以上代码,用 PDFLaTeX 编译,出来的就是 — ,而用 XeLaTeX 编译,出来的才是 | 。

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2023-7-24 14:00:29
kuing 发表于 2023-7-24 13:55
与 tikz 无关,你在正常段落输入 | 也会变成 —
我还有一个问题:在tikz手册|的效果是\texttt
Screenshot 2023-07-24 at 13-59-39 pgfmanual.pdf.png

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2023-7-24 14:02:44
kuing 发表于 2023-7-24 13:59
以上代码,用 PDFLaTeX 编译,出来的就是 — ,而用 XeLaTeX 编译,出来的才是 | 。 ...
PDF$\LaTeX$发现加上T1就正常了
  1. \documentclass{article}
  2. \usepackage[T1]{fontenc}
  3. \begin{document}
  4. |
  5. \end{document}
Copy the Code

701

Threads

110K

Posts

910K

Credits

Credits
94145
QQ

Show all posts

kuing Posted at 2023-7-24 14:08:42
hbghlyj 发表于 2023-7-24 14:02
PDF$\LaTeX$发现加上T1就正常了
嗯,所以是编码的原因,具体细节我也不是很清楚。

另外还有 < 和 > 也是。
  1. \documentclass{article}
  2. \begin{document}
  3. |><
  4. \end{document}
Copy the Code

PDFLaTeX 编译得到 —¿¡

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2023-7-24 14:13:56
kuing 发表于 2023-7-24 13:55
与 tikz 无关,你在正常段落输入 | 也会变成 —
为什么TikZ手册上同样的代码中|的作用是Typewritter font(即LaTeX的\ttfamily)

701

Threads

110K

Posts

910K

Credits

Credits
94145
QQ

Show all posts

kuing Posted at 2023-7-24 14:17:05
hbghlyj 发表于 2023-7-24 14:13
为什么TikZ手册上同样的代码中的作用是Typewritter font(即LaTeX的\ttfamily)
我不清楚,说不定这展示的代码其实是漏了东西的,实际上应该是 \verb|class Shape| ?

701

Threads

110K

Posts

910K

Credits

Credits
94145
QQ

Show all posts

kuing Posted at 2023-7-24 14:23:46
kuing 发表于 2023-7-24 14:17
我不清楚,说不定这展示的代码其实是漏了东西的,实际上应该是 \verb|class Shape| ? ...
补上 \verb 后效果就和手册上一样。
  1. \documentclass[tikz]{standalone}
  2. \begin{document}
  3. \usetikzlibrary {arrows.meta}
  4. \begin{tikzpicture}
  5. \node (shape) at (0,2) [draw] {\verb|class Shape|};
  6. \node (rect) at (-2,0) [draw] {\verb|class Rectangle|};
  7. \node (circle) at (2,0) [draw] {\verb|class Circle|};
  8. \node (ellipse) at (6,0) [draw] {\verb|class Ellipse|};
  9. \draw (node cs:name=circle,anchor=north) |- (0,1);
  10. \draw (node cs:name=ellipse,anchor=north) |- (0,1);
  11. \draw [arrows = -{Triangle[open, angle=60:3mm]}]
  12. (node cs:name=rect,anchor=north)
  13. |- (0,1) -| (node cs:name=shape,anchor=south);
  14. \end{tikzpicture}
  15. \end{document}
Copy the Code

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

 Author| hbghlyj Posted at 2023-7-24 14:33:03
kuing 发表于 2023-7-24 14:23
补上 \verb 后效果就和手册上一样。
在GitHub上发了个问题:github.com/pgf-tikz/pgf/issues/1267

Comment

这也问😅😅  Posted at 2023-7-24 14:35

701

Threads

110K

Posts

910K

Credits

Credits
94145
QQ

Show all posts

kuing Posted at 2023-7-26 14:36:14
hbghlyj 发表于 2023-7-24 14:33
在GitHub上发了个问题:https://github.com/pgf-tikz/pgf/issues/1267
看到回答了,原来是手册用的文档类有设置😄

手机版Mobile version|Leisure Math Forum

2025-4-20 12:11 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list