tikz grid without top edge












4















In this code from TikZ (finite) grid with character in each cell



documentclass{article}
usepackage{tikz}
usetikzlibrary{matrix}

begin{document}
begin{tikzpicture}
draw[step=0.5cm,color=gray] (-1,-1) grid (1,1);
matrix[matrix of nodes,nodes={inner sep=0pt,text width=.5cm,align=center,minimum height=.5cm}]{
A & B & C & D \
E & F & & H \
I & J & K & L \
M & N & O & P\};
end{tikzpicture}
end{document}


I would like to delete the top and left edges of the grid.



I have found solutions using nodes but much prefer this one with a matrix.










share|improve this question























  • Off topic: You have a very nice reputation number :)

    – JouleV
    yesterday











  • @JouleV Indeed, It won't survive any votes on this question.

    – Ethan Bolker
    yesterday
















4















In this code from TikZ (finite) grid with character in each cell



documentclass{article}
usepackage{tikz}
usetikzlibrary{matrix}

begin{document}
begin{tikzpicture}
draw[step=0.5cm,color=gray] (-1,-1) grid (1,1);
matrix[matrix of nodes,nodes={inner sep=0pt,text width=.5cm,align=center,minimum height=.5cm}]{
A & B & C & D \
E & F & & H \
I & J & K & L \
M & N & O & P\};
end{tikzpicture}
end{document}


I would like to delete the top and left edges of the grid.



I have found solutions using nodes but much prefer this one with a matrix.










share|improve this question























  • Off topic: You have a very nice reputation number :)

    – JouleV
    yesterday











  • @JouleV Indeed, It won't survive any votes on this question.

    – Ethan Bolker
    yesterday














4












4








4








In this code from TikZ (finite) grid with character in each cell



documentclass{article}
usepackage{tikz}
usetikzlibrary{matrix}

begin{document}
begin{tikzpicture}
draw[step=0.5cm,color=gray] (-1,-1) grid (1,1);
matrix[matrix of nodes,nodes={inner sep=0pt,text width=.5cm,align=center,minimum height=.5cm}]{
A & B & C & D \
E & F & & H \
I & J & K & L \
M & N & O & P\};
end{tikzpicture}
end{document}


I would like to delete the top and left edges of the grid.



I have found solutions using nodes but much prefer this one with a matrix.










share|improve this question














In this code from TikZ (finite) grid with character in each cell



documentclass{article}
usepackage{tikz}
usetikzlibrary{matrix}

begin{document}
begin{tikzpicture}
draw[step=0.5cm,color=gray] (-1,-1) grid (1,1);
matrix[matrix of nodes,nodes={inner sep=0pt,text width=.5cm,align=center,minimum height=.5cm}]{
A & B & C & D \
E & F & & H \
I & J & K & L \
M & N & O & P\};
end{tikzpicture}
end{document}


I would like to delete the top and left edges of the grid.



I have found solutions using nodes but much prefer this one with a matrix.







tikz-pgf






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked yesterday









Ethan BolkerEthan Bolker

6,68832453




6,68832453













  • Off topic: You have a very nice reputation number :)

    – JouleV
    yesterday











  • @JouleV Indeed, It won't survive any votes on this question.

    – Ethan Bolker
    yesterday



















  • Off topic: You have a very nice reputation number :)

    – JouleV
    yesterday











  • @JouleV Indeed, It won't survive any votes on this question.

    – Ethan Bolker
    yesterday

















Off topic: You have a very nice reputation number :)

– JouleV
yesterday





Off topic: You have a very nice reputation number :)

– JouleV
yesterday













@JouleV Indeed, It won't survive any votes on this question.

– Ethan Bolker
yesterday





@JouleV Indeed, It won't survive any votes on this question.

– Ethan Bolker
yesterday










2 Answers
2






active

oldest

votes


















4














We can use foreach:



documentclass[tikz]{standalone}
usetikzlibrary{matrix}

