Eraser tool for TikZ

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
10
down vote

favorite
1












I am asking for a style (or something similar), let us call it ERASE. The imaginary tool works as a convenient inverse clip or eraser within a scope. The specific way is asked within the comment in the following MWE. The MWE is an abstract form of my use cases (if you do not like the background, think of color wheel graphs from complex analysis to smooth your ruffled feathers).



documentclassmemoir
usepackagefontspec,amsmath,tikz
usetikzlibraryshadings,calc
tikzsetnodeStyle/.style=draw,rounded corners,thick
tikzsetERASE/.style=% just a placeholder

begindocument
begintikzpicture
shade[shading=color wheel white center] (0,0) rectangle (10,10);

draw[thick] (0,0) -- (10,5);
node[nodeStyle,fill=white] at (5,2.5) bfseriesfilled;
%This is readable but removes the background.

draw[thick] (0,2) -- (10,7);
node[nodeStyle] at (5,4.5) bfseriesnot filled;

beginscope
draw[thick] (0,4) -- (10,9);
node[nodeStyle,ERASE] at (5,6.5) bfseriesERASE to be implemented;
% erases everything in this scope "behind" this new object
% such that the diagonal line in this node is not visible and
% the text is easy to read and the coding is convenient
endscope

beginscope
% This just illustrates that clip can be used inside ascope
% thus the desired EREASE instruction might be possible.
clip (1,7) rectangle (8,10);
draw[thick] (0,6) -- (8,10);
endscope

endtikzpicture

enddocument


enter image description here



This imaginary tool might be unsuited for more complex use cases within several paths involved. Any suggestions on improving the use case are welcome.







share|improve this question


















  • 1




    You can achieve that with the reverseclip trick.
    – marmot
    Sep 1 at 22:17










  • @marmot Is this a duplicate, do you think? I immediately thought of that kind of solution when I saw this. (Though I thought it was called 'inverse clip' or something like that.)
    – cfr
    Sep 2 at 3:18














up vote
10
down vote

favorite
1












I am asking for a style (or something similar), let us call it ERASE. The imaginary tool works as a convenient inverse clip or eraser within a scope. The specific way is asked within the comment in the following MWE. The MWE is an abstract form of my use cases (if you do not like the background, think of color wheel graphs from complex analysis to smooth your ruffled feathers).



documentclassmemoir
usepackagefontspec,amsmath,tikz
usetikzlibraryshadings,calc
tikzsetnodeStyle/.style=draw,rounded corners,thick
tikzsetERASE/.style=% just a placeholder

begindocument
begintikzpicture
shade[shading=color wheel white center] (0,0) rectangle (10,10);

draw[thick] (0,0) -- (10,5);
node[nodeStyle,fill=white] at (5,2.5) bfseriesfilled;
%This is readable but removes the background.

draw[thick] (0,2) -- (10,7);
node[nodeStyle] at (5,4.5) bfseriesnot filled;

beginscope
draw[thick] (0,4) -- (10,9);
node[nodeStyle,ERASE] at (5,6.5) bfseriesERASE to be implemented;
% erases everything in this scope "behind" this new object
% such that the diagonal line in this node is not visible and
% the text is easy to read and the coding is convenient
endscope

beginscope
% This just illustrates that clip can be used inside ascope
% thus the desired EREASE instruction might be possible.
clip (1,7) rectangle (8,10);
draw[thick] (0,6) -- (8,10);
endscope

endtikzpicture

enddocument


enter image description here



This imaginary tool might be unsuited for more complex use cases within several paths involved. Any suggestions on improving the use case are welcome.







share|improve this question


















  • 1




    You can achieve that with the reverseclip trick.
    – marmot
    Sep 1 at 22:17










  • @marmot Is this a duplicate, do you think? I immediately thought of that kind of solution when I saw this. (Though I thought it was called 'inverse clip' or something like that.)
    – cfr
    Sep 2 at 3:18












up vote
10
down vote

