Omit the same coordinate parameters in drawing line in tikz The 2019 Stack Overflow Developer Survey Results Are InDifference 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
Why isn't the circumferential light around the M87 black hole's event horizon symmetric?
Keeping a retro style to sci-fi spaceships?
Output the Arecibo Message
Landlord wants to switch my lease to a "Land contract" to "get back at the city"
What is the meaning of Triage in Cybersec world?
If I can cast sorceries at instant speed, can I use sorcery-speed activated abilities at instant speed?
Cooking pasta in a water boiler
Can there be female White Walkers?
How come people say “Would of”?
If I score a critical hit on an 18 or higher, what are my chances of getting a critical hit if I roll 3d20?
Dropping list elements from nested list after evaluation
What is the grammatical structure of "Il est de formation classique"?
Why didn't the Event Horizon Telescope team mention Sagittarius A*?
Compute the product of 3 dictionaries and concatenate keys and values
Balance problems for leveling up mid-fight?
Why is ParallelDo slower than Do?
Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?
How to type a long/em dash `—`
Can withdrawing asylum be illegal?
writing variables above the numbers in tikz picture
GUI Number Generator in QT C++
How can I add encounters in the Lost Mine of Phandelver campaign without giving PCs too much XP?
Can we generate random numbers using irrational numbers like π and e?
Pokemon Turn Based battle (Python)
Omit the same coordinate parameters in drawing line in tikz
The 2019 Stack Overflow Developer Survey Results Are InDifference 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
11 hours ago
What about more than 3 coordinates
– wayne
11 hours ago
1
Give me an example, and I will do it for you. A combination of--,-|, and|-will solve it all.
– JouleV
11 hours ago
Yes, it is true you can use combinations of these to draw almost any line. In this case, my question seems trivial.
– wayne
10 hours ago
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 11 hours ago
JouleV
12.5k22663
12.5k22663
asked 11 hours ago
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
11 hours ago
What about more than 3 coordinates
– wayne
11 hours ago
1
Give me an example, and I will do it for you. A combination of--,-|, and|-will solve it all.
– JouleV
11 hours ago
Yes, it is true you can use combinations of these to draw almost any line. In this case, my question seems trivial.
– wayne
10 hours ago
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
11 hours ago
What about more than 3 coordinates
– wayne
11 hours ago
1
Give me an example, and I will do it for you. A combination of--,-|, and|-will solve it all.
– JouleV
11 hours ago
Yes, it is true you can use combinations of these to draw almost any line. In this case, my question seems trivial.
– wayne
10 hours ago
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
11 hours ago
I would use
-| and |- for that purpose, instead of --. For example, in this case, I would use draw (1,0) -| (0,1);.– JouleV
11 hours ago
What about more than 3 coordinates
– wayne
11 hours ago
What about more than 3 coordinates
– wayne
11 hours ago
1
1
Give me an example, and I will do it for you. A combination of
--, -|, and |- will solve it all.– JouleV
11 hours ago
Give me an example, and I will do it for you. A combination of
--, -|, and |- will solve it all.– JouleV
11 hours ago
Yes, it is true you can use combinations of these to draw almost any line. In this case, my question seems trivial.
– wayne
10 hours ago
Yes, it is true you can use combinations of these to draw almost any line. In this case, my question seems trivial.
– wayne
10 hours ago
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');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
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 4 hours ago
answered 10 hours ago
JouleVJouleV
12.5k22663
12.5k22663
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');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
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');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
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');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
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');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
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
2
I would use
-|and|-for that purpose, instead of--. For example, in this case, I would usedraw (1,0) -| (0,1);.– JouleV
11 hours ago
What about more than 3 coordinates
– wayne
11 hours ago
1
Give me an example, and I will do it for you. A combination of
--,-|, and|-will solve it all.– JouleV
11 hours ago
Yes, it is true you can use combinations of these to draw almost any line. In this case, my question seems trivial.
– wayne
10 hours ago