pgf-tikz / pgf

A Portable Graphic Format for TeX
https://pgf-tikz.github.io/
1.15k stars 108 forks source link

Non-commuting draw options #1346

Closed AndrewMathas closed 4 months ago

AndrewMathas commented 4 months ago

Brief outline of the bug

My understanding is that the MWE below should produce two circles with a green boundary and a yellow fill. However, swapping the order of the style commands inside the \draw command results in the fill=yellow style being ignored:

Screenshot 2024-07-07 at 09 31 36

Minimal working example (MWE)

\documentclass{article}
\usepackage{tikz}
\begin{document}

  \begin{tikzpicture}
    \draw[green,fill=yellow] (0,0) circle [radius=1];
    \draw[fill=yellow,green] (2,0) circle [radius=1];
  \end{tikzpicture}

\end{document}
muzimuzhi commented 4 months ago

This is expected behavior.

Using <color> as option key is equivalent to color=<color> (see https://tikz.dev/tikz-scopes#sec-12.4.1), which

sets the color that is used for fill, drawing, and text inside the current scope. Any special settings for filling colors or drawing colors are immediately “overruled” by this option. see https://tikz.dev/tikz-actions#pgf./tikz/color