favorite
1









up vote
10
down vote

favorite
1






1





I am asking for a style (or something similar), let us call it ERASE. The imaginary tool works as a convenient inverse clip or eraser within a scope. The specific way is asked within the comment in the following MWE. The MWE is an abstract form of my use cases (if you do not like the background, think of color wheel graphs from complex analysis to smooth your ruffled feathers).



documentclassmemoir
usepackagefontspec,amsmath,tikz
usetikzlibraryshadings,calc
tikzsetnodeStyle/.style=draw,rounded corners,thick
tikzsetERASE/.style=% just a placeholder

begindocument
begintikzpicture
shade[shading=color wheel white center] (0,0) rectangle (10,10);

draw[thick] (0,0) -- (10,5);
node[nodeStyle,fill=white] at (5,2.5) bfseriesfilled;
%This is readable but removes the background.

draw[thick] (0,2) -- (10,7);
node[nodeStyle] at (5,4.5) bfseriesnot filled;

beginscope
draw[thick] (0,4) -- (10,9);
node[nodeStyle,ERASE] at (5,6.5) bfseriesERASE to be implemented;
% erases everything in this scope "behind" this new object
% such that the diagonal line in this node is not visible and
% the text is easy to read and the coding is convenient
endscope

beginscope
% This just illustrates that clip can be used inside ascope
% thus the desired EREASE instruction might be possible.
clip (1,7) rectangle (8,10);
draw[thick] (0,6) -- (8,10);
endscope

endtikzpicture

enddocument


enter image description here



This imaginary tool might be unsuited for more complex use cases within several paths involved. Any suggestions on improving the use case are welcome.







share|improve this question














I am asking for a style (or something similar), let us call it ERASE. The imaginary tool works as a convenient inverse clip or eraser within a scope. The specific way is asked within the comment in the following MWE. The MWE is an abstract form of my use cases (if you do not like the background, think of color wheel graphs from complex analysis to smooth your ruffled feathers).



documentclassmemoir
usepackagefontspec,amsmath,tikz
usetikzlibraryshadings,calc
tikzsetnodeStyle/.style=draw,rounded corners,thick
tikzsetERASE/.style=% just a placeholder

begindocument
begintikzpicture
shade[shading=color wheel white center] (0,0) rectangle (10,10);

draw[thick] (0,0) -- (10,5);
node[nodeStyle,fill=white] at (5,2.5) bfseriesfilled;
%This is readable but removes the background.

draw[thick] (0,2) -- (10,7);
node[nodeStyle] at (5,4.5) bfseriesnot filled;

beginscope
draw[thick] (0,4) -- (10,9);
node[nodeStyle,ERASE] at (5,6.5) bfseriesERASE to be implemented;
% erases everything in this scope "behind" this new object
% such that the diagonal line in this node is not visible and
% the text is easy to read and the coding is convenient
endscope

beginscope
% This just illustrates that clip can be used inside ascope
% thus the desired EREASE instruction might be possible.
clip (1,7) rectangle (8,10);
draw[thick] (0,6) -- (8,10);
endscope

endtikzpicture

enddocument


enter image description here



This imaginary tool might be unsuited for more complex use cases within several paths involved. Any suggestions on improving the use case are welcome.









share|improve this question













share|improve this question




share|improve this question








edited Sep 1 at 22:18

























asked Sep 1 at 21:36









CampanIgnis

1,7562628




1,7562628







  • 1




    You can achieve that with the reverseclip trick.
    – marmot
    Sep 1 at 22:17










  • @marmot Is this a duplicate, do you think? I immediately thought of that kind of solution when I saw this. (Though I thought it was called 'inverse clip' or something like that.)
    – cfr
    Sep 2 at 3:18












  • 1




    You can achieve that with the reverseclip trick.
    – marmot
    Sep 1 at 22:17










  • @marmot Is this a duplicate, do you think? I immediately thought of that kind of solution when I saw this. (Though I thought it was called 'inverse clip' or something like that.)
    – cfr
    Sep 2 at 3:18







