slope of midway nodes not respecting global coordinate transform?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












Consider this code:



documentclassarticle

usepackagetikz

begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1]
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture

Sloped label without scaling:

begintikzpicture
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


This is the output:



output



So it seems that the sloped option somehow ignores the global coordinate transform matrix. There's nothing particular about yscale=-1, you can try with something else as well. It seems like the slope is computed using the literal node coordinates instead of the actual positions.



So is this a bug or am I doing something wrong? How to get a properly sloped label?



I'm using the tikz package from MacLive 2017 (how to check the exact version?)










share|improve this question

















  • 3




    Add transform shape either to the node options or to the tikzpicture options.
    – esdd
    1 hour ago















up vote
3
down vote

favorite












Consider this code:



documentclassarticle

usepackagetikz

begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1]
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture

Sloped label without scaling:

begintikzpicture
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


This is the output:



output



So it seems that the sloped option somehow ignores the global coordinate transform matrix. There's nothing particular about yscale=-1, you can try with something else as well. It seems like the slope is computed using the literal node coordinates instead of the actual positions.



So is this a bug or am I doing something wrong? How to get a properly sloped label?



I'm using the tikz package from MacLive 2017 (how to check the exact version?)










share|improve this question

















  • 3




    Add transform shape either to the node options or to the tikzpicture options.
    – esdd
    1 hour ago













up vote
3
down vote

favorite









up vote
3
down vote

favorite











Consider this code:



documentclassarticle

usepackagetikz

begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1]
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture

Sloped label without scaling:

begintikzpicture
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


This is the output:



output



So it seems that the sloped option somehow ignores the global coordinate transform matrix. There's nothing particular about yscale=-1, you can try with something else as well. It seems like the slope is computed using the literal node coordinates instead of the actual positions.



So is this a bug or am I doing something wrong? How to get a properly sloped label?



I'm using the tikz package from MacLive 2017 (how to check the exact version?)










share|improve this question













Consider this code:



documentclassarticle

usepackagetikz

begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1]
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture

Sloped label without scaling:

begintikzpicture
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


This is the output:



output



So it seems that the sloped option somehow ignores the global coordinate transform matrix. There's nothing particular about yscale=-1, you can try with something else as well. It seems like the slope is computed using the literal node coordinates instead of the actual positions.



So is this a bug or am I doing something wrong? How to get a properly sloped label?



I'm using the tikz package from MacLive 2017 (how to check the exact version?)







tikz-pgf






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 1 hour ago









gigabytes

1,3281018




1,3281018







  • 3




    Add transform shape either to the node options or to the tikzpicture options.
    – esdd
    1 hour ago













  • 3




    Add transform shape either to the node options or to the tikzpicture options.
    – esdd
    1 hour ago








3




3




Add transform shape either to the node options or to the tikzpicture options.
– esdd
1 hour ago





Add transform shape either to the node options or to the tikzpicture options.
– esdd
1 hour ago











3 Answers
3






active

oldest

votes

















up vote
3
down vote













One option is to use decorations.markings for that. (I do not get the desired result with transform shape, which has been suggested by esdd and is a great idea in general.)



documentclassarticle

usepackagetikz
usetikzlibrarydecorations.markings,calc
begindocument

Sloped label with scaling and verb|decorations.markings|:

begintikzpicture[yscale=-1]
draw[postaction=decorate,decoration=markings,
mark=at position 0.5 with path (0,0) coordinate (aux0) (1,0) coordinate
(aux1);
pgftransformreset
path let p1=($(aux1)-(aux0)$),n1=atan2(y1,x1) in
(aux0) node[rotate=n1]Label; ] (0,0) -- (2,2);
endtikzpicture

Sloped label with scaling and verb|transform shape|:

begintikzpicture[yscale=-1,transform shape]
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture


Sloped label without scaling:

begintikzpicture
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


enter image description here






share|improve this answer






















  • That is really more complex that a midway node, though..
    – gigabytes
    17 mins ago










  • @gigabytes Yes, it is. To be fair, one should say that transform shape would work fine if you were to add another yscale=-1, i.e. begintikzpicture[yscale=-1,transform shape] draw (0,0) -- (2,2) node[midway,sloped,yscale=-1] Label; endtikzpicture. And thanks for your legal advice!
    – marmot
    21 secs ago


