begin{document}
begin{tikzpicture}
%draw[step=0.5cm,color=gray] (-1,-1) grid (1,1);
foreach i in {-0.5,0,0.5,1} {
draw[gray] (-1,-i)--(1,-i);
draw[gray] (i,-1)--(i,1);
}
matrix[matrix of nodes,nodes={inner sep=0pt,text width=.5cm,align=center,minimum height=.5cm}]{
A & B & C & D \
E & F & & H \
I & J & K & L \
M & N & O & P\};
end{tikzpicture}
end{document}


enter image description here



Honestly I don't think nodes or matrices have any thing to do here.





This approach is based on marmot's creative way, which is nicer and more tricky:



documentclass[tikz]{standalone}
usetikzlibrary{matrix}

begin{document}
begin{tikzpicture}
draw[step=0.5cm,color=gray] ({-1cm+0.2pt},-1) grid (1cm,{1cm-0.2pt});
matrix[matrix of nodes,nodes={inner sep=0pt,text width=.5cm,align=center,minimum height=.5cm}]{
A & B & C & D \
E & F & & H \
I & J & K & L \
M & N & O & P\};
end{tikzpicture}
end{document}


enter image description here






share|improve this answer





















  • 1





    Thanks. There is a "matrix" in the code. Other answers to my original question used nodes.

    – Ethan Bolker
    yesterday











  • @EthanBolker No problem. You are welcome ;)

    – JouleV
    yesterday











  • Maybe mention also draw[step=0.5cm,color=gray] (-0.99,-1) grid (1,0.99); which is shorter and gives (for all practical purposes) the same output.

    – marmot
    yesterday











  • @marmot Ohh your way is wonderfully creative :)) I did not even think of that. However they are not mathematically correct.

    – JouleV
    yesterday











  • @JouleV What do you mean by "not mathematically correct"? It is as correct as a truncated grid can be.

    – marmot
    yesterday



















3














Another solution. It draws the grid with a matrix of drawn nodes. After that, left and top border are deleted with a white supperposed line.



documentclass[tikz,border=2mm]{standalone}
usetikzlibrary{matrix}

