
同样的代码,在window下安装的CTeX绘制2^x的图象不对(如上图),但在Online LaTeX Editor下绘制的2^x的图象(如下图)又是正确的,请问怎样在CTeX下绘制2^x的图象?

\documentclass{book}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=0.4]
\draw[->,>=stealth](-5,0)--(3,0) node at (3,-0.4){$x$};
\draw[->,>=stealth](0,-2)--(0,4) node at (-0.4,3.9){$y$};
\draw[domain=-2:1.8,smooth] plot(\x,{2^\x});
\end{tikzpicture}
\end{document}
代码是没问题的,问题很可能事万恶的该死的「CTeX套装」...
\documentclass[tikz,border=5pt]{standalone}
\begin{document}
\begin{tikzpicture}[scale=.4]
\draw[->,>=stealth](-2.2,0)--(3,0) node[below] {$x$};
\draw[->,>=stealth](0,-2)--(0,4) node[left] {$y$};
\draw[domain=-2:1.8,smooth] plot(\x,{2^\x});
\end{tikzpicture}
\end{document}在TeXLive2026下效果一切正常:

谢谢!