Omit the same coordinate parameters in drawing line in tikz The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Difference between -| and |- in TikZTiKz dash dash plus plusCompute asin from y-value of a coordinate or: Angle between two lines in tikz3d-plane and rotating coordinate system in TiKZHow not to draw the first/last markerAnnotate grouped bar plotTikz and Beamer: How to fix coordinate system to be the same on each slide?Help understanding the coordinate system used in tikzDrawing an array of nodes using the foreach-constructPosition a tikz-draw that uses scope inside an axis environment using the coordinate system axis cstikz two magnets and magnetic fieldSpecifying line length in TikZ

Drawing vertical/oblique lines in Metrical tree (tikz-qtree, tipa)

Do warforged have souls?

Single author papers against my advisor's will?

When did F become S? Why?

The following signatures were invalid: EXPKEYSIG 1397BC53640DB551

Using dividends to reduce short term capital gains?

Is this wall load bearing? Blueprints and photos attached

One-dimensional Japanese puzzle

What happens to a Warlock's expended Spell Slots when they gain a Level?

How to make Illustrator type tool selection automatically adapt with text length

For what reasons would an animal species NOT cross a *horizontal* land bridge?

Sub-subscripts in strings cause different spacings than subscripts

Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?

What is the padding with red substance inside of steak packaging?

Keeping a retro style to sci-fi spaceships?

How do I design a circuit to convert a 100 mV and 50 Hz sine wave to a square wave?

Word to describe a time interval

Windows 10: How to Lock (not sleep) laptop on lid close?

Didn't get enough time to take a Coding Test - what to do now?

Identify 80s or 90s comics with ripped creatures (not dwarves)

Why did Peik Lin say, "I'm not an animal"?

should truth entail possible truth

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?

What to do when moving next to a bird sanctuary with a loosely-domesticated cat?



Omit the same coordinate parameters in drawing line in tikz



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Difference between -| and |- in TikZTiKz dash dash plus plusCompute asin from y-value of a coordinate or: Angle between two lines in tikz3d-plane and rotating coordinate system in TiKZHow not to draw the first/last markerAnnotate grouped bar plotTikz and Beamer: How to fix coordinate system to be the same on each slide?Help understanding the coordinate system used in tikzDrawing an array of nodes using the foreach-constructPosition a tikz-draw that uses scope inside an axis environment using the coordinate system axis cstikz two magnets and magnetic fieldSpecifying line length in TikZ










4















When I draw lines using TikZ, I always need to specify coordinates. For example



draw (1,0) -- (0,0) -- (0,1);


It is getting tedious when you have a lots of draws.



My question: "Is there a way to simplify the coordinate parameters?"



For example, if the coordinate parameter (on x or y axis) are the same, we can just omit it. More specifically,



draw (1,0) -- (0,0) -- (0,1);


can be written as



draw (1,0) -- (0,-) -- (-,1);


(I use - to show the parameter in this position is the same as the one before)










share|improve this question



















  • 2





    I would use -| and |- for that purpose, instead of --. For example, in this case, I would use draw (1,0) -| (0,1);.

    – JouleV
    yesterday












  • What about more than 3 coordinates

    – wayne
    yesterday






  • 1





    Give me an example, and I will do it for you. A combination of --, -|, and |- will solve it all.

    – JouleV
    yesterday











  • Yes, it is true you can use combinations of these to draw almost any line. In this case, my question seems trivial.

    – wayne
    yesterday















4















When I draw lines using TikZ, I always need to specify coordinates. For example



draw (1,0) -- (0,0) -- (0,1);


It is getting tedious when you have a lots of draws.



My question: "Is there a way to simplify the coordinate parameters?"



For example, if the coordinate parameter (on x or y axis) are the same, we can just omit it. More specifically,



draw (1,0) -- (0,0) -- (0,1);


can be written as



draw (1,0) -- (0,-) -- (-,1);


(I use - to show the parameter in this position is the same as the one before)










share|improve this question



















  • 2





    I would use -| and |- for that purpose, instead of --. For example, in this case, I would use draw (1,0) -| (0,1);.

    – JouleV
    yesterday












  • What about more than 3 coordinates

    – wayne
    yesterday






  • 1





    Give me an example, and I will do it for you. A combination of --, -|, and |- will solve it all.

    – JouleV
    yesterday











  • Yes, it is true you can use combinations of these to draw almost any line. In this case, my question seems trivial.

    – wayne
    yesterday













