TransWikia.com

Fading effects don't take effect

TeX - LaTeX Asked on January 7, 2021

I have the following code, where I am overriding the fading effect, so that it fades rapidly.
The effects are called South, North etc.
In the snippet marked FIXME: problematic I show the region where the command
path fade=South does not produce any output. In contrast, path fade=south works as usual. So, in the code below I do define some paths with fade, but the resulting pdf is empty. The question is, Where is my stuff?(c)
Please nevermind that the code itself can be written in a more modular form;
there is no time for refactoring, for a one-off use too.

    documentclass{standalone}
usepackage{tikz}
usetikzlibrary{arrows.meta,shadings,tikzmark}
usetikzlibrary{backgrounds,shadings,shadows,shapes,chains,calc,positioning,decorations.pathreplacing}
usetikzlibrary{calc,arrows,decorations.pathmorphing,intersections,fit,patterns,fadings}
usepackage{xcolor}

begin{document}
tikzstyle{myedgestyle}=[
    thin,
    decorate,decoration={random steps,segment length=0.5pt,amplitude=0.1pt}
]%

begin{tikzpicture}
coordinate (origin) at (0,0);
coordinate (A) at (8ex,8ex);
coordinate (B) at (40ex,8ex);
coordinate (C) at (40ex,24ex);
coordinate (D) at (8ex,24ex);
foreach x/y in {1/2,2/1} {
    coordinate (midHorABxy) at ($x*(A)+y*(B)$);
    coordinate (midHorabxy) at ($0.33334*(midHorABxy)$);
    coordinate (midHorCDxy) at ($x*(D)+y*(C)$);
    coordinate (midHorcdxy) at ($0.33334*(midHorCDxy)$);
}
foreach x/y in {1/1} {
    coordinate (midVerADxy) at ($x*(A)+y*(D)$);
    coordinate (midVeradxy) at ($0.5*(midVerADxy)$);
    coordinate (midVerBCxy) at ($x*(C)+y*(B)$);
    coordinate (midVerbcxy) at ($0.5*(midVerBCxy)$);
}

%makeatletter
pgfdeclareverticalshading{pgf@lib@fade@South}{10ex}
{color(0ex)=(pgftransparent!0); color(5ex)=(pgftransparent!75);
 color(7.5ex)=(pgftransparent!80); color(10ex)=(pgftransparent!100)}%
pgfdeclarefading{South}{pgfuseshading{pgf@lib@fade@South}}%
%makeatother
%makeatletter
pgfdeclareverticalshading{pgf@lib@fade@North}{100bp}
{color(0bp)=(pgftransparent!100); color(50bp)=(pgftransparent!100);
 color(75bp)=(pgftransparent!0); color(100bp)=(pgftransparent!0)}%
pgfdeclarefading{North}{pgfuseshading{pgf@lib@fade@North}}%
%makeatother
%makeatletter
pgfdeclarehorizontalshading{pgf@lib@fade@East}{100bp}
{color(0bp)=(pgftransparent!100); color(50bp)=(pgftransparent!100);
 color(75bp)=(pgftransparent!0); color(100bp)=(pgftransparent!0)}%
pgfdeclarefading{East}{pgfuseshading{pgf@lib@fade@East}}%
%makeatother
%makeatletter
pgfdeclarehorizontalshading{pgf@lib@fade@West}{100bp}
{color(0bp)=(pgftransparent!100); color(50bp)=(pgftransparent!100);
 color(75bp)=(pgftransparent!0); color(100bp)=(pgftransparent!0)}%
pgfdeclarefading{West}{pgfuseshading{pgf@lib@fade@West}}%
%makeatother

% FIXME: Problematic zone: fading effects South/North/East/West do not take effect
path[draw,myedgestyle,path fading=South] (midHorab12) to ($(midHorab12)!-0.3!(midHorcd12)$);
path[draw,myedgestyle,path fading=South] (midHorab21) to ($(midHorab21)!-0.3!(midHorcd21)$);
path[draw,myedgestyle,path fading=North] (midHorcd12) to ($(midHorcd12)!-0.45!(midHorab12)$);
path[draw,myedgestyle,path fading=North] (midHorcd21) to ($(midHorcd21)!-0.45!(midHorab21)$);

path[draw,myedgestyle,path fading=West] (midVerad11) to ($(midVerad11)!-0.2!(midVerbc11)$);
path[draw,myedgestyle,path fading=East] (midVerbc11) to ($(midVerbc11)!-0.2!(midVerad11)$);

end{tikzpicture}
end{document}

EDIT: removed extraneous commands to make it MWE-ish.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP