。
当我写的时候test\e
,图表是这样的:
我该如何解决这个问题?帮帮我:(
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\newcommand{\myequalsymbol}{
\hspace{1.1mm}\tikz[baseline, line width=0.7 pt, line cap=round]{
\draw (1.1,0.13) -- ++(0.22,0);
\draw (1.1,0.06) -- ++(0.22,0);
}
\hspace{1.1mm}}
\newcommand{\e}{\myequalsymbol}
\begin{document}
\begin{tikzpicture}[]
\begin{axis}[clip mode=individual,
xmin=5, xmax=15, ymin=22, ymax=60,
]
\addplot[domain=4:14]{16.46/3.6*x};
\path (6, {16.46/3.6*6}) -- (14, {16.46/3.6*14}) node [at end,anchor=south east,sloped] () {test\e};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
如果您的符号是数学关系,您应该用它定义它以\mathrel
在之前和之后有正确的间距=
。
为了避免嵌套的 TikZ 图片,您可以使用一个盒子。
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{amsmath}
\pgfplotsset{compat=1.14}
\newbox{\myequalsymbol}
\savebox{\myequalsymbol}{\tikz[baseline, line width=0.7 pt, line cap=round]{
\draw (1.1,0.13) -- ++(0.22,0);
\draw (1.1,0.06) -- ++(0.22,0);
}}
\newcommand{\e}{\mathrel{\usebox{\myequalsymbol}}}
\begin{document}
\begin{tikzpicture}[]
\begin{axis}[clip mode=individual,
xmin=5, xmax=15, ymin=22, ymax=60,
]
\addplot[domain=4:14]{16.46/3.6*x};
\path (6, {16.46/3.6*6}) -- (14, {16.46/3.6*14}) node [at end,
anchor=south east, sloped, xshift=3pt,
] {$\text{test}\e$};
\end{axis}
\end{tikzpicture}
\end{document}