begin{document}
begin{tikzpicture}
matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-pgflinewidth, row sep=-pgflinewidth] (A) {
A & B & C & D \
E & F & & H \
I & J & K & L \
M & N & O & P\};
draw[white] ([xshift=.5pgflinewidth]A-4-1.south west)|-([yshift=-.5pgflinewidth]A-1-4.north east);
end{tikzpicture}
end{document}


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',
    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%2f481347%2ftikz-grid-without-top-edge%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    We can use foreach:



    documentclass[tikz]{standalone}
    usetikzlibrary{matrix}

    begin{document}
    begin{tikzpicture}
    %draw[step=0.5cm,color=gray] (-1,-1) grid (1,1);
    foreach i in {-0.5,0,0.5,1} {
    draw[gray] (-1,-i)--(1,-i);
    draw[gray] (i,-1)--(i,1);
    }
    matrix[matrix of nodes,nodes={inner sep=0pt,text width=.5cm,align=center,minimum height=.5cm}]{
    A & B & C & D \
    E & F & & H \
    I & J & K & L \
    M & N & O & P\};
    end{tikzpicture}
    end{document}


    enter image description here



    Honestly I don't think nodes or matrices have any thing to do here.





    This approach is based on marmot's creative way, which is nicer and more tricky:



    documentclass[tikz]{standalone}
    usetikzlibrary{matrix}

    begin{document}
    begin{tikzpicture}
    draw[step=0.5cm,color=gray] ({-1cm+0.2pt},-1) grid (1cm,{1cm-0.2pt});
    matrix[matrix of nodes,nodes={inner sep=0pt,text width=.5cm,align=center,minimum height=.5cm}]{
    A & B & C & D \
    E & F & & H \
    I & J & K & L \
    M & N & O & P\};
    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer





















    • 1





      Thanks. There is a "matrix" in the code. Other answers to my original question used nodes.

      – Ethan Bolker
      yesterday











    • @EthanBolker No problem. You are welcome ;)

      – JouleV
      yesterday











    • Maybe mention also draw[step=0.5cm,color=gray] (-0.99,-1) grid (1,0.99); which is shorter and gives (for all practical purposes) the same output.

      – marmot
      yesterday











    • @marmot Ohh your way is wonderfully creative :)) I did not even think of that. However they are not mathematically correct.

      – JouleV
      yesterday











    • @JouleV What do you mean by "not mathematically correct"? It is as correct as a truncated grid can be.

      – marmot
      yesterday
















    4














    We can use foreach:



    documentclass[tikz]{standalone}
    usetikzlibrary{matrix}

    begin{document}
    begin{tikzpicture}
    %draw[step=0.5cm,color=gray] (-1,-1) grid (1,1);
    foreach i in {-0.5,0,0.5,1} {
    draw[gray] (-1,-i)--(1,-i);
    draw[gray] (i,-1)--(i,1);
    }
    matrix[matrix of nodes,nodes={inner sep=0pt,text width=.5cm,align=center,minimum height=.5cm}]{
    A & B & C & D \
    E & F & & H \
    I & J & K & L \
    M & N & O & P\};
    end{tikzpicture}
    end{document}


    enter image description here



    Honestly I don't think nodes or matrices have any thing to do here.





    This approach is based on marmot's creative way, which is nicer and more tricky:



    documentclass[tikz]{standalone}
    usetikzlibrary{matrix}

    begin{document}
    begin{tikzpicture}
    draw[step=0.5cm,color=gray] ({-1cm+0.2pt},-1) grid (1cm,{1cm-0.2pt});
    matrix[matrix of nodes,nodes={inner sep=0pt,text width=.5cm,align=center,minimum height=.5cm}]{
    A & B & C & D \
    E & F & & H \
    I & J & K & L \
    M & N & O & P\};
    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer





















    • 1





      Thanks. There is a "matrix" in the code. Other answers to my original question used nodes.

      – Ethan Bolker
      yesterday











    • @EthanBolker No problem. You are welcome ;)

      – JouleV
      yesterday











    • Maybe mention also draw[step=0.5cm,color=gray] (-0.99,-1) grid (1,0.99); which is shorter and gives (for all practical purposes) the same output.

      – marmot
      yesterday











    • @marmot Ohh your way is wonderfully creative :)) I did not even think of that. However they are not mathematically correct.

      – JouleV
      yesterday











    • @JouleV What do you mean by "not mathematically correct"? It is as correct as a truncated grid can be.

      – marmot
      yesterday














    4












    4








    4







    We can use foreach:



    documentclass[tikz]{standalone}
    usetikzlibrary{matrix}

    begin{document}
    begin{tikzpicture}
    %draw[step=0.5cm,color=gray] (-1,-1) grid (1,1);
    foreach i in {-0.5,0,0.5,1} {
    draw[gray] (-1,-i)--(1,-i);
    draw[gray] (i,-1)--(i,1);
    }
    matrix[matrix of nodes,nodes={inner sep=0pt,text width=.5cm,align=center,minimum height=.5cm}]{
    A & B & C & D \
    E & F & & H \
    I & J & K & L \
    M & N & O & P\};
    end{tikzpicture}
    end{document}


    enter image description here



    Honestly I don't think nodes or matrices have any thing to do here.





    This approach is based on marmot's creative way, which is nicer and more tricky:



    documentclass[tikz]{standalone}
    usetikzlibrary{matrix}

    begin{document}
    begin{tikzpicture}
    draw[step=0.5cm,color=gray] ({-1cm+0.2pt},-1) grid (1cm,{1cm-0.2pt});
    matrix[matrix of nodes,nodes={inner sep=0pt,text width=.5cm,align=center,minimum height=.5cm}]{
    A & B & C & D \
    E & F & & H \
    I & J & K & L \
    M & N & O & P\};
    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer















    We can use foreach:



    documentclass[tikz]{standalone}
    usetikzlibrary{matrix}

    begin{document}
    begin{tikzpicture}
    %draw[step=0.5cm,color=gray] (-1,-1) grid (1,1);
    foreach i in {-0.5,0,0.5,1} {
    draw[gray] (-1,-i)--(1,-i);
    draw[gray] (i,-1)--(i,1);
    }
    matrix[matrix of nodes,nodes={inner sep=0pt,text width=.5cm,align=center,minimum height=.5cm}]{
    A & B & C & D \
    E & F & & H \
    I & J & K & L \
    M & N & O & P\};
    end{tikzpicture}
    end{document}


    enter image description here



    Honestly I don't think nodes or matrices have any thing to do here.





    This approach is based on marmot's creative way, which is nicer and more tricky:



    documentclass[tikz]{standalone}
    usetikzlibrary{matrix}

    begin{document}
    begin{tikzpicture}
    draw[step=0.5cm,color=gray] ({-1cm+0.2pt},-1) grid (1cm,{1cm-0.2pt});
    matrix[matrix of nodes,nodes={inner sep=0pt,text width=.5cm,align=center,minimum height=.5cm}]{
    A & B & C & D \
    E & F & & H \
    I & J & K & L \
    M & N & O & P\};
    end{tikzpicture}
    end{document}


    enter image description here







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited yesterday

























    answered yesterday









    JouleVJouleV

    8,15222153




    8,15222153








    • 1





      Thanks. There is a "matrix" in the code. Other answers to my original question used nodes.

      – Ethan Bolker
      yesterday











    • @EthanBolker No problem. You are welcome ;)

      – JouleV
      yesterday











    • Maybe mention also draw[step=0.5cm,color=gray] (-0.99,-1) grid (1,0.99); which is shorter and gives (for all practical purposes) the same output.

      – marmot
      yesterday











    • @marmot Ohh your way is wonderfully creative :)) I did not even think of that. However they are not mathematically correct.

      – JouleV
      yesterday











    • @JouleV What do you mean by "not mathematically correct"? It is as correct as a truncated grid can be.

      – marmot
      yesterday














    • 1





      Thanks. There is a "matrix" in the code. Other answers to my original question used nodes.

      – Ethan Bolker
      yesterday











    • @EthanBolker No problem. You are welcome ;)

      – JouleV
      yesterday











    • Maybe mention also draw[step=0.5cm,color=gray] (-0.99,-1) grid (1,0.99); which is shorter and gives (for all practical purposes) the same output.

      – marmot
      yesterday











    • @marmot Ohh your way is wonderfully creative :)) I did not even think of that. However they are not mathematically correct.

      – JouleV
      yesterday











    • @JouleV What do you mean by "not mathematically correct"? It is as correct as a truncated grid can be.

      – marmot
      yesterday








    1




    1





    Thanks. There is a "matrix" in the code. Other answers to my original question used nodes.

    – Ethan Bolker
    yesterday





    Thanks. There is a "matrix" in the code. Other answers to my original question used nodes.

    – Ethan Bolker
    yesterday













    @EthanBolker No problem. You are welcome ;)

    – JouleV
    yesterday





    @EthanBolker No problem. You are welcome ;)

    – JouleV
    yesterday













    Maybe mention also draw[step=0.5cm,color=gray] (-0.99,-1) grid (1,0.99); which is shorter and gives (for all practical purposes) the same output.

    – marmot
    yesterday





    Maybe mention also draw[step=0.5cm,color=gray] (-0.99,-1) grid (1,0.99); which is shorter and gives (for all practical purposes) the same output.

    – marmot
    yesterday













    @marmot Ohh your way is wonderfully creative :)) I did not even think of that. However they are not mathematically correct.

    – JouleV
    yesterday





    @marmot Ohh your way is wonderfully creative :)) I did not even think of that. However they are not mathematically correct.

    – JouleV
    yesterday













    @JouleV What do you mean by "not mathematically correct"? It is as correct as a truncated grid can be.

    – marmot
    yesterday





    @JouleV What do you mean by "not mathematically correct"? It is as correct as a truncated grid can be.

    – marmot
    yesterday











    3














    Another solution. It draws the grid with a matrix of drawn nodes. After that, left and top border are deleted with a white supperposed line.



    documentclass[tikz,border=2mm]{standalone}
    usetikzlibrary{matrix}

    begin{document}
    begin{tikzpicture}
    matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-pgflinewidth, row sep=-pgflinewidth] (A) {
    A & B & C & D \
    E & F & & H \
    I & J & K & L \
    M & N & O & P\};
    draw[white] ([xshift=.5pgflinewidth]A-4-1.south west)|-([yshift=-.5pgflinewidth]A-1-4.north east);
    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer




























      3














      Another solution. It draws the grid with a matrix of drawn nodes. After that, left and top border are deleted with a white supperposed line.



      documentclass[tikz,border=2mm]{standalone}
      usetikzlibrary{matrix}

      begin{document}
      begin{tikzpicture}
      matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-pgflinewidth, row sep=-pgflinewidth] (A) {
      A & B & C & D \
      E & F & & H \
      I & J & K & L \
      M & N & O & P\};
      draw[white] ([xshift=.5pgflinewidth]A-4-1.south west)|-([yshift=-.5pgflinewidth]A-1-4.north east);
      end{tikzpicture}
      end{document}


      enter image description here






      share|improve this answer


























        3












        3








        3







        Another solution. It draws the grid with a matrix of drawn nodes. After that, left and top border are deleted with a white supperposed line.



        documentclass[tikz,border=2mm]{standalone}
        usetikzlibrary{matrix}

        begin{document}
        begin{tikzpicture}
        matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-pgflinewidth, row sep=-pgflinewidth] (A) {
        A & B & C & D \
        E & F & & H \
        I & J & K & L \
        M & N & O & P\};
        draw[white] ([xshift=.5pgflinewidth]A-4-1.south west)|-([yshift=-.5pgflinewidth]A-1-4.north east);
        end{tikzpicture}
        end{document}


        enter image description here






        share|improve this answer













        Another solution. It draws the grid with a matrix of drawn nodes. After that, left and top border are deleted with a white supperposed line.



        documentclass[tikz,border=2mm]{standalone}
        usetikzlibrary{matrix}

        begin{document}
        begin{tikzpicture}
        matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-pgflinewidth, row sep=-pgflinewidth] (A) {
        A & B & C & D \
        E & F & & H \
        I & J & K & L \
        M & N & O & P\};
        draw[white] ([xshift=.5pgflinewidth]A-4-1.south west)|-([yshift=-.5pgflinewidth]A-1-4.north east);
        end{tikzpicture}
        end{document}


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        IgnasiIgnasi

        95.3k4175319




        95.3k4175319






























            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%2f481347%2ftikz-grid-without-top-edge%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

            Færeyskur hestur Heimild | Tengill | Tilvísanir | LeiðsagnarvalRossið - síða um færeyska hrossið á færeyskuGott ár hjá færeyska hestinum

            He _____ here since 1970 . Answer needed [closed]What does “since he was so high” mean?Meaning of “catch birds for”?How do I ensure “since” takes the meaning I want?“Who cares here” meaningWhat does “right round toward” mean?the time tense (had now been detected)What does the phrase “ring around the roses” mean here?Correct usage of “visited upon”Meaning of “foiled rail sabotage bid”It was the third time I had gone to Rome or It is the third time I had been to Rome

            Bunad