\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{decorations.markings}
\pgfplotsset{compat=1.18,/pgfplots/trig format=rad} % remove and error is gone
\begin{document}
\begin{tikzpicture}[decoration={markings,mark=at position 0.5 with {\arrow{>}}}]
\draw[postaction={decorate}] (-4,0) -- (-2,-1);
\end{tikzpicture}
\end{document}
这引发了错误:
/home/ulysses/temp/test.tex:9: Dimension too large.
<recently read> \pgfmath@x
l.9 ...w[postaction={decorate}] (-4,0) -- (-2,-1);
答案1
来自 PGFPlots 手册:
在撰写本文时,此功能处于实验状态:它可能会破坏 TikZ 内部结构。
您既可以使用- 仅用于绘图。- 也可以在需要时trig format plots=rad
将格式重新设置为:deg
\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{decorations.markings}
\pgfplotsset{compat=1.18, trig format=rad}
\begin{document}
\begin{tikzpicture}[decoration={markings, mark=at position 0.5 with {\arrow{>}}}]
\draw[postaction={decorate}, trig format=deg] (-4,0) -- (-2,-1);
\end{tikzpicture}
\end{document}