我需要根据变量构造一个弧。有些代码行可以工作,有些则不行。有什么想法吗?
\documentclass[tikz]{standalone}
\begin{document}
\def\BLS{\baselineskip}
\begin{tikzpicture}
% works
\draw[->] (0,0) arc (-90:90:.5*\BLS) ;
% works
\draw[->] (0,0) arc (-90:90:\BLS{} and 2cm) ;
% don't work
\draw[->] (0,0) arc (-90:90:.5*\BLS{} and 2cm) ;
% don't work
\draw[->] (0,0) arc (-90:90:.5*\BLS and \BLS) ;
\end{tikzpicture}
\end{document}
答案1
使用
\draw[->] (0,0) arc (-90:90:{.5*\BLS} and 2cm);
\draw[->] (0,0) arc (-90:90:{.5*\BLS} and \BLS);
答案2
或者使用:
\draw[->] (0,0) arc (-90:90:\BLS{}/2 and 2cm) ;
\draw[->] (0,0) arc (-90:90:\BLS/2 and \BLS) ;
答案3
另一种方法:
\draw[->] (0,0) arc (-90:90:\dimexpr.5\BLS\relax\space and 2cm) ;