up vote
2
down vote













Here is another suggestion



documentclassarticle
usepackagetikz

begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1,transform shape,nodes=yscale=-1]
draw (0,0)nodex -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


enter image description here



Or



documentclassarticle
usepackagetikz

begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1]
draw (0,0)nodex -- (2,2) node[midway,sloped,transform shape,yscale=-1] Label;
endtikzpicture

enddocument





share|improve this answer




















  • That obtains the desired output quite cleanly, thanks. But a main point of the question was also to know if the behavior is expected or if that's a bug. What do you think about it?
    – gigabytes
    9 mins ago


















up vote
1
down vote













Using transform shape works, but maybe the result is unexpected:



documentclassarticle
usepackagetikz
begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1]
draw (0,0) -- (2,2) node[midway,sloped, transform shape] Label;
endtikzpicture

Sloped label without scaling:

begintikzpicture
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


enter image description here



...you are mirroring vertically everything...






share|improve this answer




















  • That's expected with the transform shape key, yes.. but was the sloped option expected to work in that way?
    – gigabytes
    16 mins ago










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%2f458037%2fslope-of-midway-nodes-not-respecting-global-coordinate-transform%23new-answer', 'question_page');

);

Post as a guest






























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
3
down vote













One option is to use decorations.markings for that. (I do not get the desired result with transform shape, which has been suggested by esdd and is a great idea in general.)



documentclassarticle

usepackagetikz
usetikzlibrarydecorations.markings,calc
begindocument

Sloped label with scaling and verb|decorations.markings|:

begintikzpicture[yscale=-1]
draw[postaction=decorate,decoration=markings,
mark=at position 0.5 with path (0,0) coordinate (aux0) (1,0) coordinate
(aux1);
pgftransformreset
path let p1=($(aux1)-(aux0)$),n1=atan2(y1,x1) in
(aux0) node[rotate=n1]Label; ] (0,0) -- (2,2);
endtikzpicture

Sloped label with scaling and verb|transform shape|:

begintikzpicture[yscale=-1,transform shape]
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture


Sloped label without scaling:

begintikzpicture
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


enter image description here






share|improve this answer






















  • That is really more complex that a midway node, though..
    – gigabytes
    17 mins ago










  • @gigabytes Yes, it is. To be fair, one should say that transform shape would work fine if you were to add another yscale=-1, i.e. begintikzpicture[yscale=-1,transform shape] draw (0,0) -- (2,2) node[midway,sloped,yscale=-1] Label; endtikzpicture. And thanks for your legal advice!
    – marmot
    21 secs ago















up vote
3
down vote













One option is to use decorations.markings for that. (I do not get the desired result with transform shape, which has been suggested by esdd and is a great idea in general.)



documentclassarticle

usepackagetikz
usetikzlibrarydecorations.markings,calc
begindocument

Sloped label with scaling and verb|decorations.markings|:

begintikzpicture[yscale=-1]
draw[postaction=decorate,decoration=markings,
mark=at position 0.5 with path (0,0) coordinate (aux0) (1,0) coordinate
(aux1);
pgftransformreset
path let p1=($(aux1)-(aux0)$),n1=atan2(y1,x1) in
(aux0) node[rotate=n1]Label; ] (0,0) -- (2,2);
endtikzpicture

Sloped label with scaling and verb|transform shape|:

begintikzpicture[yscale=-1,transform shape]
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture


Sloped label without scaling:

begintikzpicture
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


enter image description here






share|improve this answer






















  • That is really more complex that a midway node, though..
    – gigabytes
    17 mins ago










  • @gigabytes Yes, it is. To be fair, one should say that transform shape would work fine if you were to add another yscale=-1, i.e. begintikzpicture[yscale=-1,transform shape] draw (0,0) -- (2,2) node[midway,sloped,yscale=-1] Label; endtikzpicture. And thanks for your legal advice!
    – marmot
    21 secs ago













up vote
3
down vote










up vote
3
down vote









One option is to use decorations.markings for that. (I do not get the desired result with transform shape, which has been suggested by esdd and is a great idea in general.)



documentclassarticle

usepackagetikz
usetikzlibrarydecorations.markings,calc
begindocument

Sloped label with scaling and verb|decorations.markings|:

begintikzpicture[yscale=-1]
draw[postaction=decorate,decoration=markings,
mark=at position 0.5 with path (0,0) coordinate (aux0) (1,0) coordinate
(aux1);
pgftransformreset
path let p1=($(aux1)-(aux0)$),n1=atan2(y1,x1) in
(aux0) node[rotate=n1]Label; ] (0,0) -- (2,2);
endtikzpicture

Sloped label with scaling and verb|transform shape|:

begintikzpicture[yscale=-1,transform shape]
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture


Sloped label without scaling:

begintikzpicture
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


enter image description here






share|improve this answer














One option is to use decorations.markings for that. (I do not get the desired result with transform shape, which has been suggested by esdd and is a great idea in general.)



documentclassarticle

usepackagetikz
usetikzlibrarydecorations.markings,calc
begindocument

Sloped label with scaling and verb|decorations.markings|:

begintikzpicture[yscale=-1]
draw[postaction=decorate,decoration=markings,
mark=at position 0.5 with path (0,0) coordinate (aux0) (1,0) coordinate
(aux1);
pgftransformreset
path let p1=($(aux1)-(aux0)$),n1=atan2(y1,x1) in
(aux0) node[rotate=n1]Label; ] (0,0) -- (2,2);
endtikzpicture

Sloped label with scaling and verb|transform shape|:

begintikzpicture[yscale=-1,transform shape]
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture


Sloped label without scaling:

begintikzpicture
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited 25 mins ago

























answered 33 mins ago









marmot

70.9k476151




70.9k476151











  • That is really more complex that a midway node, though..
    – gigabytes
    17 mins ago










  • @gigabytes Yes, it is. To be fair, one should say that transform shape would work fine if you were to add another yscale=-1, i.e. begintikzpicture[yscale=-1,transform shape] draw (0,0) -- (2,2) node[midway,sloped,yscale=-1] Label; endtikzpicture. And thanks for your legal advice!
    – marmot
    21 secs ago

















  • That is really more complex that a midway node, though..
    – gigabytes
    17 mins ago










  • @gigabytes Yes, it is. To be fair, one should say that transform shape would work fine if you were to add another yscale=-1, i.e. begintikzpicture[yscale=-1,transform shape] draw (0,0) -- (2,2) node[midway,sloped,yscale=-1] Label; endtikzpicture. And thanks for your legal advice!
    – marmot
    21 secs ago
















That is really more complex that a midway node, though..
– gigabytes
17 mins ago




That is really more complex that a midway node, though..
– gigabytes
17 mins ago












@gigabytes Yes, it is. To be fair, one should say that transform shape would work fine if you were to add another yscale=-1, i.e. begintikzpicture[yscale=-1,transform shape] draw (0,0) -- (2,2) node[midway,sloped,yscale=-1] Label; endtikzpicture. And thanks for your legal advice!
– marmot
21 secs ago





@gigabytes Yes, it is. To be fair, one should say that transform shape would work fine if you were to add another yscale=-1, i.e. begintikzpicture[yscale=-1,transform shape] draw (0,0) -- (2,2) node[midway,sloped,yscale=-1] Label; endtikzpicture. And thanks for your legal advice!
– marmot
21 secs ago











up vote
2
down vote













Here is another suggestion



documentclassarticle
usepackagetikz

begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1,transform shape,nodes=yscale=-1]
draw (0,0)nodex -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


enter image description here



Or



documentclassarticle
usepackagetikz

begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1]
draw (0,0)nodex -- (2,2) node[midway,sloped,transform shape,yscale=-1] Label;
endtikzpicture

enddocument





share|improve this answer




















  • That obtains the desired output quite cleanly, thanks. But a main point of the question was also to know if the behavior is expected or if that's a bug. What do you think about it?
    – gigabytes
    9 mins ago















up vote
2
down vote













Here is another suggestion



documentclassarticle
usepackagetikz

begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1,transform shape,nodes=yscale=-1]
draw (0,0)nodex -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


enter image description here



Or



documentclassarticle
usepackagetikz

begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1]
draw (0,0)nodex -- (2,2) node[midway,sloped,transform shape,yscale=-1] Label;
endtikzpicture

enddocument





share|improve this answer




















  • That obtains the desired output quite cleanly, thanks. But a main point of the question was also to know if the behavior is expected or if that's a bug. What do you think about it?
    – gigabytes
    9 mins ago