1




1




You can achieve that with the reverseclip trick.
– marmot
Sep 1 at 22:17




You can achieve that with the reverseclip trick.
– marmot
Sep 1 at 22:17












@marmot Is this a duplicate, do you think? I immediately thought of that kind of solution when I saw this. (Though I thought it was called 'inverse clip' or something like that.)
– cfr
Sep 2 at 3:18




@marmot Is this a duplicate, do you think? I immediately thought of that kind of solution when I saw this. (Though I thought it was called 'inverse clip' or something like that.)
– cfr
Sep 2 at 3:18










1 Answer
1






active

oldest

votes

















up vote
15
down vote



accepted










Here is a version using the reverseclip trick. I am not sure if one can easily implement this as a robust style that can be added to the node since clip does not allow extra options. However, apart from that this does it, I think. EDIT: Simplified the matters by employing use path.



documentclassmemoir
usepackagefontspec,amsmath,tikz
usetikzlibraryshadings,calc,backgrounds
tikzsetnodeStyle/.style=draw,rounded corners,thick
makeatletter % https://tex.stackexchange.com/a/38995/121799
tikzset
use path/.code=pgfsyssoftpath@setcurrentpath#1

makeatother
tikzsetERASE/.style=save path=tmprotect
% append after command=pgfextraclip[overlay]
% (tikzlastnode.south east) rectangle (tikzlastnode.north west)
% [reverseclip];
%
% just a placeholder
tikzsetreverseclip/.style=insert path=(current bounding box.north
east) rectangle (current bounding box.south west)

begindocument
begintikzpicture
shade[shading=color wheel white center] (0,0) rectangle (10,10);

draw[thick] (0,0) -- (10,5);
node[nodeStyle,fill=white,font=bfseries] at (5,2.5) filled;
%This is readable but removes the background.

draw[thick] (0,2) -- (10,7);
node[nodeStyle,font=bfseries] at (5,4.5) not filled;

beginscope
node[nodeStyle,ERASE,font=bfseries] at (5,6.5) (erase) ERASE has been implemented;
% erases everything in this scope "behind" this new object
% such that the diagonal line in this node is not visible and
% the text is easy to read and the coding is convenient
clip[use path=tmprotect,reverseclip];
draw[thick] (0,4) -- (10,9);
draw [ultra thick,red] (0,6.05) -- (10,6.95);
endscope

beginscope
% This just illustrates that clip can be used inside ascope
% thus the desired EREASE instruction might be possible.
clip (1,7) rectangle (8,10);
draw[thick] (0,6) -- (8,10);
endscope

endtikzpicture
enddocument


enter image description here



Now also the rounded corners are respected.



enter image description here






