Menu

#176 opacity does not work correctly

v1.0_(example)
open
nobody
TikZ (1)
5
2023-12-16
2023-12-16
No

Trying to draw a shaded triangle with TikZ:

\usepackage{tikz}
\coordinate[] (A) at (0,0);
\coordinate[] (B) at (2,0);
\coordinate[] (C) at (2,1);
\fillpurple, opacity = 0.5--(B)--(C)--cycle;

The triangle changes its location by the value of opacity (here 0.5) in the x and by - value of opacity (here -0.5) in y-direction.

Discussion

  • Roland Baudin

    Roland Baudin - 2023-12-16

    Hi, your LaTeX code snippet seems incomplete or wrong... Could you post the correct code?
    Thanks.

     
  • Marianne Diem

    Marianne Diem - 2023-12-16
    \begin{tikzpicture}
    \draw[](0,0)--(3,0)--(3,1)--cycle;
    \fill[red](0,0)--(3,0)--(3,1)--cycle; %%%appears correctly
    \fill[blue, transparent](0,0)--(3,0)--(3,1)--cycle;%%% does not appear at all
    \fill[purple, opacity = 0.5](0,0)--(3,0)--(3,1)--cycle;%%% appears in a shifted position
    \end{tikzpicture}
    
     
    • Roland Baudin

      Roland Baudin - 2023-12-16

      OK, I see: to fix a problem with dashed lines appearing as solid lines when using tikz, I apply a workaround (export to EMF instead of SVG). But this workaround does not work in your case and the rendered image is corrupted.

      An easy fix is to add the line:
      fixDashedLines = FALSE
      at line 630 of the TexMathsTools module (in function ImportGraphicIntoClipboard).

      However, you will have solid dashed lines when using tikz...

      For now, I cannot offer a complete solution to the problems encountered with the tikz package.

      Sorry about that.

       

Log in to post a comment.