up vote
2
down vote










up vote
2
down vote









Here is another suggestion



documentclassarticle
usepackagetikz

begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1,transform shape,nodes=yscale=-1]
draw (0,0)nodex -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


enter image description here



Or



documentclassarticle
usepackagetikz

begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1]
draw (0,0)nodex -- (2,2) node[midway,sloped,transform shape,yscale=-1] Label;
endtikzpicture

enddocument





share|improve this answer












Here is another suggestion



documentclassarticle
usepackagetikz

begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1,transform shape,nodes=yscale=-1]
draw (0,0)nodex -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


enter image description here



Or



documentclassarticle
usepackagetikz

begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1]
draw (0,0)nodex -- (2,2) node[midway,sloped,transform shape,yscale=-1] Label;
endtikzpicture

enddocument






share|improve this answer












share|improve this answer



share|improve this answer










answered 12 mins ago









esdd

56.9k34383




56.9k34383











  • That obtains the desired output quite cleanly, thanks. But a main point of the question was also to know if the behavior is expected or if that's a bug. What do you think about it?
    – gigabytes
    9 mins ago

















  • That obtains the desired output quite cleanly, thanks. But a main point of the question was also to know if the behavior is expected or if that's a bug. What do you think about it?
    – gigabytes
    9 mins ago
















That obtains the desired output quite cleanly, thanks. But a main point of the question was also to know if the behavior is expected or if that's a bug. What do you think about it?
– gigabytes
9 mins ago





That obtains the desired output quite cleanly, thanks. But a main point of the question was also to know if the behavior is expected or if that's a bug. What do you think about it?
– gigabytes
9 mins ago











up vote
1
down vote













Using transform shape works, but maybe the result is unexpected:



documentclassarticle
usepackagetikz
begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1]
draw (0,0) -- (2,2) node[midway,sloped, transform shape] Label;
endtikzpicture

Sloped label without scaling:

begintikzpicture
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


enter image description here



...you are mirroring vertically everything...






share|improve this answer




















  • That's expected with the transform shape key, yes.. but was the sloped option expected to work in that way?
    – gigabytes
    16 mins ago














up vote
1
down vote













Using transform shape works, but maybe the result is unexpected:



documentclassarticle
usepackagetikz
begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1]
draw (0,0) -- (2,2) node[midway,sloped, transform shape] Label;
endtikzpicture

Sloped label without scaling:

begintikzpicture
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


enter image description here



...you are mirroring vertically everything...






share|improve this answer




















  • That's expected with the transform shape key, yes.. but was the sloped option expected to work in that way?
    – gigabytes
    16 mins ago












up vote
1
down vote










up vote
1
down vote









Using transform shape works, but maybe the result is unexpected:



documentclassarticle
usepackagetikz
begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1]
draw (0,0) -- (2,2) node[midway,sloped, transform shape] Label;
endtikzpicture

Sloped label without scaling:

begintikzpicture
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


enter image description here



...you are mirroring vertically everything...






share|improve this answer












Using transform shape works, but maybe the result is unexpected:



documentclassarticle
usepackagetikz
begindocument

Sloped label with scaling:

begintikzpicture[yscale=-1]
draw (0,0) -- (2,2) node[midway,sloped, transform shape] Label;
endtikzpicture

Sloped label without scaling:

begintikzpicture
draw (0,0) -- (2,2) node[midway,sloped] Label;
endtikzpicture

enddocument


enter image description here



...you are mirroring vertically everything...







share|improve this answer












share|improve this answer



share|improve this answer










answered 27 mins ago









Rmano

7,16021647




7,16021647











  • That's expected with the transform shape key, yes.. but was the sloped option expected to work in that way?
    – gigabytes
    16 mins ago
















  • That's expected with the transform shape key, yes.. but was the sloped option expected to work in that way?
    – gigabytes
    16 mins ago















That's expected with the transform shape key, yes.. but was the sloped option expected to work in that way?
– gigabytes
16 mins ago




That's expected with the transform shape key, yes.. but was the sloped option expected to work in that way?
– gigabytes
16 mins ago

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f458037%2fslope-of-midway-nodes-not-respecting-global-coordinate-transform%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

Long meetings (6-7 hours a day): Being “babysat” by supervisor

Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

Confectionery