找回密码
 快速注册
搜索
查看: 55|回复: 11

node文本|变成—

[复制链接]

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

hbghlyj 发表于 2023-7-24 11:59 |阅读模式
本帖最后由 hbghlyj 于 2023-7-24 12:31 编辑 TikZ 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}
复制代码

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

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

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

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

kuing 发表于 2023-7-24 13:59
  1. \documentclass{article}
  2. \begin{document}
  3. |
  4. \end{document}
复制代码

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

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2023-7-24 14:00
kuing 发表于 2023-7-24 13:55
与 tikz 无关,你在正常段落输入 | 也会变成 —


我还有一个问题:在tikz手册|的效果是\texttt
Screenshot 2023-07-24 at 13-59-39 pgfmanual.pdf.png

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2023-7-24 14:02
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}
复制代码

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

kuing 发表于 2023-7-24 14:08
hbghlyj 发表于 2023-7-24 14:02
PDF$\LaTeX$发现加上T1就正常了


嗯,所以是编码的原因,具体细节我也不是很清楚。

另外还有 < 和 > 也是。
  1. \documentclass{article}
  2. \begin{document}
  3. |><
  4. \end{document}
复制代码

PDFLaTeX 编译得到 —¿¡

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2023-7-24 14:13
kuing 发表于 2023-7-24 13:55
与 tikz 无关,你在正常段落输入 | 也会变成 —


为什么TikZ手册上同样的代码中|的作用是Typewritter font(即LaTeX的\ttfamily)

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

kuing 发表于 2023-7-24 14:17
hbghlyj 发表于 2023-7-24 14:13
为什么TikZ手册上同样的代码中的作用是Typewritter font(即LaTeX的\ttfamily)


我不清楚,说不定这展示的代码其实是漏了东西的,实际上应该是 \verb|class Shape| ?

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

kuing 发表于 2023-7-24 14:23
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}
复制代码

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2023-7-24 14:33
kuing 发表于 2023-7-24 14:23
补上 \verb 后效果就和手册上一样。

在GitHub上发了个问题:github.com/pgf-tikz/pgf/issues/1267

点评

这也问😅😅  发表于 2023-7-24 14:35

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

kuing 发表于 2023-7-26 14:36
hbghlyj 发表于 2023-7-24 14:33
在GitHub上发了个问题:https://github.com/pgf-tikz/pgf/issues/1267

看到回答了,原来是手册用的文档类有设置😄

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 12:01

Powered by Discuz!

× 快速回复 返回顶部 返回列表