How to add multiple differently colored borders around a node?












6















I want to draw a node to be filled with a table containing data, and it should have (three) differently colored adjacent borders around it. Couldn't find anything in the PGF manual, on the Net, nor on this forum, so I came up with this MWE...



Nesting three tikzpicture environments feels like a BIG amateuristic kludge to me, and if not, how do I get rid of the white space in between the borders?



documentclass[pdftex,dutch]{article}
usepackage{babel}
usepackage{tikz}

begin{document}

definecolor{lichtgrijs}{RGB}{232,232,232}
definecolor{DE.rood}{RGB}{222,0,0}
definecolor{DE.geel}{RGB}{255,207,0}

begin{tikzpicture}
node[rectangle,line width=0.5mm,draw=black] at (0,0)
{begin{tikzpicture}
node[rectangle,line width=0.5mm,draw=DE.rood] at (0,0)
{begin{tikzpicture}
node[rectangle,line width=0.5mm,draw=DE.geel,fill=lichtgrijs] at (0,0) {Vliegtuig};
end{tikzpicture}};
end{tikzpicture}};
end{tikzpicture}

end{document}


My kludge










share|improve this question



























    6















    I want to draw a node to be filled with a table containing data, and it should have (three) differently colored adjacent borders around it. Couldn't find anything in the PGF manual, on the Net, nor on this forum, so I came up with this MWE...



    Nesting three tikzpicture environments feels like a BIG amateuristic kludge to me, and if not, how do I get rid of the white space in between the borders?



    documentclass[pdftex,dutch]{article}
    usepackage{babel}
    usepackage{tikz}

    begin{document}

    definecolor{lichtgrijs}{RGB}{232,232,232}
    definecolor{DE.rood}{RGB}{222,0,0}
    definecolor{DE.geel}{RGB}{255,207,0}

    begin{tikzpicture}
    node[rectangle,line width=0.5mm,draw=black] at (0,0)
    {begin{tikzpicture}
    node[rectangle,line width=0.5mm,draw=DE.rood] at (0,0)
    {begin{tikzpicture}
    node[rectangle,line width=0.5mm,draw=DE.geel,fill=lichtgrijs] at (0,0) {Vliegtuig};
    end{tikzpicture}};
    end{tikzpicture}};
    end{tikzpicture}

    end{document}


    My kludge










    share|improve this question

























      6












      6








      6


      1






      I want to draw a node to be filled with a table containing data, and it should have (three) differently colored adjacent borders around it. Couldn't find anything in the PGF manual, on the Net, nor on this forum, so I came up with this MWE...



      Nesting three tikzpicture environments feels like a BIG amateuristic kludge to me, and if not, how do I get rid of the white space in between the borders?



      documentclass[pdftex,dutch]{article}
      usepackage{babel}
      usepackage{tikz}

      begin{document}

      definecolor{lichtgrijs}{RGB}{232,232,232}
      definecolor{DE.rood}{RGB}{222,0,0}
      definecolor{DE.geel}{RGB}{255,207,0}

      begin{tikzpicture}
      node[rectangle,line width=0.5mm,draw=black] at (0,0)
      {begin{tikzpicture}
      node[rectangle,line width=0.5mm,draw=DE.rood] at (0,0)
      {begin{tikzpicture}
      node[rectangle,line width=0.5mm,draw=DE.geel,fill=lichtgrijs] at (0,0) {Vliegtuig};
      end{tikzpicture}};
      end{tikzpicture}};
      end{tikzpicture}

      end{document}


      My kludge










      share|improve this question














      I want to draw a node to be filled with a table containing data, and it should have (three) differently colored adjacent borders around it. Couldn't find anything in the PGF manual, on the Net, nor on this forum, so I came up with this MWE...



      Nesting three tikzpicture environments feels like a BIG amateuristic kludge to me, and if not, how do I get rid of the white space in between the borders?



      documentclass[pdftex,dutch]{article}
      usepackage{babel}
      usepackage{tikz}

      begin{document}

      definecolor{lichtgrijs}{RGB}{232,232,232}
      definecolor{DE.rood}{RGB}{222,0,0}
      definecolor{DE.geel}{RGB}{255,207,0}

      begin{tikzpicture}
      node[rectangle,line width=0.5mm,draw=black] at (0,0)
      {begin{tikzpicture}
      node[rectangle,line width=0.5mm,draw=DE.rood] at (0,0)
      {begin{tikzpicture}
      node[rectangle,line width=0.5mm,draw=DE.geel,fill=lichtgrijs] at (0,0) {Vliegtuig};
      end{tikzpicture}};
      end{tikzpicture}};
      end{tikzpicture}

      end{document}


      My kludge







      tikz-pgf nodes border






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 11 hours ago









      Petoetje59Petoetje59

      4391615




      4391615






















          4 Answers
          4






          active

          oldest

          votes


















          10














          Like this?



          enter image description here



          documentclass[dutch]{article}
          usepackage{babel}
          usepackage{tikz}
          usetikzlibrary{fit}

          definecolor{lichtgrijs}{RGB}{232,232,232}
          definecolor{DE.rood}{RGB}{222,0,0} % Rood in Duitse vlag
          definecolor{DE.geel}{RGB}{255,207,0} % Geel in Duitse vlag

          begin{document}
          begin{tikzpicture}[
          box/.style = {draw=#1, line width=0.5mm,inner sep=0.25mm}
          ]
          node (n1) [box=DE.geel,
          fill=lichtgrijs, inner sep=2mm] at (0,0) {Vliegtuig};
          node (n2) [box=DE.rood, fit=(n1)] {};
          node (n3) [box=black, fit=(n2)] {};
          end{tikzpicture}
          end{document}


          Some Notes:




          • never nest tikzpicture in tikzpicture, which may raise unexpected side effects;

          • the fit library of tikz is used to get what you want;

          • you can define node style, which merges all nodes in one, but I'd like first to know whether the illustrated result is what you're looking for :-)


          addendum:
          here is a three-color node variation. In particular, append after command= option in a node style is used for the middle and the outer colors:



          documentclass[dutch]{article}
          usepackage{babel}
          usepackage{tikz}
          usetikzlibrary{fit}

          definecolor{lichtgrijs}{RGB}{232,232,232}
          definecolor{DE.rood}{RGB}{222,0,0} % Rood in Duitse vlag
          definecolor{DE.geel}{RGB}{255,207,0} % Geel in Duitse vlag

          begin{document}

          begin{tikzpicture}[
          tcb/.style = {% three color border
          draw=DE.geel, fill=lichtgrijs,
          line width=0.5mm,inner sep=2mm,
          append after command={pgfextra{letLNtikzlastnode
          node [draw=DE.rood, line width=0.5mm,
          inner sep=0.25mm,fit=(LN)] {};
          node [draw, line width=0.5mm,
          inner sep=0.75mm,fit=(LN)] {};
          }}}
          ]
          node (n1) [tcb] {Vliegtuig};
          end{tikzpicture}
          end{document}


          The result is the same as before.






          share|improve this answer


























          • Yep, that's it! What an incredibly fast reply...

            – Petoetje59
            10 hours ago






          • 3





            @Roboticist, thank you very much!

            – Zarko
            9 hours ago






          • 1





            @Zarko: Any time, Sir! ;)

            – Roboticist
            9 hours ago





















          7














          Just for fun:



          documentclass{standalone}% to avoid cropping
          usepackage{babel}% not needed for MWE
          usepackage{tikz}
          usetikzlibrary{calc}

          definecolor{lichtgrijs}{RGB}{232,232,232}
          definecolor{DE.rood}{RGB}{222,0,0}
          definecolor{DE.geel}{RGB}{255,207,0}

          begin{document}
          begin{tikzpicture}
          begin{scope}[line width=0.5mm]
          node[draw=black,inner sep = 1.5mm] (n1) at (0,0) {Vliegtuig};
          draw[DE.rood] ($(n1.south west)+(0.75mm,0.75mm)$) rectangle ($(n1.north east)+(-0.75mm,-0.75mm)$);
          draw[DE.geel] ($(n1.south west)+(1.25mm,1.25mm)$) rectangle ($(n1.north east)+(-1.25mm,-1.25mm)$);
          end{scope}
          end{tikzpicture}
          end{document}


          demo






          share|improve this answer
























          • Did you use another text font? P.S. Good job!

            – manooooh
            8 hours ago











          • That's a nice answer! (+1) If you made it a pic with a tiny bit of extra effort you could make the thing rotatable, which the other answers could not (unless one wants to add rotate fit over and over).

            – marmot
            7 hours ago





















          6














          Without TikZ, only colorboxes:



          documentclass[pdftex,dutch]{article}
          usepackage{babel}
          usepackage{xcolor}

          definecolor{lichtgrijs}{RGB}{232,232,232}
          definecolor{DE.rood}{RGB}{222,0,0}
          definecolor{DE.geel}{RGB}{255,207,0}

          begin{document}

          colorbox{black}{%
          colorbox{DE.rood}{%
          colorbox{DE.geel}{%
          colorbox{lichtgrijs}{Vliegtuig}}}}

          end{document}


          enter image description here






          share|improve this answer
























          • Would've been the best solution... but unfortunately there appears to be no option to set the border width.

            – Petoetje59
            9 hours ago






          • 1





            @Petoetje59 You can set the dimensions of the colorboxes. But I have no time now, I'll update my answer asap.

            – CarLaTeX
            9 hours ago





















          1














          You do not need a library for that, and you can make things much more automatic by just supplying the list of colors. Then it boils down to saying



          node[inner sep=8pt,line width=2pt,multicolor rectangle={DE.rood,DE.geel}] {Vliegtuig};


          This strategy can be applied to other node shapes, too, if needed.



          Here is the code.



          documentclass[pdftex,dutch]{article}
          usepackage{babel}
          usepackage{tikz}

          begin{document}

          definecolor{lichtgrijs}{RGB}{232,232,232}
          definecolor{DE.rood}{RGB}{222,0,0}
          definecolor{DE.geel}{RGB}{255,207,0}

          begin{tikzpicture}[multicolor rectangle/.style={draw,path picture={
          foreach CPP [count=YPP] in {#1}
          {draw[CPP] ([xshift=YPP*pgflinewidth,yshift=YPP*pgflinewidth]path picture bounding box.south west)
          rectangle ([xshift=-YPP*pgflinewidth,yshift=-YPP*pgflinewidth]path picture bounding box.north east); }}}]
          node[inner sep=8pt,line width=2pt,multicolor rectangle={DE.rood,DE.geel}] {Vliegtuig};
          end{tikzpicture}

          end{document}


          enter image description here



          In case it bugs you that you have to set the inner sep by hand, this can be taken care of at the expense of a slightly longer code.






          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',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            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%2f477589%2fhow-to-add-multiple-differently-colored-borders-around-a-node%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            4 Answers
            4






            active

            oldest

            votes








            4 Answers
            4






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            10














            Like this?



            enter image description here



            documentclass[dutch]{article}
            usepackage{babel}
            usepackage{tikz}
            usetikzlibrary{fit}

            definecolor{lichtgrijs}{RGB}{232,232,232}
            definecolor{DE.rood}{RGB}{222,0,0} % Rood in Duitse vlag
            definecolor{DE.geel}{RGB}{255,207,0} % Geel in Duitse vlag

            begin{document}
            begin{tikzpicture}[
            box/.style = {draw=#1, line width=0.5mm,inner sep=0.25mm}
            ]
            node (n1) [box=DE.geel,
            fill=lichtgrijs, inner sep=2mm] at (0,0) {Vliegtuig};
            node (n2) [box=DE.rood, fit=(n1)] {};
            node (n3) [box=black, fit=(n2)] {};
            end{tikzpicture}
            end{document}


            Some Notes:




            • never nest tikzpicture in tikzpicture, which may raise unexpected side effects;

            • the fit library of tikz is used to get what you want;

            • you can define node style, which merges all nodes in one, but I'd like first to know whether the illustrated result is what you're looking for :-)


            addendum:
            here is a three-color node variation. In particular, append after command= option in a node style is used for the middle and the outer colors:



            documentclass[dutch]{article}
            usepackage{babel}
            usepackage{tikz}
            usetikzlibrary{fit}

            definecolor{lichtgrijs}{RGB}{232,232,232}
            definecolor{DE.rood}{RGB}{222,0,0} % Rood in Duitse vlag
            definecolor{DE.geel}{RGB}{255,207,0} % Geel in Duitse vlag

            begin{document}

            begin{tikzpicture}[
            tcb/.style = {% three color border
            draw=DE.geel, fill=lichtgrijs,
            line width=0.5mm,inner sep=2mm,
            append after command={pgfextra{letLNtikzlastnode
            node [draw=DE.rood, line width=0.5mm,
            inner sep=0.25mm,fit=(LN)] {};
            node [draw, line width=0.5mm,
            inner sep=0.75mm,fit=(LN)] {};
            }}}
            ]
            node (n1) [tcb] {Vliegtuig};
            end{tikzpicture}
            end{document}


            The result is the same as before.






            share|improve this answer


























            • Yep, that's it! What an incredibly fast reply...

              – Petoetje59
              10 hours ago






            • 3





              @Roboticist, thank you very much!

              – Zarko
              9 hours ago






            • 1





              @Zarko: Any time, Sir! ;)

              – Roboticist
              9 hours ago


















            10














            Like this?



            enter image description here



            documentclass[dutch]{article}
            usepackage{babel}
            usepackage{tikz}
            usetikzlibrary{fit}

            definecolor{lichtgrijs}{RGB}{232,232,232}
            definecolor{DE.rood}{RGB}{222,0,0} % Rood in Duitse vlag
            definecolor{DE.geel}{RGB}{255,207,0} % Geel in Duitse vlag

            begin{document}
            begin{tikzpicture}[
            box/.style = {draw=#1, line width=0.5mm,inner sep=0.25mm}
            ]
            node (n1) [box=DE.geel,
            fill=lichtgrijs, inner sep=2mm] at (0,0) {Vliegtuig};
            node (n2) [box=DE.rood, fit=(n1)] {};
            node (n3) [box=black, fit=(n2)] {};
            end{tikzpicture}
            end{document}


            Some Notes:




            • never nest tikzpicture in tikzpicture, which may raise unexpected side effects;

            • the fit library of tikz is used to get what you want;

            • you can define node style, which merges all nodes in one, but I'd like first to know whether the illustrated result is what you're looking for :-)


            addendum:
            here is a three-color node variation. In particular, append after command= option in a node style is used for the middle and the outer colors:



            documentclass[dutch]{article}
            usepackage{babel}
            usepackage{tikz}
            usetikzlibrary{fit}

            definecolor{lichtgrijs}{RGB}{232,232,232}
            definecolor{DE.rood}{RGB}{222,0,0} % Rood in Duitse vlag
            definecolor{DE.geel}{RGB}{255,207,0} % Geel in Duitse vlag

            begin{document}

            begin{tikzpicture}[
            tcb/.style = {% three color border
            draw=DE.geel, fill=lichtgrijs,
            line width=0.5mm,inner sep=2mm,
            append after command={pgfextra{letLNtikzlastnode
            node [draw=DE.rood, line width=0.5mm,
            inner sep=0.25mm,fit=(LN)] {};
            node [draw, line width=0.5mm,
            inner sep=0.75mm,fit=(LN)] {};
            }}}
            ]
            node (n1) [tcb] {Vliegtuig};
            end{tikzpicture}
            end{document}


            The result is the same as before.






            share|improve this answer


























            • Yep, that's it! What an incredibly fast reply...

              – Petoetje59
              10 hours ago






            • 3





              @Roboticist, thank you very much!

              – Zarko
              9 hours ago






            • 1





              @Zarko: Any time, Sir! ;)

              – Roboticist
              9 hours ago
















            10












            10








            10







            Like this?



            enter image description here



            documentclass[dutch]{article}
            usepackage{babel}
            usepackage{tikz}
            usetikzlibrary{fit}

            definecolor{lichtgrijs}{RGB}{232,232,232}
            definecolor{DE.rood}{RGB}{222,0,0} % Rood in Duitse vlag
            definecolor{DE.geel}{RGB}{255,207,0} % Geel in Duitse vlag

            begin{document}
            begin{tikzpicture}[
            box/.style = {draw=#1, line width=0.5mm,inner sep=0.25mm}
            ]
            node (n1) [box=DE.geel,
            fill=lichtgrijs, inner sep=2mm] at (0,0) {Vliegtuig};
            node (n2) [box=DE.rood, fit=(n1)] {};
            node (n3) [box=black, fit=(n2)] {};
            end{tikzpicture}
            end{document}


            Some Notes:




            • never nest tikzpicture in tikzpicture, which may raise unexpected side effects;

            • the fit library of tikz is used to get what you want;

            • you can define node style, which merges all nodes in one, but I'd like first to know whether the illustrated result is what you're looking for :-)


            addendum:
            here is a three-color node variation. In particular, append after command= option in a node style is used for the middle and the outer colors:



            documentclass[dutch]{article}
            usepackage{babel}
            usepackage{tikz}
            usetikzlibrary{fit}

            definecolor{lichtgrijs}{RGB}{232,232,232}
            definecolor{DE.rood}{RGB}{222,0,0} % Rood in Duitse vlag
            definecolor{DE.geel}{RGB}{255,207,0} % Geel in Duitse vlag

            begin{document}

            begin{tikzpicture}[
            tcb/.style = {% three color border
            draw=DE.geel, fill=lichtgrijs,
            line width=0.5mm,inner sep=2mm,
            append after command={pgfextra{letLNtikzlastnode
            node [draw=DE.rood, line width=0.5mm,
            inner sep=0.25mm,fit=(LN)] {};
            node [draw, line width=0.5mm,
            inner sep=0.75mm,fit=(LN)] {};
            }}}
            ]
            node (n1) [tcb] {Vliegtuig};
            end{tikzpicture}
            end{document}


            The result is the same as before.






            share|improve this answer















            Like this?



            enter image description here



            documentclass[dutch]{article}
            usepackage{babel}
            usepackage{tikz}
            usetikzlibrary{fit}

            definecolor{lichtgrijs}{RGB}{232,232,232}
            definecolor{DE.rood}{RGB}{222,0,0} % Rood in Duitse vlag
            definecolor{DE.geel}{RGB}{255,207,0} % Geel in Duitse vlag

            begin{document}
            begin{tikzpicture}[
            box/.style = {draw=#1, line width=0.5mm,inner sep=0.25mm}
            ]
            node (n1) [box=DE.geel,
            fill=lichtgrijs, inner sep=2mm] at (0,0) {Vliegtuig};
            node (n2) [box=DE.rood, fit=(n1)] {};
            node (n3) [box=black, fit=(n2)] {};
            end{tikzpicture}
            end{document}


            Some Notes:




            • never nest tikzpicture in tikzpicture, which may raise unexpected side effects;

            • the fit library of tikz is used to get what you want;

            • you can define node style, which merges all nodes in one, but I'd like first to know whether the illustrated result is what you're looking for :-)


            addendum:
            here is a three-color node variation. In particular, append after command= option in a node style is used for the middle and the outer colors:



            documentclass[dutch]{article}
            usepackage{babel}
            usepackage{tikz}
            usetikzlibrary{fit}

            definecolor{lichtgrijs}{RGB}{232,232,232}
            definecolor{DE.rood}{RGB}{222,0,0} % Rood in Duitse vlag
            definecolor{DE.geel}{RGB}{255,207,0} % Geel in Duitse vlag

            begin{document}

            begin{tikzpicture}[
            tcb/.style = {% three color border
            draw=DE.geel, fill=lichtgrijs,
            line width=0.5mm,inner sep=2mm,
            append after command={pgfextra{letLNtikzlastnode
            node [draw=DE.rood, line width=0.5mm,
            inner sep=0.25mm,fit=(LN)] {};
            node [draw, line width=0.5mm,
            inner sep=0.75mm,fit=(LN)] {};
            }}}
            ]
            node (n1) [tcb] {Vliegtuig};
            end{tikzpicture}
            end{document}


            The result is the same as before.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 4 hours ago

























            answered 11 hours ago









            ZarkoZarko

            126k868165




            126k868165













            • Yep, that's it! What an incredibly fast reply...

              – Petoetje59
              10 hours ago






            • 3





              @Roboticist, thank you very much!

              – Zarko
              9 hours ago






            • 1





              @Zarko: Any time, Sir! ;)

              – Roboticist
              9 hours ago





















            • Yep, that's it! What an incredibly fast reply...

              – Petoetje59
              10 hours ago






            • 3





              @Roboticist, thank you very much!

              – Zarko
              9 hours ago






            • 1





              @Zarko: Any time, Sir! ;)

              – Roboticist
              9 hours ago



















            Yep, that's it! What an incredibly fast reply...

            – Petoetje59
            10 hours ago





            Yep, that's it! What an incredibly fast reply...

            – Petoetje59
            10 hours ago




            3




            3





            @Roboticist, thank you very much!

            – Zarko
            9 hours ago





            @Roboticist, thank you very much!

            – Zarko
            9 hours ago




            1




            1





            @Zarko: Any time, Sir! ;)

            – Roboticist
            9 hours ago







            @Zarko: Any time, Sir! ;)

            – Roboticist
            9 hours ago













            7














            Just for fun:



            documentclass{standalone}% to avoid cropping
            usepackage{babel}% not needed for MWE
            usepackage{tikz}
            usetikzlibrary{calc}

            definecolor{lichtgrijs}{RGB}{232,232,232}
            definecolor{DE.rood}{RGB}{222,0,0}
            definecolor{DE.geel}{RGB}{255,207,0}

            begin{document}
            begin{tikzpicture}
            begin{scope}[line width=0.5mm]
            node[draw=black,inner sep = 1.5mm] (n1) at (0,0) {Vliegtuig};
            draw[DE.rood] ($(n1.south west)+(0.75mm,0.75mm)$) rectangle ($(n1.north east)+(-0.75mm,-0.75mm)$);
            draw[DE.geel] ($(n1.south west)+(1.25mm,1.25mm)$) rectangle ($(n1.north east)+(-1.25mm,-1.25mm)$);
            end{scope}
            end{tikzpicture}
            end{document}


            demo






            share|improve this answer
























            • Did you use another text font? P.S. Good job!

              – manooooh
              8 hours ago











            • That's a nice answer! (+1) If you made it a pic with a tiny bit of extra effort you could make the thing rotatable, which the other answers could not (unless one wants to add rotate fit over and over).

              – marmot
              7 hours ago


















            7














            Just for fun:



            documentclass{standalone}% to avoid cropping
            usepackage{babel}% not needed for MWE
            usepackage{tikz}
            usetikzlibrary{calc}

            definecolor{lichtgrijs}{RGB}{232,232,232}
            definecolor{DE.rood}{RGB}{222,0,0}
            definecolor{DE.geel}{RGB}{255,207,0}

            begin{document}
            begin{tikzpicture}
            begin{scope}[line width=0.5mm]
            node[draw=black,inner sep = 1.5mm] (n1) at (0,0) {Vliegtuig};
            draw[DE.rood] ($(n1.south west)+(0.75mm,0.75mm)$) rectangle ($(n1.north east)+(-0.75mm,-0.75mm)$);
            draw[DE.geel] ($(n1.south west)+(1.25mm,1.25mm)$) rectangle ($(n1.north east)+(-1.25mm,-1.25mm)$);
            end{scope}
            end{tikzpicture}
            end{document}


            demo






            share|improve this answer
























            • Did you use another text font? P.S. Good job!

              – manooooh
              8 hours ago











            • That's a nice answer! (+1) If you made it a pic with a tiny bit of extra effort you could make the thing rotatable, which the other answers could not (unless one wants to add rotate fit over and over).

              – marmot
              7 hours ago
















            7












            7








            7







            Just for fun:



            documentclass{standalone}% to avoid cropping
            usepackage{babel}% not needed for MWE
            usepackage{tikz}
            usetikzlibrary{calc}

            definecolor{lichtgrijs}{RGB}{232,232,232}
            definecolor{DE.rood}{RGB}{222,0,0}
            definecolor{DE.geel}{RGB}{255,207,0}

            begin{document}
            begin{tikzpicture}
            begin{scope}[line width=0.5mm]
            node[draw=black,inner sep = 1.5mm] (n1) at (0,0) {Vliegtuig};
            draw[DE.rood] ($(n1.south west)+(0.75mm,0.75mm)$) rectangle ($(n1.north east)+(-0.75mm,-0.75mm)$);
            draw[DE.geel] ($(n1.south west)+(1.25mm,1.25mm)$) rectangle ($(n1.north east)+(-1.25mm,-1.25mm)$);
            end{scope}
            end{tikzpicture}
            end{document}


            demo






            share|improve this answer













            Just for fun:



            documentclass{standalone}% to avoid cropping
            usepackage{babel}% not needed for MWE
            usepackage{tikz}
            usetikzlibrary{calc}

            definecolor{lichtgrijs}{RGB}{232,232,232}
            definecolor{DE.rood}{RGB}{222,0,0}
            definecolor{DE.geel}{RGB}{255,207,0}

            begin{document}
            begin{tikzpicture}
            begin{scope}[line width=0.5mm]
            node[draw=black,inner sep = 1.5mm] (n1) at (0,0) {Vliegtuig};
            draw[DE.rood] ($(n1.south west)+(0.75mm,0.75mm)$) rectangle ($(n1.north east)+(-0.75mm,-0.75mm)$);
            draw[DE.geel] ($(n1.south west)+(1.25mm,1.25mm)$) rectangle ($(n1.north east)+(-1.25mm,-1.25mm)$);
            end{scope}
            end{tikzpicture}
            end{document}


            demo







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 10 hours ago









            John KormyloJohn Kormylo

            44.8k12569




            44.8k12569













            • Did you use another text font? P.S. Good job!

              – manooooh
              8 hours ago











            • That's a nice answer! (+1) If you made it a pic with a tiny bit of extra effort you could make the thing rotatable, which the other answers could not (unless one wants to add rotate fit over and over).

              – marmot
              7 hours ago





















            • Did you use another text font? P.S. Good job!

              – manooooh
              8 hours ago











            • That's a nice answer! (+1) If you made it a pic with a tiny bit of extra effort you could make the thing rotatable, which the other answers could not (unless one wants to add rotate fit over and over).

              – marmot
              7 hours ago



















            Did you use another text font? P.S. Good job!

            – manooooh
            8 hours ago





            Did you use another text font? P.S. Good job!

            – manooooh
            8 hours ago













            That's a nice answer! (+1) If you made it a pic with a tiny bit of extra effort you could make the thing rotatable, which the other answers could not (unless one wants to add rotate fit over and over).

            – marmot
            7 hours ago







            That's a nice answer! (+1) If you made it a pic with a tiny bit of extra effort you could make the thing rotatable, which the other answers could not (unless one wants to add rotate fit over and over).

            – marmot
            7 hours ago













            6














            Without TikZ, only colorboxes:



            documentclass[pdftex,dutch]{article}
            usepackage{babel}
            usepackage{xcolor}

            definecolor{lichtgrijs}{RGB}{232,232,232}
            definecolor{DE.rood}{RGB}{222,0,0}
            definecolor{DE.geel}{RGB}{255,207,0}

            begin{document}

            colorbox{black}{%
            colorbox{DE.rood}{%
            colorbox{DE.geel}{%
            colorbox{lichtgrijs}{Vliegtuig}}}}

            end{document}


            enter image description here






            share|improve this answer
























            • Would've been the best solution... but unfortunately there appears to be no option to set the border width.

              – Petoetje59
              9 hours ago






            • 1





              @Petoetje59 You can set the dimensions of the colorboxes. But I have no time now, I'll update my answer asap.

              – CarLaTeX
              9 hours ago


















            6














            Without TikZ, only colorboxes:



            documentclass[pdftex,dutch]{article}
            usepackage{babel}
            usepackage{xcolor}

            definecolor{lichtgrijs}{RGB}{232,232,232}
            definecolor{DE.rood}{RGB}{222,0,0}
            definecolor{DE.geel}{RGB}{255,207,0}

            begin{document}

            colorbox{black}{%
            colorbox{DE.rood}{%
            colorbox{DE.geel}{%
            colorbox{lichtgrijs}{Vliegtuig}}}}

            end{document}


            enter image description here






            share|improve this answer
























            • Would've been the best solution... but unfortunately there appears to be no option to set the border width.

              – Petoetje59
              9 hours ago






            • 1





              @Petoetje59 You can set the dimensions of the colorboxes. But I have no time now, I'll update my answer asap.

              – CarLaTeX
              9 hours ago
















            6












            6








            6







            Without TikZ, only colorboxes:



            documentclass[pdftex,dutch]{article}
            usepackage{babel}
            usepackage{xcolor}

            definecolor{lichtgrijs}{RGB}{232,232,232}
            definecolor{DE.rood}{RGB}{222,0,0}
            definecolor{DE.geel}{RGB}{255,207,0}

            begin{document}

            colorbox{black}{%
            colorbox{DE.rood}{%
            colorbox{DE.geel}{%
            colorbox{lichtgrijs}{Vliegtuig}}}}

            end{document}


            enter image description here






            share|improve this answer













            Without TikZ, only colorboxes:



            documentclass[pdftex,dutch]{article}
            usepackage{babel}
            usepackage{xcolor}

            definecolor{lichtgrijs}{RGB}{232,232,232}
            definecolor{DE.rood}{RGB}{222,0,0}
            definecolor{DE.geel}{RGB}{255,207,0}

            begin{document}

            colorbox{black}{%
            colorbox{DE.rood}{%
            colorbox{DE.geel}{%
            colorbox{lichtgrijs}{Vliegtuig}}}}

            end{document}


            enter image description here







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 10 hours ago









            CarLaTeXCarLaTeX

            32.4k551134




            32.4k551134













            • Would've been the best solution... but unfortunately there appears to be no option to set the border width.

              – Petoetje59
              9 hours ago






            • 1





              @Petoetje59 You can set the dimensions of the colorboxes. But I have no time now, I'll update my answer asap.

              – CarLaTeX
              9 hours ago





















            • Would've been the best solution... but unfortunately there appears to be no option to set the border width.

              – Petoetje59
              9 hours ago






            • 1





              @Petoetje59 You can set the dimensions of the colorboxes. But I have no time now, I'll update my answer asap.

              – CarLaTeX
              9 hours ago



















            Would've been the best solution... but unfortunately there appears to be no option to set the border width.

            – Petoetje59
            9 hours ago





            Would've been the best solution... but unfortunately there appears to be no option to set the border width.

            – Petoetje59
            9 hours ago




            1




            1





            @Petoetje59 You can set the dimensions of the colorboxes. But I have no time now, I'll update my answer asap.

            – CarLaTeX
            9 hours ago







            @Petoetje59 You can set the dimensions of the colorboxes. But I have no time now, I'll update my answer asap.

            – CarLaTeX
            9 hours ago













            1














            You do not need a library for that, and you can make things much more automatic by just supplying the list of colors. Then it boils down to saying



            node[inner sep=8pt,line width=2pt,multicolor rectangle={DE.rood,DE.geel}] {Vliegtuig};


            This strategy can be applied to other node shapes, too, if needed.



            Here is the code.



            documentclass[pdftex,dutch]{article}
            usepackage{babel}
            usepackage{tikz}

            begin{document}

            definecolor{lichtgrijs}{RGB}{232,232,232}
            definecolor{DE.rood}{RGB}{222,0,0}
            definecolor{DE.geel}{RGB}{255,207,0}

            begin{tikzpicture}[multicolor rectangle/.style={draw,path picture={
            foreach CPP [count=YPP] in {#1}
            {draw[CPP] ([xshift=YPP*pgflinewidth,yshift=YPP*pgflinewidth]path picture bounding box.south west)
            rectangle ([xshift=-YPP*pgflinewidth,yshift=-YPP*pgflinewidth]path picture bounding box.north east); }}}]
            node[inner sep=8pt,line width=2pt,multicolor rectangle={DE.rood,DE.geel}] {Vliegtuig};
            end{tikzpicture}

            end{document}


            enter image description here



            In case it bugs you that you have to set the inner sep by hand, this can be taken care of at the expense of a slightly longer code.






            share|improve this answer




























              1














              You do not need a library for that, and you can make things much more automatic by just supplying the list of colors. Then it boils down to saying



              node[inner sep=8pt,line width=2pt,multicolor rectangle={DE.rood,DE.geel}] {Vliegtuig};


              This strategy can be applied to other node shapes, too, if needed.



              Here is the code.



              documentclass[pdftex,dutch]{article}
              usepackage{babel}
              usepackage{tikz}

              begin{document}

              definecolor{lichtgrijs}{RGB}{232,232,232}
              definecolor{DE.rood}{RGB}{222,0,0}
              definecolor{DE.geel}{RGB}{255,207,0}

              begin{tikzpicture}[multicolor rectangle/.style={draw,path picture={
              foreach CPP [count=YPP] in {#1}
              {draw[CPP] ([xshift=YPP*pgflinewidth,yshift=YPP*pgflinewidth]path picture bounding box.south west)
              rectangle ([xshift=-YPP*pgflinewidth,yshift=-YPP*pgflinewidth]path picture bounding box.north east); }}}]
              node[inner sep=8pt,line width=2pt,multicolor rectangle={DE.rood,DE.geel}] {Vliegtuig};
              end{tikzpicture}

              end{document}


              enter image description here



              In case it bugs you that you have to set the inner sep by hand, this can be taken care of at the expense of a slightly longer code.






              share|improve this answer


























                1












                1








                1







                You do not need a library for that, and you can make things much more automatic by just supplying the list of colors. Then it boils down to saying



                node[inner sep=8pt,line width=2pt,multicolor rectangle={DE.rood,DE.geel}] {Vliegtuig};


                This strategy can be applied to other node shapes, too, if needed.



                Here is the code.



                documentclass[pdftex,dutch]{article}
                usepackage{babel}
                usepackage{tikz}

                begin{document}

                definecolor{lichtgrijs}{RGB}{232,232,232}
                definecolor{DE.rood}{RGB}{222,0,0}
                definecolor{DE.geel}{RGB}{255,207,0}

                begin{tikzpicture}[multicolor rectangle/.style={draw,path picture={
                foreach CPP [count=YPP] in {#1}
                {draw[CPP] ([xshift=YPP*pgflinewidth,yshift=YPP*pgflinewidth]path picture bounding box.south west)
                rectangle ([xshift=-YPP*pgflinewidth,yshift=-YPP*pgflinewidth]path picture bounding box.north east); }}}]
                node[inner sep=8pt,line width=2pt,multicolor rectangle={DE.rood,DE.geel}] {Vliegtuig};
                end{tikzpicture}

                end{document}


                enter image description here



                In case it bugs you that you have to set the inner sep by hand, this can be taken care of at the expense of a slightly longer code.






                share|improve this answer













                You do not need a library for that, and you can make things much more automatic by just supplying the list of colors. Then it boils down to saying



                node[inner sep=8pt,line width=2pt,multicolor rectangle={DE.rood,DE.geel}] {Vliegtuig};


                This strategy can be applied to other node shapes, too, if needed.



                Here is the code.



                documentclass[pdftex,dutch]{article}
                usepackage{babel}
                usepackage{tikz}

                begin{document}

                definecolor{lichtgrijs}{RGB}{232,232,232}
                definecolor{DE.rood}{RGB}{222,0,0}
                definecolor{DE.geel}{RGB}{255,207,0}

                begin{tikzpicture}[multicolor rectangle/.style={draw,path picture={
                foreach CPP [count=YPP] in {#1}
                {draw[CPP] ([xshift=YPP*pgflinewidth,yshift=YPP*pgflinewidth]path picture bounding box.south west)
                rectangle ([xshift=-YPP*pgflinewidth,yshift=-YPP*pgflinewidth]path picture bounding box.north east); }}}]
                node[inner sep=8pt,line width=2pt,multicolor rectangle={DE.rood,DE.geel}] {Vliegtuig};
                end{tikzpicture}

                end{document}


                enter image description here



                In case it bugs you that you have to set the inner sep by hand, this can be taken care of at the expense of a slightly longer code.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 7 hours ago









                marmotmarmot

                105k4126241




                105k4126241






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f477589%2fhow-to-add-multiple-differently-colored-borders-around-a-node%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    日野市

                    GameSpot

                    Tu-95轟炸機