4












4








4








When I draw lines using TikZ, I always need to specify coordinates. For example



draw (1,0) -- (0,0) -- (0,1);


It is getting tedious when you have a lots of draws.



My question: "Is there a way to simplify the coordinate parameters?"



For example, if the coordinate parameter (on x or y axis) are the same, we can just omit it. More specifically,



draw (1,0) -- (0,0) -- (0,1);


can be written as



draw (1,0) -- (0,-) -- (-,1);


(I use - to show the parameter in this position is the same as the one before)










share|improve this question
















When I draw lines using TikZ, I always need to specify coordinates. For example



draw (1,0) -- (0,0) -- (0,1);


It is getting tedious when you have a lots of draws.



My question: "Is there a way to simplify the coordinate parameters?"



For example, if the coordinate parameter (on x or y axis) are the same, we can just omit it. More specifically,



draw (1,0) -- (0,0) -- (0,1);


can be written as



draw (1,0) -- (0,-) -- (-,1);


(I use - to show the parameter in this position is the same as the one before)







tikz-pgf draw






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday









JouleV

12.8k22663




12.8k22663










asked yesterday









waynewayne

710922




710922







  • 2





    I would use -| and |- for that purpose, instead of --. For example, in this case, I would use draw (1,0) -| (0,1);.

    – JouleV
    yesterday












  • What about more than 3 coordinates

    – wayne
    yesterday






  • 1





    Give me an example, and I will do it for you. A combination of --, -|, and |- will solve it all.

    – JouleV
    yesterday











  • Yes, it is true you can use combinations of these to draw almost any line. In this case, my question seems trivial.

    – wayne
    yesterday












  • 2





    I would use -| and |- for that purpose, instead of --. For example, in this case, I would use draw (1,0) -| (0,1);.

    – JouleV
    yesterday












  • What about more than 3 coordinates

    – wayne
    yesterday






  • 1





    Give me an example, and I will do it for you. A combination of --, -|, and |- will solve it all.

    – JouleV
    yesterday











  • Yes, it is true you can use combinations of these to draw almost any line. In this case, my question seems trivial.

    – wayne
    yesterday







2




2





I would use -| and |- for that purpose, instead of --. For example, in this case, I would use draw (1,0) -| (0,1);.

– JouleV
yesterday






I would use -| and |- for that purpose, instead of --. For example, in this case, I would use draw (1,0) -| (0,1);.

– JouleV
yesterday














What about more than 3 coordinates

– wayne
yesterday





What about more than 3 coordinates

– wayne
yesterday




1




1





Give me an example, and I will do it for you. A combination of --, -|, and |- will solve it all.

– JouleV
yesterday





Give me an example, and I will do it for you. A combination of --, -|, and |- will solve it all.

– JouleV
yesterday













Yes, it is true you can use combinations of these to draw almost any line. In this case, my question seems trivial.

– wayne
yesterday





Yes, it is true you can use combinations of these to draw almost any line. In this case, my question seems trivial.

– wayne
yesterday










1 Answer
1






active

oldest

votes


















7














I agree with you that you should not have a command in which the x coordinate (or y coordinate) is useless in the relative positioning of the points.



However, it is not that easy to have such a command you requested. Nevertheless, TikZ already gives you a more brillant solution: -| and |-, which can handle named coordinates like (a), (b), etc. (and you will know that named coordinates are much prefered when drawing figures).



Some example:



draw (x1,y1) -- (x1,y2) -- (x2,y2);


can be changed to



draw (x1,y1) -| (x2,y2);


Or with five coordinates:



draw (x1,y1) -- (x1,y2) -- (x2,y2) -- (x2,y3) -- (x3,y3) -- (x3,y4);


can be changed to



draw (x1,y1) |- (x2,y2) -| (x3,y3) -- (x3,y4);


As I said, a combination of --, -| and |- can do anything related to this. At worst there can be a couple of replicated x (or y) coordinates, but that is not a great deal, especially when you mostly have to deal with named coordinates in the future.



Furthermore, you can specify relative coordinates by prepending + or ++ to the coordinates. Your example would be translated to



draw (x1,y1) -- ++(0, dy1) -- ++(dx1, 0);


