How to draw this rectangle using tikzpicture environment











up vote
1
down vote

favorite












I want to draw this kind of rectangle using tikzpicture environment:



Rectangle with a new line



a could change to b, c, d, etc.



We should also be able to insert a new line.



If MWE is needed please let me know.



Thanks!










share|improve this question




















  • 1




    I don't really understand what you're trying to do. Are you trying to draw several of these in a single tikzpicture? What does the 'optional' bit mean? Nodes are rectangular by default and they adjust to the width of the text by default, so the only even slight complication seems to be placing the label in the corner. You need to use another node for that. At least, that'd be simplest.
    – cfr
    Dec 7 at 1:20










  • @cfr sorry for the inaccuracies. I want to draw the rectangle of the image. By "optional" I mean that the straight line could be drawn or not. Yes, you are right that the text adjust to the width of it by default. The two things are the label and the line.
    – manooooh
    Dec 7 at 1:25

















up vote
1
down vote

favorite












I want to draw this kind of rectangle using tikzpicture environment:



Rectangle with a new line



a could change to b, c, d, etc.



We should also be able to insert a new line.



If MWE is needed please let me know.



Thanks!










share|improve this question




















  • 1




    I don't really understand what you're trying to do. Are you trying to draw several of these in a single tikzpicture? What does the 'optional' bit mean? Nodes are rectangular by default and they adjust to the width of the text by default, so the only even slight complication seems to be placing the label in the corner. You need to use another node for that. At least, that'd be simplest.
    – cfr
    Dec 7 at 1:20










  • @cfr sorry for the inaccuracies. I want to draw the rectangle of the image. By "optional" I mean that the straight line could be drawn or not. Yes, you are right that the text adjust to the width of it by default. The two things are the label and the line.
    – manooooh
    Dec 7 at 1:25















up vote
1
down vote

favorite









up vote
1
down vote

favorite











I want to draw this kind of rectangle using tikzpicture environment:



Rectangle with a new line



a could change to b, c, d, etc.



We should also be able to insert a new line.



If MWE is needed please let me know.



Thanks!










share|improve this question















I want to draw this kind of rectangle using tikzpicture environment:



Rectangle with a new line



a could change to b, c, d, etc.



We should also be able to insert a new line.



If MWE is needed please let me know.



Thanks!







tikz-pgf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 7 at 1:23

























asked Dec 7 at 1:15









manooooh

8801315




8801315








  • 1




    I don't really understand what you're trying to do. Are you trying to draw several of these in a single tikzpicture? What does the 'optional' bit mean? Nodes are rectangular by default and they adjust to the width of the text by default, so the only even slight complication seems to be placing the label in the corner. You need to use another node for that. At least, that'd be simplest.
    – cfr
    Dec 7 at 1:20










  • @cfr sorry for the inaccuracies. I want to draw the rectangle of the image. By "optional" I mean that the straight line could be drawn or not. Yes, you are right that the text adjust to the width of it by default. The two things are the label and the line.
    – manooooh
    Dec 7 at 1:25
















  • 1




    I don't really understand what you're trying to do. Are you trying to draw several of these in a single tikzpicture? What does the 'optional' bit mean? Nodes are rectangular by default and they adjust to the width of the text by default, so the only even slight complication seems to be placing the label in the corner. You need to use another node for that. At least, that'd be simplest.
    – cfr
    Dec 7 at 1:20










  • @cfr sorry for the inaccuracies. I want to draw the rectangle of the image. By "optional" I mean that the straight line could be drawn or not. Yes, you are right that the text adjust to the width of it by default. The two things are the label and the line.
    – manooooh
    Dec 7 at 1:25










1




1




I don't really understand what you're trying to do. Are you trying to draw several of these in a single tikzpicture? What does the 'optional' bit mean? Nodes are rectangular by default and they adjust to the width of the text by default, so the only even slight complication seems to be placing the label in the corner. You need to use another node for that. At least, that'd be simplest.
– cfr
Dec 7 at 1:20




I don't really understand what you're trying to do. Are you trying to draw several of these in a single tikzpicture? What does the 'optional' bit mean? Nodes are rectangular by default and they adjust to the width of the text by default, so the only even slight complication seems to be placing the label in the corner. You need to use another node for that. At least, that'd be simplest.
– cfr
Dec 7 at 1:20












@cfr sorry for the inaccuracies. I want to draw the rectangle of the image. By "optional" I mean that the straight line could be drawn or not. Yes, you are right that the text adjust to the width of it by default. The two things are the label and the line.
– manooooh
Dec 7 at 1:25






@cfr sorry for the inaccuracies. I want to draw the rectangle of the image. By "optional" I mean that the straight line could be drawn or not. Yes, you are right that the text adjust to the width of it by default. The two things are the label and the line.
– manooooh
Dec 7 at 1:25












1 Answer
1






active

oldest

votes

















up vote
2
down vote



accepted










There are already folder symbols on the market that do something like this, e.g. here. That is, if you want to define a new shape, there are answers that give you good start. However, if you want to do it the quick and dirty way, you could do