share|improve this answer






















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "85"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f448920%2feraser-tool-for-tikz%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    15
    down vote



    accepted










    Here is a version using the reverseclip trick. I am not sure if one can easily implement this as a robust style that can be added to the node since clip does not allow extra options. However, apart from that this does it, I think. EDIT: Simplified the matters by employing use path.



    documentclassmemoir
    usepackagefontspec,amsmath,tikz
    usetikzlibraryshadings,calc,backgrounds
    tikzsetnodeStyle/.style=draw,rounded corners,thick
    makeatletter % https://tex.stackexchange.com/a/38995/121799
    tikzset
    use path/.code=pgfsyssoftpath@setcurrentpath#1

    makeatother
    tikzsetERASE/.style=save path=tmprotect
    % append after command=pgfextraclip[overlay]
    % (tikzlastnode.south east) rectangle (tikzlastnode.north west)
    % [reverseclip];
    %
    % just a placeholder
    tikzsetreverseclip/.style=insert path=(current bounding box.north
    east) rectangle (current bounding box.south west)

    begindocument
    begintikzpicture
    shade[shading=color wheel white center] (0,0) rectangle (10,10);

    draw[thick] (0,0) -- (10,5);
    node[nodeStyle,fill=white,font=bfseries] at (5,2.5) filled;
    %This is readable but removes the background.

    draw[thick] (0,2) -- (10,7);
    node[nodeStyle,font=bfseries] at (5,4.5) not filled;

    beginscope
    node[nodeStyle,ERASE,font=bfseries] at (5,6.5) (erase) ERASE has been implemented;
    % erases everything in this scope "behind" this new object
    % such that the diagonal line in this node is not visible and
    % the text is easy to read and the coding is convenient
    clip[use path=tmprotect,reverseclip];
    draw[thick] (0,4) -- (10,9);
    draw [ultra thick,red] (0,6.05) -- (10,6.95);
    endscope

    beginscope
    % This just illustrates that clip can be used inside ascope
    % thus the desired EREASE instruction might be possible.
    clip (1,7) rectangle (8,10);
    draw[thick] (0,6) -- (8,10);
    endscope

    endtikzpicture
    enddocument


    enter image description here



    Now also the rounded corners are respected.



    enter image description here






    share|improve this answer


























      up vote
      15
      down vote



      accepted










      Here is a version using the reverseclip trick. I am not sure if one can easily implement this as a robust style that can be added to the node since clip does not allow extra options. However, apart from that this does it, I think. EDIT: Simplified the matters by employing use path.



      documentclassmemoir
      usepackagefontspec,amsmath,tikz
      usetikzlibraryshadings,calc,backgrounds
      tikzsetnodeStyle/.style=draw,rounded corners,thick
      makeatletter % https://tex.stackexchange.com/a/38995/121799
      tikzset
      use path/.code=pgfsyssoftpath@setcurrentpath#1

      makeatother
      tikzsetERASE/.style=save path=tmprotect
      % append after command=pgfextraclip[overlay]
      % (tikzlastnode.south east) rectangle (tikzlastnode.north west)
      % [reverseclip];
      %
      % just a placeholder
      tikzsetreverseclip/.style=insert path=(current bounding box.north
      east) rectangle (current bounding box.south west)

      begindocument
      begintikzpicture
      shade[shading=color wheel white center] (0,0) rectangle (10,10);

      draw[thick] (0,0) -- (10,5);
      node[nodeStyle,fill=white,font=bfseries] at (5,2.5) filled;
      %This is readable but removes the background.

      draw[thick] (0,2) -- (10,7);
      node[nodeStyle,font=bfseries] at (5,4.5) not filled;

      beginscope
      node[nodeStyle,ERASE,font=bfseries] at (5,6.5) (erase) ERASE has been implemented;
      % erases everything in this scope "behind" this new object
      % such that the diagonal line in this node is not visible and
      % the text is easy to read and the coding is convenient
      clip[use path=tmprotect,reverseclip];
      draw[thick] (0,4) -- (10,9);
      draw [ultra thick,red] (0,6.05) -- (10,6.95);
      endscope

      beginscope
      % This just illustrates that clip can be used inside ascope
      % thus the desired EREASE instruction might be possible.
      clip (1,7) rectangle (8,10);
      draw[thick] (0,6) -- (8,10);
      endscope

      endtikzpicture
      enddocument


      enter image description here



      Now also the rounded corners are respected.



      enter image description here






      share|improve this answer
























        up vote
        15
        down vote



        accepted







        up vote
        15
        down vote



        accepted






        Here is a version using the reverseclip trick. I am not sure if one can easily implement this as a robust style that can be added to the node since clip does not allow extra options. However, apart from that this does it, I think. EDIT: Simplified the matters by employing use path.



        documentclassmemoir
        usepackagefontspec,amsmath,tikz
        usetikzlibraryshadings,calc,backgrounds
        tikzsetnodeStyle/.style=draw,rounded corners,thick
        makeatletter % https://tex.stackexchange.com/a/38995/121799
        tikzset
        use path/.code=pgfsyssoftpath@setcurrentpath#1

        makeatother
        tikzsetERASE/.style=save path=tmprotect
        % append after command=pgfextraclip[overlay]
        % (tikzlastnode.south east) rectangle (tikzlastnode.north west)
        % [reverseclip];
        %
        % just a placeholder
        tikzsetreverseclip/.style=insert path=(current bounding box.north
        east) rectangle (current bounding box.south west)

        begindocument
        begintikzpicture
        shade[shading=color wheel white center] (0,0) rectangle (10,10);

        draw[thick] (0,0) -- (10,5);
        node[nodeStyle,fill=white,font=bfseries] at (5,2.5) filled;
        %This is readable but removes the background.

        draw[thick] (0,2) -- (10,7);
        node[nodeStyle,font=bfseries] at (5,4.5) not filled;

        beginscope
        node[nodeStyle,ERASE,font=bfseries] at (5,6.5) (erase) ERASE has been implemented;
        % erases everything in this scope "behind" this new object
        % such that the diagonal line in this node is not visible and
        % the text is easy to read and the coding is convenient
        clip[use path=tmprotect,reverseclip];
        draw[thick] (0,4) -- (10,9);
        draw [ultra thick,red] (0,6.05) -- (10,6.95);
        endscope

        beginscope
        % This just illustrates that clip can be used inside ascope
        % thus the desired EREASE instruction might be possible.
        clip (1,7) rectangle (8,10);
        draw[thick] (0,6) -- (8,10);
        endscope

        endtikzpicture
        enddocument


        enter image description here



        Now also the rounded corners are respected.



        enter image description here






        share|improve this answer














        Here is a version using the reverseclip trick. I am not sure if one can easily implement this as a robust style that can be added to the node since clip does not allow extra options. However, apart from that this does it, I think. EDIT: Simplified the matters by employing use path.



        documentclassmemoir
        usepackagefontspec,amsmath,tikz
        usetikzlibraryshadings,calc,backgrounds
        tikzsetnodeStyle/.style=draw,rounded corners,thick
        makeatletter % https://tex.stackexchange.com/a/38995/121799
        tikzset
        use path/.code=pgfsyssoftpath@setcurrentpath#1

        makeatother
        tikzsetERASE/.style=save path=tmprotect
        % append after command=pgfextraclip[overlay]
        % (tikzlastnode.south east) rectangle (tikzlastnode.north west)
        % [reverseclip];
        %
        % just a placeholder
        tikzsetreverseclip/.style=insert path=(current bounding box.north
        east) rectangle (current bounding box.south west)

        begindocument
        begintikzpicture
        shade[shading=color wheel white center] (0,0) rectangle (10,10);

        draw[thick] (0,0) -- (10,5);
        node[nodeStyle,fill=white,font=bfseries] at (5,2.5) filled;
        %This is readable but removes the background.

        draw[thick] (0,2) -- (10,7);
        node[nodeStyle,font=bfseries] at (5,4.5) not filled;

        beginscope
        node[nodeStyle,ERASE,font=bfseries] at (5,6.5) (erase) ERASE has been implemented;
        % erases everything in this scope "behind" this new object
        % such that the diagonal line in this node is not visible and
        % the text is easy to read and the coding is convenient
        clip[use path=tmprotect,reverseclip];
        draw[thick] (0,4) -- (10,9);
        draw [ultra thick,red] (0,6.05) -- (10,6.95);
        endscope

        beginscope
        % This just illustrates that clip can be used inside ascope
        % thus the desired EREASE instruction might be possible.
        clip (1,7) rectangle (8,10);
        draw[thick] (0,6) -- (8,10);
        endscope

        endtikzpicture
        enddocument


        enter image description here



        Now also the rounded corners are respected.



        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Sep 2 at 1:53

























        answered Sep 1 at 22:30









        marmot

        56.2k461123




        56.2k461123



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f448920%2feraser-tool-for-tikz%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            What does second last employer means? [closed]

            List of Gilmore Girls characters

            Confectionery