Coloring a sub-table











up vote
3
down vote

favorite
2












I want modify the following example to obtain a colored sub-table (only the border) as in the present picture.



sub-table



documentclass{article}
usepackage{array}


begin{document}

begin{tabular}{|c|c|c|c|c|}
hline
1 & 3 & 2& B& C \
hline
A & B& C& B& C \
hline
D & E & K& B& F \
hline
G & H & I& B& C\
hline
end{tabular}


end{document}









share|improve this question




























    up vote
    3
    down vote

    favorite
    2












    I want modify the following example to obtain a colored sub-table (only the border) as in the present picture.



    sub-table



    documentclass{article}
    usepackage{array}


    begin{document}

    begin{tabular}{|c|c|c|c|c|}
    hline
    1 & 3 & 2& B& C \
    hline
    A & B& C& B& C \
    hline
    D & E & K& B& F \
    hline
    G & H & I& B& C\
    hline
    end{tabular}


    end{document}









    share|improve this question


























      up vote
      3
      down vote

      favorite
      2









      up vote
      3
      down vote

      favorite
      2






      2





      I want modify the following example to obtain a colored sub-table (only the border) as in the present picture.



      sub-table



      documentclass{article}
      usepackage{array}


      begin{document}

      begin{tabular}{|c|c|c|c|c|}
      hline
      1 & 3 & 2& B& C \
      hline
      A & B& C& B& C \
      hline
      D & E & K& B& F \
      hline
      G & H & I& B& C\
      hline
      end{tabular}


      end{document}









      share|improve this question















      I want modify the following example to obtain a colored sub-table (only the border) as in the present picture.



      sub-table



      documentclass{article}
      usepackage{array}


      begin{document}

      begin{tabular}{|c|c|c|c|c|}
      hline
      1 & 3 & 2& B& C \
      hline
      A & B& C& B& C \
      hline
      D & E & K& B& F \
      hline
      G & H & I& B& C\
      hline
      end{tabular}


      end{document}






      tables






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 1 at 22:08

























      asked Dec 1 at 21:55









      user105476

      817




      817






















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          8
          down vote













          Not that elegant, but you could use a combination of cline and multicolumn to achieve the desired red frame around the four cells:



          documentclass{article}
          usepackage{array}
          usepackage[table]{xcolor}

          begin{document}

          begin{tabular}{|c|c|c|c|c|}
          hline
          1 & 3 & 2& B& C \
          cline{1-2} arrayrulecolor{red}cline{3-4} arrayrulecolor{black}cline{5-5}
          A & multicolumn{1}{c!{color{red}vrule}}{B}& C& multicolumn{1}{c!{color{red}vrule}}{B}& C \
          hline
          D & multicolumn{1}{c!{color{red}vrule}}{E} & K& multicolumn{1}{c!{color{red}vrule}}{B}& F \
          cline{1-2} arrayrulecolor{red}cline{3-4} arrayrulecolor{black}cline{5-5}
          G & H & I& B& C\
          hline
          end{tabular}

          end{document}


          enter image description here






          share|improve this answer























          • Thank you ........
            – user105476
            Dec 1 at 22:58


















          up vote
          7
          down vote













          That's just for fun: you can draw pretty much anything with tikz, so why not here? In particular, when using tikzmark you can conveniently annotate whatever you already have.



          documentclass{article}
          usepackage{array}
          usepackage{tikz}
          usetikzlibrary{tikzmark,calc}
          begin{document}

          begin{tabular}{|c|c|c|c|c|}
          hline
          1 & tikzmarknode{3}{3} & 2& B& C \
          hline
          A & B& tikzmarknode{C1}{C}& B& C \
          hline
          D & E & K& tikzmarknode{B}{B}& F \
          hline
          G & H & I& B& tikzmarknode{C2}{C}\
          hline
          end{tabular}
          begin{tikzpicture}[overlay,remember picture]
          draw[red,thick] ([yshift=-1pt]$(3)!0.5!(C1)$) rectangle ([yshift=-1pt]$(B)!0.5!(C2)$);
          end{tikzpicture}
          end{document}


          enter image description here



          To be clear, I am not suggesting to use this if you only want to draw some red lines. In this case, I think that Leandris' very nice answer is the way to go. However, at the very moment you are interested in more fancy things, then this here might be the way to go.



          documentclass{article}
          usepackage{array}
          usepackage{tikz}
          usetikzlibrary{tikzmark,calc}
          begin{document}

          begin{tabular}{|c|c|c|c|c|}
          hline
          1 & tikzmarknode{3}{3} & 2& B& C \
          hline
          A & B& tikzmarknode{C1}{C}& B& C \
          hline
          D & E & K& tikzmarknode{B}{B}& F \
          hline
          G & H & I& B& tikzmarknode{C2}{C}\
          hline
          end{tabular}
          begin{tikzpicture}[overlay,remember picture]
          newlength{Border}
          Border=0.8pt
          fill[left color=red,right color=blue,shading angle=45,even odd rule]
          ([yshift={-1pt+0.5Border},xshift={-0.5Border}]$(3)!0.5!(C1)$) rectangle
          ([yshift={-1-0.5Border},xshift={+0.5Border}]$(B)!0.5!(C2)$)
          [rounded corners]
          ([yshift={-1pt-0.5Border},xshift={0.5Border}]$(3)!0.5!(C1)$) rectangle
          ([yshift={-1pt+0.5Border},xshift={-0.5Border}]$(B)!0.5!(C2)$)
          ;
          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer






























            up vote
            3
            down vote













            You can use cellcolor{..} to color single cells. You need the xcolor package or just the colortbl package, the former loads the latter. Note that some PDF viewers hide table lines behind the color.



            documentclass{article}
            usepackage{array}
            usepackage[table]{xcolor}

            begin{document}

            begin{tabular}{|c|c|c|c|c|}
            hline
            1 & 3 & 2& B& C \hline
            A & B& cellcolor{blue!25}C& cellcolor{blue!25}B& C \hline
            D & E & cellcolor{blue!25}K& cellcolor{blue!25}B& F \hline
            G & H & I& B& C \hline
            end{tabular}

            end{document}


            enter image description here






            share|improve this answer

















            • 1




              I want please coloring only the border.
              – user105476
              Dec 1 at 22:07






            • 2




              @user105476, than you need to make your question more clear. please edit it and explain what you like to have. above answer gives exactly what you ask.
              – Zarko
              Dec 1 at 22:28











            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: 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%2f462753%2fcoloring-a-sub-table%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            8
            down vote













            Not that elegant, but you could use a combination of cline and multicolumn to achieve the desired red frame around the four cells:



            documentclass{article}
            usepackage{array}
            usepackage[table]{xcolor}

            begin{document}

            begin{tabular}{|c|c|c|c|c|}
            hline
            1 & 3 & 2& B& C \
            cline{1-2} arrayrulecolor{red}cline{3-4} arrayrulecolor{black}cline{5-5}
            A & multicolumn{1}{c!{color{red}vrule}}{B}& C& multicolumn{1}{c!{color{red}vrule}}{B}& C \
            hline
            D & multicolumn{1}{c!{color{red}vrule}}{E} & K& multicolumn{1}{c!{color{red}vrule}}{B}& F \
            cline{1-2} arrayrulecolor{red}cline{3-4} arrayrulecolor{black}cline{5-5}
            G & H & I& B& C\
            hline
            end{tabular}

            end{document}


            enter image description here






            share|improve this answer























            • Thank you ........
              – user105476
              Dec 1 at 22:58















            up vote
            8
            down vote













            Not that elegant, but you could use a combination of cline and multicolumn to achieve the desired red frame around the four cells:



            documentclass{article}
            usepackage{array}
            usepackage[table]{xcolor}

            begin{document}

            begin{tabular}{|c|c|c|c|c|}
            hline
            1 & 3 & 2& B& C \
            cline{1-2} arrayrulecolor{red}cline{3-4} arrayrulecolor{black}cline{5-5}
            A & multicolumn{1}{c!{color{red}vrule}}{B}& C& multicolumn{1}{c!{color{red}vrule}}{B}& C \
            hline
            D & multicolumn{1}{c!{color{red}vrule}}{E} & K& multicolumn{1}{c!{color{red}vrule}}{B}& F \
            cline{1-2} arrayrulecolor{red}cline{3-4} arrayrulecolor{black}cline{5-5}
            G & H & I& B& C\
            hline
            end{tabular}

            end{document}


            enter image description here






            share|improve this answer























            • Thank you ........
              – user105476
              Dec 1 at 22:58













            up vote
            8
            down vote










            up vote
            8
            down vote









            Not that elegant, but you could use a combination of cline and multicolumn to achieve the desired red frame around the four cells:



            documentclass{article}
            usepackage{array}
            usepackage[table]{xcolor}

            begin{document}

            begin{tabular}{|c|c|c|c|c|}
            hline
            1 & 3 & 2& B& C \
            cline{1-2} arrayrulecolor{red}cline{3-4} arrayrulecolor{black}cline{5-5}
            A & multicolumn{1}{c!{color{red}vrule}}{B}& C& multicolumn{1}{c!{color{red}vrule}}{B}& C \
            hline
            D & multicolumn{1}{c!{color{red}vrule}}{E} & K& multicolumn{1}{c!{color{red}vrule}}{B}& F \
            cline{1-2} arrayrulecolor{red}cline{3-4} arrayrulecolor{black}cline{5-5}
            G & H & I& B& C\
            hline
            end{tabular}

            end{document}


            enter image description here






            share|improve this answer














            Not that elegant, but you could use a combination of cline and multicolumn to achieve the desired red frame around the four cells:



            documentclass{article}
            usepackage{array}
            usepackage[table]{xcolor}

            begin{document}

            begin{tabular}{|c|c|c|c|c|}
            hline
            1 & 3 & 2& B& C \
            cline{1-2} arrayrulecolor{red}cline{3-4} arrayrulecolor{black}cline{5-5}
            A & multicolumn{1}{c!{color{red}vrule}}{B}& C& multicolumn{1}{c!{color{red}vrule}}{B}& C \
            hline
            D & multicolumn{1}{c!{color{red}vrule}}{E} & K& multicolumn{1}{c!{color{red}vrule}}{B}& F \
            cline{1-2} arrayrulecolor{red}cline{3-4} arrayrulecolor{black}cline{5-5}
            G & H & I& B& C\
            hline
            end{tabular}

            end{document}


            enter image description here







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 2 at 9:20

























            answered Dec 1 at 22:55









            leandriis

            7,9071528




            7,9071528












            • Thank you ........
              – user105476
              Dec 1 at 22:58


















            • Thank you ........
              – user105476
              Dec 1 at 22:58
















            Thank you ........
            – user105476
            Dec 1 at 22:58




            Thank you ........
            – user105476
            Dec 1 at 22:58










            up vote
            7
            down vote













            That's just for fun: you can draw pretty much anything with tikz, so why not here? In particular, when using tikzmark you can conveniently annotate whatever you already have.



            documentclass{article}
            usepackage{array}
            usepackage{tikz}
            usetikzlibrary{tikzmark,calc}
            begin{document}

            begin{tabular}{|c|c|c|c|c|}
            hline
            1 & tikzmarknode{3}{3} & 2& B& C \
            hline
            A & B& tikzmarknode{C1}{C}& B& C \
            hline
            D & E & K& tikzmarknode{B}{B}& F \
            hline
            G & H & I& B& tikzmarknode{C2}{C}\
            hline
            end{tabular}
            begin{tikzpicture}[overlay,remember picture]
            draw[red,thick] ([yshift=-1pt]$(3)!0.5!(C1)$) rectangle ([yshift=-1pt]$(B)!0.5!(C2)$);
            end{tikzpicture}
            end{document}


            enter image description here



            To be clear, I am not suggesting to use this if you only want to draw some red lines. In this case, I think that Leandris' very nice answer is the way to go. However, at the very moment you are interested in more fancy things, then this here might be the way to go.



            documentclass{article}
            usepackage{array}
            usepackage{tikz}
            usetikzlibrary{tikzmark,calc}
            begin{document}

            begin{tabular}{|c|c|c|c|c|}
            hline
            1 & tikzmarknode{3}{3} & 2& B& C \
            hline
            A & B& tikzmarknode{C1}{C}& B& C \
            hline
            D & E & K& tikzmarknode{B}{B}& F \
            hline
            G & H & I& B& tikzmarknode{C2}{C}\
            hline
            end{tabular}
            begin{tikzpicture}[overlay,remember picture]
            newlength{Border}
            Border=0.8pt
            fill[left color=red,right color=blue,shading angle=45,even odd rule]
            ([yshift={-1pt+0.5Border},xshift={-0.5Border}]$(3)!0.5!(C1)$) rectangle
            ([yshift={-1-0.5Border},xshift={+0.5Border}]$(B)!0.5!(C2)$)
            [rounded corners]
            ([yshift={-1pt-0.5Border},xshift={0.5Border}]$(3)!0.5!(C1)$) rectangle
            ([yshift={-1pt+0.5Border},xshift={-0.5Border}]$(B)!0.5!(C2)$)
            ;
            end{tikzpicture}
            end{document}


            enter image description here






            share|improve this answer



























              up vote
              7
              down vote













              That's just for fun: you can draw pretty much anything with tikz, so why not here? In particular, when using tikzmark you can conveniently annotate whatever you already have.



              documentclass{article}
              usepackage{array}
              usepackage{tikz}
              usetikzlibrary{tikzmark,calc}
              begin{document}

              begin{tabular}{|c|c|c|c|c|}
              hline
              1 & tikzmarknode{3}{3} & 2& B& C \
              hline
              A & B& tikzmarknode{C1}{C}& B& C \
              hline
              D & E & K& tikzmarknode{B}{B}& F \
              hline
              G & H & I& B& tikzmarknode{C2}{C}\
              hline
              end{tabular}
              begin{tikzpicture}[overlay,remember picture]
              draw[red,thick] ([yshift=-1pt]$(3)!0.5!(C1)$) rectangle ([yshift=-1pt]$(B)!0.5!(C2)$);
              end{tikzpicture}
              end{document}


              enter image description here



              To be clear, I am not suggesting to use this if you only want to draw some red lines. In this case, I think that Leandris' very nice answer is the way to go. However, at the very moment you are interested in more fancy things, then this here might be the way to go.



              documentclass{article}
              usepackage{array}
              usepackage{tikz}
              usetikzlibrary{tikzmark,calc}
              begin{document}

              begin{tabular}{|c|c|c|c|c|}
              hline
              1 & tikzmarknode{3}{3} & 2& B& C \
              hline
              A & B& tikzmarknode{C1}{C}& B& C \
              hline
              D & E & K& tikzmarknode{B}{B}& F \
              hline
              G & H & I& B& tikzmarknode{C2}{C}\
              hline
              end{tabular}
              begin{tikzpicture}[overlay,remember picture]
              newlength{Border}
              Border=0.8pt
              fill[left color=red,right color=blue,shading angle=45,even odd rule]
              ([yshift={-1pt+0.5Border},xshift={-0.5Border}]$(3)!0.5!(C1)$) rectangle
              ([yshift={-1-0.5Border},xshift={+0.5Border}]$(B)!0.5!(C2)$)
              [rounded corners]
              ([yshift={-1pt-0.5Border},xshift={0.5Border}]$(3)!0.5!(C1)$) rectangle
              ([yshift={-1pt+0.5Border},xshift={-0.5Border}]$(B)!0.5!(C2)$)
              ;
              end{tikzpicture}
              end{document}


              enter image description here






              share|improve this answer

























                up vote
                7
                down vote










                up vote
                7
                down vote









                That's just for fun: you can draw pretty much anything with tikz, so why not here? In particular, when using tikzmark you can conveniently annotate whatever you already have.



                documentclass{article}
                usepackage{array}
                usepackage{tikz}
                usetikzlibrary{tikzmark,calc}
                begin{document}

                begin{tabular}{|c|c|c|c|c|}
                hline
                1 & tikzmarknode{3}{3} & 2& B& C \
                hline
                A & B& tikzmarknode{C1}{C}& B& C \
                hline
                D & E & K& tikzmarknode{B}{B}& F \
                hline
                G & H & I& B& tikzmarknode{C2}{C}\
                hline
                end{tabular}
                begin{tikzpicture}[overlay,remember picture]
                draw[red,thick] ([yshift=-1pt]$(3)!0.5!(C1)$) rectangle ([yshift=-1pt]$(B)!0.5!(C2)$);
                end{tikzpicture}
                end{document}


                enter image description here



                To be clear, I am not suggesting to use this if you only want to draw some red lines. In this case, I think that Leandris' very nice answer is the way to go. However, at the very moment you are interested in more fancy things, then this here might be the way to go.



                documentclass{article}
                usepackage{array}
                usepackage{tikz}
                usetikzlibrary{tikzmark,calc}
                begin{document}

                begin{tabular}{|c|c|c|c|c|}
                hline
                1 & tikzmarknode{3}{3} & 2& B& C \
                hline
                A & B& tikzmarknode{C1}{C}& B& C \
                hline
                D & E & K& tikzmarknode{B}{B}& F \
                hline
                G & H & I& B& tikzmarknode{C2}{C}\
                hline
                end{tabular}
                begin{tikzpicture}[overlay,remember picture]
                newlength{Border}
                Border=0.8pt
                fill[left color=red,right color=blue,shading angle=45,even odd rule]
                ([yshift={-1pt+0.5Border},xshift={-0.5Border}]$(3)!0.5!(C1)$) rectangle
                ([yshift={-1-0.5Border},xshift={+0.5Border}]$(B)!0.5!(C2)$)
                [rounded corners]
                ([yshift={-1pt-0.5Border},xshift={0.5Border}]$(3)!0.5!(C1)$) rectangle
                ([yshift={-1pt+0.5Border},xshift={-0.5Border}]$(B)!0.5!(C2)$)
                ;
                end{tikzpicture}
                end{document}


                enter image description here






                share|improve this answer














                That's just for fun: you can draw pretty much anything with tikz, so why not here? In particular, when using tikzmark you can conveniently annotate whatever you already have.



                documentclass{article}
                usepackage{array}
                usepackage{tikz}
                usetikzlibrary{tikzmark,calc}
                begin{document}

                begin{tabular}{|c|c|c|c|c|}
                hline
                1 & tikzmarknode{3}{3} & 2& B& C \
                hline
                A & B& tikzmarknode{C1}{C}& B& C \
                hline
                D & E & K& tikzmarknode{B}{B}& F \
                hline
                G & H & I& B& tikzmarknode{C2}{C}\
                hline
                end{tabular}
                begin{tikzpicture}[overlay,remember picture]
                draw[red,thick] ([yshift=-1pt]$(3)!0.5!(C1)$) rectangle ([yshift=-1pt]$(B)!0.5!(C2)$);
                end{tikzpicture}
                end{document}


                enter image description here



                To be clear, I am not suggesting to use this if you only want to draw some red lines. In this case, I think that Leandris' very nice answer is the way to go. However, at the very moment you are interested in more fancy things, then this here might be the way to go.



                documentclass{article}
                usepackage{array}
                usepackage{tikz}
                usetikzlibrary{tikzmark,calc}
                begin{document}

                begin{tabular}{|c|c|c|c|c|}
                hline
                1 & tikzmarknode{3}{3} & 2& B& C \
                hline
                A & B& tikzmarknode{C1}{C}& B& C \
                hline
                D & E & K& tikzmarknode{B}{B}& F \
                hline
                G & H & I& B& tikzmarknode{C2}{C}\
                hline
                end{tabular}
                begin{tikzpicture}[overlay,remember picture]
                newlength{Border}
                Border=0.8pt
                fill[left color=red,right color=blue,shading angle=45,even odd rule]
                ([yshift={-1pt+0.5Border},xshift={-0.5Border}]$(3)!0.5!(C1)$) rectangle
                ([yshift={-1-0.5Border},xshift={+0.5Border}]$(B)!0.5!(C2)$)
                [rounded corners]
                ([yshift={-1pt-0.5Border},xshift={0.5Border}]$(3)!0.5!(C1)$) rectangle
                ([yshift={-1pt+0.5Border},xshift={-0.5Border}]$(B)!0.5!(C2)$)
                ;
                end{tikzpicture}
                end{document}


                enter image description here







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 2 at 1:02

























                answered Dec 2 at 0:29









                marmot

                83.6k493178




                83.6k493178






















                    up vote
                    3
                    down vote













                    You can use cellcolor{..} to color single cells. You need the xcolor package or just the colortbl package, the former loads the latter. Note that some PDF viewers hide table lines behind the color.



                    documentclass{article}
                    usepackage{array}
                    usepackage[table]{xcolor}

                    begin{document}

                    begin{tabular}{|c|c|c|c|c|}
                    hline
                    1 & 3 & 2& B& C \hline
                    A & B& cellcolor{blue!25}C& cellcolor{blue!25}B& C \hline
                    D & E & cellcolor{blue!25}K& cellcolor{blue!25}B& F \hline
                    G & H & I& B& C \hline
                    end{tabular}

                    end{document}


                    enter image description here






                    share|improve this answer

















                    • 1




                      I want please coloring only the border.
                      – user105476
                      Dec 1 at 22:07






                    • 2




                      @user105476, than you need to make your question more clear. please edit it and explain what you like to have. above answer gives exactly what you ask.
                      – Zarko
                      Dec 1 at 22:28















                    up vote
                    3
                    down vote













                    You can use cellcolor{..} to color single cells. You need the xcolor package or just the colortbl package, the former loads the latter. Note that some PDF viewers hide table lines behind the color.



                    documentclass{article}
                    usepackage{array}
                    usepackage[table]{xcolor}

                    begin{document}

                    begin{tabular}{|c|c|c|c|c|}
                    hline
                    1 & 3 & 2& B& C \hline
                    A & B& cellcolor{blue!25}C& cellcolor{blue!25}B& C \hline
                    D & E & cellcolor{blue!25}K& cellcolor{blue!25}B& F \hline
                    G & H & I& B& C \hline
                    end{tabular}

                    end{document}


                    enter image description here






                    share|improve this answer

















                    • 1




                      I want please coloring only the border.
                      – user105476
                      Dec 1 at 22:07






                    • 2




                      @user105476, than you need to make your question more clear. please edit it and explain what you like to have. above answer gives exactly what you ask.
                      – Zarko
                      Dec 1 at 22:28













                    up vote
                    3
                    down vote










                    up vote
                    3
                    down vote









                    You can use cellcolor{..} to color single cells. You need the xcolor package or just the colortbl package, the former loads the latter. Note that some PDF viewers hide table lines behind the color.



                    documentclass{article}
                    usepackage{array}
                    usepackage[table]{xcolor}

                    begin{document}

                    begin{tabular}{|c|c|c|c|c|}
                    hline
                    1 & 3 & 2& B& C \hline
                    A & B& cellcolor{blue!25}C& cellcolor{blue!25}B& C \hline
                    D & E & cellcolor{blue!25}K& cellcolor{blue!25}B& F \hline
                    G & H & I& B& C \hline
                    end{tabular}

                    end{document}


                    enter image description here






                    share|improve this answer












                    You can use cellcolor{..} to color single cells. You need the xcolor package or just the colortbl package, the former loads the latter. Note that some PDF viewers hide table lines behind the color.



                    documentclass{article}
                    usepackage{array}
                    usepackage[table]{xcolor}

                    begin{document}

                    begin{tabular}{|c|c|c|c|c|}
                    hline
                    1 & 3 & 2& B& C \hline
                    A & B& cellcolor{blue!25}C& cellcolor{blue!25}B& C \hline
                    D & E & cellcolor{blue!25}K& cellcolor{blue!25}B& F \hline
                    G & H & I& B& C \hline
                    end{tabular}

                    end{document}


                    enter image description here







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Dec 1 at 22:02









                    AboAmmar

                    32.2k22781




                    32.2k22781








                    • 1




                      I want please coloring only the border.
                      – user105476
                      Dec 1 at 22:07






                    • 2




                      @user105476, than you need to make your question more clear. please edit it and explain what you like to have. above answer gives exactly what you ask.
                      – Zarko
                      Dec 1 at 22:28














                    • 1




                      I want please coloring only the border.
                      – user105476
                      Dec 1 at 22:07






                    • 2




                      @user105476, than you need to make your question more clear. please edit it and explain what you like to have. above answer gives exactly what you ask.
                      – Zarko
                      Dec 1 at 22:28








                    1




                    1




                    I want please coloring only the border.
                    – user105476
                    Dec 1 at 22:07




                    I want please coloring only the border.
                    – user105476
                    Dec 1 at 22:07




                    2




                    2




                    @user105476, than you need to make your question more clear. please edit it and explain what you like to have. above answer gives exactly what you ask.
                    – Zarko
                    Dec 1 at 22:28




                    @user105476, than you need to make your question more clear. please edit it and explain what you like to have. above answer gives exactly what you ask.
                    – Zarko
                    Dec 1 at 22:28


















                    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.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • 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%2f462753%2fcoloring-a-sub-table%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

                    Ellipse (mathématiques)

                    Quarter-circle Tiles

                    Mont Emei