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
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
add a comment |
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
2
I would use-|
and|-
for that purpose, instead of--
. For example, in this case, I would usedraw (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
add a comment |
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
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
tikz-pgf draw
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 usedraw (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
add a comment |
2
I would use-|
and|-
for that purpose, instead of--
. For example, in this case, I would usedraw (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
add a comment |
1 Answer
1
active
oldest
votes
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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
edited yesterday
answered yesterday
JouleVJouleV
12.8k22663
12.8k22663
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
2
I would use
-|
and|-
for that purpose, instead of--
. For example, in this case, I would usedraw (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