Closed goyalyashpal closed 1 year ago
I was able to get the tikz shapes nodes placed at the anchor, but the only problem now is that none of the shape can form that right angled triangle
\usetikzlibrary{shapes.geometric}
and \node[draw, fill=white, isosceles triangel](){};
are just too limiting. None of those shapes can be formed into this right angle. \circuitikzsubdef
and here we are below with it:\documentclass[a4paper]{article}
\usepackage{circuitikz}
%\usetikzlibrary{shapes.geometric, shapes.arrows,arrows.meta}
% No anchors with pic
% Pic not supported with CircuiTikZ
% See CTikZ manual: section 8.5 FAQ, and 1.7
\tikzset{
euroinvert/.pic={
\draw (0,0) -- (-25:-5mm) |- (0,0); }
}
\ctikzsubcircuitdef{euroinver}{apex, base, top}{%
% reference anchor is -apex
coordinate(#1-apex)
(#1-apex) -- ++(-25:-5mm) coordinate (#1-top) --
(#1-top |- #1-apex) coordinate (#1-base) --
(#1-apex)
}
\begin{document}
\ctikzsubcircuitactivate{euroinver}
\begin{tikzpicture}[]
\path (0,0) node[muxdemux, muxdemux def={NL=2,Lh=2,Rh=2,NB=0},external pins width = 2](mdemux){};
\draw (mdemux.blpin 1) pic[draw](){euroinvert};
\draw (mdemux.brpin 1) \euroinver{ha}{base};
\end{tikzpicture}
\end{document}
experimental support for generating sub-circuits, or circuits blocks That means that in future releases the interface can change; use it at your risk and if you need it to continue working as-is, please use the GitHub project page and download and save the circuitikzgit.sty file for future-proof use!
\RequirePackage{circuitikz}[1.5.5]
- will that make it foolproof??
- i will move this subcircuit definition to my custom style file, and do
\RequirePackage{circuitikz}[1.5.5]
- will that make it foolproof??
I suppose it will work. Never tried; I do not think that any package depends on circuitikz
- Will it hurt if i activate it right after the definition in the style file itself? (seems yes, it shows errors)
Yes. The problem is that to know the distances with the actual sizes of components, you have to call the "activate" after all the options are active. That will typeset the circuit to measure the distances... What you could try to do is to add the activation to a hook, if you don't change styles after the preamble (something like \AtBeginDocument
, or better one of the new hooks, you can look at lthooks-doc.pdf
in your TeX system).
I suppose it will work. Never tried; I do not think that any package depends on
circuitikz
I supposed wrong. There are only some "go back" points in the package, and 1.5.5 is not one of them. Anyway, I do not think to change the subcircuit thing anymore --- at least not in a backward compatible way (I am a bit of a sucker for backward compatibility...). I'll change the manual to reflect that in a future commit...
See #682 😉
hey, by any means, do you think adding this as new component would be worth it??
You got me... I never use European logic symbols (I think a symbol must convey its meaning graphically, and the European symbols don't do that --- just a lot of rectangles). So I am not the right one to judge it. Standard TikZ circuit library has options to add negation on the inputs, which I never tried even to think how to implement (I provide the anchor to trick it); maybe that would be the logical way to do it...
I think a symbol must convey its meaning graphically, and the European symbols don't do that --- just a lot of rectangles
u are right, i used to think same before. and still do think same as long as logic symbols (or perhaps more aptly, logic circuit diagram) for gates are concerned.
but where european rectangles shine is in providing consistent looking, easy to follow abstraction for more complex logic units like mux, demux, comparator, etc...
in my opinion, the circle looks very odd and feels out of place in these otherwise prefect boxes.
wow, the vertical alignment here 😅:point_down:
totally missed this
Yes, the look is quite nice. I think that's definitely possible (and maybe good) to add the shape --- it's not invasive and it can be used in a lot of place.
Yes, the look is quite nice
glad u liked 'em 😊😃
What about...
this one scales with logic port
class (this is a bit arbitrary, I know) and the default size I chose are quite random too, but... what do you think?
\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[siunitx, RPvoltages]{circuitikz}
\usepackage{ctikzmanutils}
\makeatletter
\ctikzset{euroinver/width/.initial = 0.2}
\ctikzset{euroinver/height/.initial = 0.1}
\pgfdeclareshape{euroinver}{
\savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
\savedanchor\northeast{%
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
\pgf@y=\ctikzvalof{euroinver/height}\pgf@circ@scaled@Rlen
\pgf@x=\ctikzvalof{euroinver/width}\pgf@circ@scaled@Rlen
}
\anchor{center}{\pgfpointorigin}
\anchor{top}{\northeast\pgf@x=0pt\relax}
\anchor{apex}{\northeast\pgf@y=0pt\relax}
\anchor{base}{\pgfpointorigin}
\anchor{mid}{\northeast\pgf@x=0.5\pgf@x\pgf@y=0.5\pgf@y}
% not standard geoanchors, south west is the same as 0,0...
\anchor{right}{\northeast\pgf@y=0pt\relax}
\anchor{east}{\northeast\pgf@y=0pt\relax}
\anchor{e}{\northeast\pgf@y=0pt\relax}
\anchor{left}{\pgfpointorigin}
\anchor{west}{\pgfpointorigin}
\anchor{w}{\pgfpointorigin}
\anchor{south}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x}
\anchor{s}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x}
\anchor{north}{\northeast\pgf@x=0.5\pgf@x}
\anchor{n}{\northeast\pgf@x=0.5\pgf@x}
\anchor{south west}{\pgfpointorigin}
\anchor{sw}{\pgfpointorigin}
\anchor{north east}{\northeast}
\anchor{ne}{\northeast}
\anchor{north west}{\northeast\pgf@x=0pt\relax}
\anchor{nw}{\northeast\pgf@x=0pt\relax}
\anchor{south east}{\northeast\pgf@y=0pt\relax}
\anchor{se}{\northeast\pgf@y=0pt\relax}
% geo anchors based on north-east (not correct, fix me)
% \pgfcirc@northeast@symmetric@geoanchors
\pgf@circ@draw@component{
\northeast\pgf@circ@res@up=\pgf@y\pgf@circ@res@right=\pgf@x
%\typeout{DIMENSxy:\space\the\pgf@circ@scaled@Rlen\space \the\pgf@circ@res@right\space \the\pgf@circ@res@up}
\pgfpathmoveto{\pgfpointorigin}
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
\pgfpathclose
\pgfusepath{draw}
}
}
\makeatother
\begin{document}
\begin{tikzpicture}[]
\path (0,0) node[muxdemux, muxdemux def={NL=2,Lh=2,Rh=2,NB=0},external pins width = 2](mdemux){};
\draw (mdemux.blpin 1) node[euroinver,anchor=apex]{};
\draw (mdemux.brpin 1) node[euroinver]{} ;
\end{tikzpicture}
\showanchors[]{euroinver, scale=6}{}(north/90/0.4, north east/45/0.4, east/0/0.4,
south east/-45/0.4,
south/-90/0.4, south west/-135/0.4, west/180/0.4, north west/135/0.4,
left/160/0.4, right/30/0.4, center/-120/0.3,
base/-90/0.6, top/90/0.6, apex/-90/0.6, mid/60/0.6
)
\end{document}
i prepared a whole paragraph of reply... but thought it will require a bit more testing and filtering on my part.
If you can use the new shape with one of your examples I'll be glad to add it...
What about this:
"and the length and height can be changed with ..."
yeah, that's what i was thinking for. I was thinking more about angle... as when modifying, it may be convenient to be able to specify the apex angle? what do you think? although, yeah, the height and width gives better control...
but specifying angle, and width might be sufficient too... maybe, i am not sure update: thinking more, i guess it's not needed. 'would be an unnecessary complication
euroinv
is also better than euroinver
the default size I chose are quite random too
for other dimensions:
wow, was searching for the IEEE standard, and it requires sign in to view :eyes:
Found one more interesting document while searching: http://www.wakerly.org/DDPP/DDPP3_pdf/IEEEsyms.pdf | archival link
It contains nice terminology which will come in handy while writing tutorials.
At page 2, it says the following:
ANOTHER KIND OF BUBBLE In addition to the familiar bubble, the IEEE standard also allows an external, triangular “polarity symbol” to be used to specify active-low inputs and outputs, for which the external
LOW
level corresponds to the internal 1-state. However, under a positive-logic convention, the bubble and the triangular polarity symbol are equivalent, so we use the more traditional bubble in this appendix.
Update: have read it complete, and wow, it is awesome. I wish i had stumbled it back when i was writing my document. would have saved me quite a lot of unnecessary confusions and decision making... the G0/7 vs A-B-C vs C0/7 or C0-C3
at page #20/"810" totally hit at home)
wow, was searching for the IEEE standard, and it requires sign in to view eyes
I have it, and 1973 one in some place, but I can't find it now. I used them to define IEEE shapes(see #383 for more details). There is no specific size there, but you can see here that the 2:1 proportion is more or less the correct one:
Notice that in IEEE the triangle is normally meant to indicate an electrical condition (negative logic versus positive logic), not logical; but it's true that now everything is in positive logic, so it became equivalent to the "negaation ball".
Notice that in IEEE the triangle is normally meant to indicate an electrical condition (negative logic versus positive logic), not logical; but it's true that now everything is in positive logic, ...
i don't really understand these terms then 😅, will learn someday later. any recommended resource suggestion regarding that are welcome :)
i don't really understand these terms then sweat_smile, will learn someday later. any recommended resource suggestion regarding that are welcome :)
No surprise, I know it because I'm old 😜. If you consider "1" low voltage and "0" high voltage, a NAND swaps meaning with a NOR, and so on. But I think I saw a negative logic circuit last time in an exam when I was a student at Uni, so we can probably consider it historical.
So do you think I can merge it like it is?
So do you think I can merge it like it is?
reviewing there itself
Just sharing for reference:
U+2300 Miscellaneous Technical
⌲ U+2332 CONICAL TAPER
⌳ U+2333 SLOPE
tripoles/european not symbol=triangle
The required shape is an open/unfilled right triangle which is only on one side of the wire i.e. its origin anchor.
From TikZ > Arrows > Reference: Arrow Tips > Geometric (page 219) I found out that:
Triangle[open, left]
i.e.instance of a Kite with zero inset.
best fits the descriptionAnyhow, I have already tried creating the node with all following combinations:
\node[kite] (B) at (A.bout) {};
Package pgfkeys Error: I do not know the key '/tikz/kite' and I am going to ignore it. Perhaps you misspelled it. \node[kite]
Citations:
Page 157, 4.22.7 European logic port usage The node for using outside for
tripoles/european not symbol=ieee circle
isocirc
(open circle).Page 156, 4.23 Flip-flops a negation flag ... will put an
ocirc
shape on the border of corresponding pinPage 199, 6.1 Nodes to bipoles (and 4.12 terminal shapes) You can use other shapes too, but at your own risk…
I was easily able to put a circle on the bottom left pin (
blpin
) of the muxdemux, but couldn't