documentclass[tikz,border=3.14mm]{standalone}
begin{document}
begin{tikzpicture}[fluffy with corner/.style={draw,inner ysep=3mm,inner
xsep=3mm,align=center,
path picture={
draw ([xshift=3mm]path picture bounding box.north west)
-- ([yshift=-3mm]path picture bounding box.north west);
node[anchor=north east,inner sep=2pt] at (path picture bounding box.north east)
{#1};}},fluffy/.style={draw,inner ysep=3mm,inner xsep=3mm,align=center,
path picture={
node[anchor=north east,inner sep=2pt] at (path picture bounding box.north east) {#1};}}]
node[fluffy=b] at (0,0){text here};
node[fluffy with corner=a] at (4,0){text here\ second line\ third line};
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',
    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%2f463612%2fhow-to-draw-this-rectangle-using-tikzpicture-environment%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote



    accepted










    There are already folder symbols on the market that do something like this, e.g. here. That is, if you want to define a new shape, there are answers that give you good start. However, if you want to do it the quick and dirty way, you could do



    documentclass[tikz,border=3.14mm]{standalone}
    begin{document}
    begin{tikzpicture}[fluffy with corner/.style={draw,inner ysep=3mm,inner
    xsep=3mm,align=center,
    path picture={
    draw ([xshift=3mm]path picture bounding box.north west)
    -- ([yshift=-3mm]path picture bounding box.north west);
    node[anchor=north east,inner sep=2pt] at (path picture bounding box.north east)
    {#1};}},fluffy/.style={draw,inner ysep=3mm,inner xsep=3mm,align=center,
    path picture={
    node[anchor=north east,inner sep=2pt] at (path picture bounding box.north east) {#1};}}]
    node[fluffy=b] at (0,0){text here};
    node[fluffy with corner=a] at (4,0){text here\ second line\ third line};
    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer



























      up vote
      2
      down vote



      accepted










      There are already folder symbols on the market that do something like this, e.g. here. That is, if you want to define a new shape, there are answers that give you good start. However, if you want to do it the quick and dirty way, you could do



      documentclass[tikz,border=3.14mm]{standalone}
      begin{document}
      begin{tikzpicture}[fluffy with corner/.style={draw,inner ysep=3mm,inner
      xsep=3mm,align=center,
      path picture={
      draw ([xshift=3mm]path picture bounding box.north west)
      -- ([yshift=-3mm]path picture bounding box.north west);
      node[anchor=north east,inner sep=2pt] at (path picture bounding box.north east)
      {#1};}},fluffy/.style={draw,inner ysep=3mm,inner xsep=3mm,align=center,
      path picture={
      node[anchor=north east,inner sep=2pt] at (path picture bounding box.north east) {#1};}}]
      node[fluffy=b] at (0,0){text here};
      node[fluffy with corner=a] at (4,0){text here\ second line\ third line};
      end{tikzpicture}
      end{document}


      enter image description here






      share|improve this answer

























        up vote
        2
        down vote



        accepted







        up vote
        2
        down vote



        accepted






        There are already folder symbols on the market that do something like this, e.g. here. That is, if you want to define a new shape, there are answers that give you good start. However, if you want to do it the quick and dirty way, you could do



        documentclass[tikz,border=3.14mm]{standalone}
        begin{document}
        begin{tikzpicture}[fluffy with corner/.style={draw,inner ysep=3mm,inner
        xsep=3mm,align=center,
        path picture={
        draw ([xshift=3mm]path picture bounding box.north west)
        -- ([yshift=-3mm]path picture bounding box.north west);
        node[anchor=north east,inner sep=2pt] at (path picture bounding box.north east)
        {#1};}},fluffy/.style={draw,inner ysep=3mm,inner xsep=3mm,align=center,
        path picture={
        node[anchor=north east,inner sep=2pt] at (path picture bounding box.north east) {#1};}}]
        node[fluffy=b] at (0,0){text here};
        node[fluffy with corner=a] at (4,0){text here\ second line\ third line};
        end{tikzpicture}
        end{document}


        enter image description here






        share|improve this answer














        There are already folder symbols on the market that do something like this, e.g. here. That is, if you want to define a new shape, there are answers that give you good start. However, if you want to do it the quick and dirty way, you could do



        documentclass[tikz,border=3.14mm]{standalone}
        begin{document}
        begin{tikzpicture}[fluffy with corner/.style={draw,inner ysep=3mm,inner
        xsep=3mm,align=center,
        path picture={
        draw ([xshift=3mm]path picture bounding box.north west)
        -- ([yshift=-3mm]path picture bounding box.north west);
        node[anchor=north east,inner sep=2pt] at (path picture bounding box.north east)
        {#1};}},fluffy/.style={draw,inner ysep=3mm,inner xsep=3mm,align=center,
        path picture={
        node[anchor=north east,inner sep=2pt] at (path picture bounding box.north east) {#1};}}]
        node[fluffy=b] at (0,0){text here};
        node[fluffy with corner=a] at (4,0){text here\ second line\ third line};
        end{tikzpicture}
        end{document}


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 7 at 1:48

























        answered Dec 7 at 1:29









        marmot

        83.1k493178




        83.1k493178






























            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%2f463612%2fhow-to-draw-this-rectangle-using-tikzpicture-environment%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

            Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

            ComboBox Display Member on multiple fields

            Is it possible to collect Nectar points via Trainline?