重新着色尺规中的线条

重新着色尺规中的线条

我有使用 Rulercompass 库的以下 tikz 图。

\begin{tikzpicture}[stop jumping ,constrain]
\path  (1, 0)  node [ruler compass/point=red, label={1}];
\path  (-1, 0) node[ruler compass/point=red, label={-1}];
\ruler{a}{b}
\compass{a}{b}
\compass{b}{a}
\point{cab}{cba}{1}
\point{cab}{cba}{2}
\path (c) node [ruler compass/point=red, label={$\sqrt{3}i$}];
\path (d) node [ruler compass/point=red, label={$-\sqrt{3}i$}];
\ruler{c}{d}
\point{rab}{rcd}{1}
\path (g) node [ruler compass/point=red, label={0}];
\end{tikzpicture}

\ruler 和 \compass 绘制的线条默认为蓝色。如何更改它们的颜色?以下两者都不是:

\ruler[gray]{a}{b}
\ruler[color=gray]{a}{b}

工作了。

答案1

有一个键ruler compass/construction in use可用于设置个人\ruler\compass命令的样式。

梅威瑟:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{rulercompass}
\begin{document}
\begin{tikzpicture}[stop jumping ,constrain]
\path  (1, 0)  node [ruler compass/point=red, label={1}];
\path  (-1, 0) node[ruler compass/point=red, label={-1}];
\ruler[ruler compass/construction in use/.style={draw=red}]{a}{b}
\compass{a}{b}
\compass[ruler compass/construction in use/.style={draw=gray}]{b}{a}
\point{cab}{cba}{1}
\point{cab}{cba}{2}
\path (c) node [ruler compass/point=red, label={$\sqrt{3}i$}];
\path (d) node [ruler compass/point=red, label={$-\sqrt{3}i$}];
\ruler{c}{d}
\point{rab}{rcd}{1}
\path (g) node [ruler compass/point=red, label={0}];
\end{tikzpicture}
\end{document}

结果:

在此处输入图片描述

我通过在源中查找rulercompass值找到了此键blue,当设置键的默认值时,该值会出现一次。

如果你想自己设置默认值,你可以使用

\tikzset{ruler compass/construction in use/.style={
    draw=gray
  }
}

\begin{tikzpicture}

相关内容