Open ghost opened 4 years ago
It's not a bad idea to think about a possible fix. What comes to my mind immediately would be to teach every node shape about its convex hull and use that in the fit, if it is available. Otherwise fall back to east
, west
, etc.
@hmenke Yes, that would work, of course. It would also mean that one adds all the explanations to the discussion of \pgfdeclareshape
. And then there of course already several shapes on the market. It might mean that the maintainers of circuitikz will have many things to do.
And then there of course already several shapes on the market. It might mean that the maintainers of circuitikz will have many things to do.
;-) yes, could be... support for fit
is indeed shaky in circuitikz
(sometimes the leads are accounted for, sometimes they're not, ditto for labels). I'll track this issue and if something changes (and I have time) I'll try to sort it out as best as I can.
@Rmano Right now, if you want to make sure that fit
properly encapsulates your shapes, you have to set north
, south
, east
, and west
such that the whole shape lies inside the rectangle that these anchors define.
@Rmano Right now, if you want to make sure that
fit
properly encapsulates your shapes, you have to setnorth
,south
,east
, andwest
such that the whole shape lies inside the rectangle that these anchors define.
Yes, I checked and more or less it works. My problem (and is clearly a problem of internal coherency of circuitikz
) is that sometimes lead wires are into the shape and sometimes not; also node content, if it straddles the geographical anchors, is not taken into account (It happens especially with transistors; I should fix it but I fear to break a lot of things).
@Rmano @hmenke Given the shape border rotate issue
(see https://tex.stackexchange.com/q/548679) it might indeed be worthwhile to go over all the shapes from the shapes.xyz
libraries and (1) add a list of additional fit anchors where necessary and (2) add a warning that the shape border rotate
won't work wherever appropriate. (I think it would, in principle, be possible to make shape border rotate
work for all shapes but this would be a lot of work, and the results generally questionable.) What do you think?
(1) Yes. (2) No, I want something generic and extensible that is built into \pgfdeclareshape
, so that all existing shapes automatically become compatible.
The
fit
library establishes the geometry of the fitting node by looking at thewest
,east
,north
andsouth
anchors only. This yields the appropriate result in most cases but not in all. An explicit example is thetrapezium
shape, see the MWE below.However, I do not necessarily think that one should try to fix this (how?). Yet, it might be worthwhile to mention this in the manual. Ways to obtain the proper fit include adding the "overshooting anchors" explicitly to the fit, or to use local bounding boxes.
Minimal working example (MWE)