A single + leaves the reference point in place, while a ++ moves the reference point to the current location. This makes it very easy to move parts of a sketch around. You only have to edit the first coordinate.






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%2f484260%2fomit-the-same-coordinate-parameters-in-drawing-line-in-tikz%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









    7














    I agree with you that you should not have a command in which the x coordinate (or y coordinate) is useless in the relative positioning of the points.



    However, it is not that easy to have such a command you requested. Nevertheless, TikZ already gives you a more brillant solution: -| and |-, which can handle named coordinates like (a), (b), etc. (and you will know that named coordinates are much prefered when drawing figures).



    Some example:



    draw (x1,y1) -- (x1,y2) -- (x2,y2);


    can be changed to



    draw (x1,y1) -| (x2,y2);


    Or with five coordinates:



    draw (x1,y1) -- (x1,y2) -- (x2,y2) -- (x2,y3) -- (x3,y3) -- (x3,y4);


    can be changed to



    draw (x1,y1) |- (x2,y2) -| (x3,y3) -- (x3,y4);


    As I said, a combination of --, -| and |- can do anything related to this. At worst there can be a couple of replicated x (or y) coordinates, but that is not a great deal, especially when you mostly have to deal with named coordinates in the future.



    Furthermore, you can specify relative coordinates by prepending + or ++ to the coordinates. Your example would be translated to



    draw (x1,y1) -- ++(0, dy1) -- ++(dx1, 0);


    A single + leaves the reference point in place, while a ++ moves the reference point to the current location. This makes it very easy to move parts of a sketch around. You only have to edit the first coordinate.






    share|improve this answer





























      7














      I agree with you that you should not have a command in which the x coordinate (or y coordinate) is useless in the relative positioning of the points.



      However, it is not that easy to have such a command you requested. Nevertheless, TikZ already gives you a more brillant solution: -| and |-, which can handle named coordinates like (a), (b), etc. (and you will know that named coordinates are much prefered when drawing figures).



      Some example:



      draw (x1,y1) -- (x1,y2) -- (x2,y2);


      can be changed to



      draw (x1,y1) -| (x2,y2);


      Or with five coordinates:



      draw (x1,y1) -- (x1,y2) -- (x2,y2) -- (x2,y3) -- (x3,y3) -- (x3,y4);


      can be changed to



      draw (x1,y1) |- (x2,y2) -| (x3,y3) -- (x3,y4);


      As I said, a combination of --, -| and |- can do anything related to this. At worst there can be a couple of replicated x (or y) coordinates, but that is not a great deal, especially when you mostly have to deal with named coordinates in the future.



      Furthermore, you can specify relative coordinates by prepending + or ++ to the coordinates. Your example would be translated to



      draw (x1,y1) -- ++(0, dy1) -- ++(dx1, 0);


      A single + leaves the reference point in place, while a ++ moves the reference point to the current location. This makes it very easy to move parts of a sketch around. You only have to edit the first coordinate.






      share|improve this answer



























        7












        7








        7







        I agree with you that you should not have a command in which the x coordinate (or y coordinate) is useless in the relative positioning of the points.



        However, it is not that easy to have such a command you requested. Nevertheless, TikZ already gives you a more brillant solution: -| and |-, which can handle named coordinates like (a), (b), etc. (and you will know that named coordinates are much prefered when drawing figures).



        Some example:



        draw (x1,y1) -- (x1,y2) -- (x2,y2);


        can be changed to



        draw (x1,y1) -| (x2,y2);


        Or with five coordinates:



        draw (x1,y1) -- (x1,y2) -- (x2,y2) -- (x2,y3) -- (x3,y3) -- (x3,y4);


        can be changed to



        draw (x1,y1) |- (x2,y2) -| (x3,y3) -- (x3,y4);


        As I said, a combination of --, -| and |- can do anything related to this. At worst there can be a couple of replicated x (or y) coordinates, but that is not a great deal, especially when you mostly have to deal with named coordinates in the future.



        Furthermore, you can specify relative coordinates by prepending + or ++ to the coordinates. Your example would be translated to



        draw (x1,y1) -- ++(0, dy1) -- ++(dx1, 0);


        A single + leaves the reference point in place, while a ++ moves the reference point to the current location. This makes it very easy to move parts of a sketch around. You only have to edit the first coordinate.






        share|improve this answer















        I agree with you that you should not have a command in which the x coordinate (or y coordinate) is useless in the relative positioning of the points.



        However, it is not that easy to have such a command you requested. Nevertheless, TikZ already gives you a more brillant solution: -| and |-, which can handle named coordinates like (a), (b), etc. (and you will know that named coordinates are much prefered when drawing figures).



        Some example:



        draw (x1,y1) -- (x1,y2) -- (x2,y2);


        can be changed to



        draw (x1,y1) -| (x2,y2);


        Or with five coordinates:



        draw (x1,y1) -- (x1,y2) -- (x2,y2) -- (x2,y3) -- (x3,y3) -- (x3,y4);


        can be changed to



        draw (x1,y1) |- (x2,y2) -| (x3,y3) -- (x3,y4);


        As I said, a combination of --, -| and |- can do anything related to this. At worst there can be a couple of replicated x (or y) coordinates, but that is not a great deal, especially when you mostly have to deal with named coordinates in the future.



        Furthermore, you can specify relative coordinates by prepending + or ++ to the coordinates. Your example would be translated to



        draw (x1,y1) -- ++(0, dy1) -- ++(dx1, 0);


        A single + leaves the reference point in place, while a ++ moves the reference point to the current location. This makes it very easy to move parts of a sketch around. You only have to edit the first coordinate.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited yesterday

























        answered yesterday









        JouleVJouleV

        12.8k22663




        12.8k22663



























            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%2f484260%2fomit-the-same-coordinate-parameters-in-drawing-line-in-tikz%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







            -draw, tikz-pgf

            Popular posts from this blog

            Mobil Contents History Mobil brands Former Mobil brands Lukoil transaction Mobil UK Mobil Australia Mobil New Zealand Mobil Greece Mobil in Japan Mobil in Canada Mobil Egypt See also References External links Navigation menuwww.mobil.com"Mobil Corporation"the original"Our Houston campus""Business & Finance: Socony-Vacuum Corp.""Popular Mechanics""Lubrite Technologies""Exxon Mobil campus 'clearly happening'""Toledo Blade - Google News Archive Search""The Lion and the Moose - How 2 Executives Pulled off the Biggest Merger Ever""ExxonMobil Press Release""Lubricants""Archived copy"the original"Mobil 1™ and Mobil Super™ motor oil and synthetic motor oil - Mobil™ Motor Oils""Mobil Delvac""Mobil Industrial website""The State of Competition in Gasoline Marketing: The Effects of Refiner Operations at Retail""Mobil Travel Guide to become Forbes Travel Guide""Hotel Rankings: Forbes Merges with Mobil"the original"Jamieson oil industry history""Mobil news""Caltex pumps for control""Watchdog blocks Caltex bid""Exxon Mobil sells service station network""Mobil Oil New Zealand Limited is New Zealand's oldest oil company, with predecessor companies having first established a presence in the country in 1896""ExxonMobil subsidiaries have a business history in New Zealand stretching back more than 120 years. We are involved in petroleum refining and distribution and the marketing of fuels, lubricants and chemical products""Archived copy"the original"Exxon Mobil to Sell Its Japanese Arm for $3.9 Billion""Gas station merger will end Esso and Mobil's long run in Japan""Esso moves to affiliate itself with PC Optimum, no longer Aeroplan, in loyalty point switch""Mobil brand of gas stations to launch in Canada after deal for 213 Loblaws-owned locations""Mobil Nears Completion of Rebranding 200 Loblaw Gas Stations""Learn about ExxonMobil's operations in Egypt""Petrol and Diesel Service Stations in Egypt - Mobil"Official websiteExxon Mobil corporate websiteMobil Industrial official websiteeeeeeeeDA04275022275790-40000 0001 0860 5061n82045453134887257134887257

            Frič See also Navigation menuinternal link

            Identify plant with long narrow paired leaves and reddish stems Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?What is this plant with long sharp leaves? Is it a weed?What is this 3ft high, stalky plant, with mid sized narrow leaves?What is this young shrub with opposite ovate, crenate leaves and reddish stems?What is this plant with large broad serrated leaves?Identify this upright branching weed with long leaves and reddish stemsPlease help me identify this bulbous plant with long, broad leaves and white flowersWhat is this small annual with narrow gray/green leaves and rust colored daisy-type flowers?What is this chilli plant?Does anyone know what type of chilli plant this is?Help identify this plant