TeX - LaTeX Asked by PF98 on February 11, 2021
I am using LaTeX with CircuiTikZ to create circuit diagrams. Using the CircuiTikZ documentation and many of questions and answers on this community, I have been able to navigate it pretty well.
I have to recreate an 8 pin DIP chip containig an amplifier symbol connected internally to the pins. I have been able to create it using this code:
begin{tikzpicture}
% DIP chip
draw (0,0) node[dipchip,
num pins=8,
external pins width=0.3,
external pad fraction=3,
hide numbers](C){};
% amplifier
draw (C) node[op amp, scale=0.571](OA){};
% amplifier connection to the chip pins
draw (OA.-) |- (C.bpin 2)
(OA.+) |- (C.bpin 3)
(OA.out) |- (C.bpin 6);
end{tikzpicture}
The result is exactly what I wanted:
The main objective in the creation of this image was the alignment between the dipchip pins and the amplifier + and – inputs. I accomplished this by manually resizing the amplifier (as shown by scale=0.571
in the code), until its inputs were perfectly aligned. Being this a quite tedious trial and error task, i was wondering if there is any easier (and possibly more elegant) method to accomplish the same result.
Thank you
The dimension in TikZ are relative to a basic length (which is not accessible easily, which is a bit of a pity), but each element has normally a different way to use the various parameters. So for example the distance between pins in chips is multipoles/dipchip/pin spacing
; and the distance between the inputs of an op amp
is tripoles/op amp/input height
but it is relative to the height of the component (tripoles/op amp/height
); this is basically historical.
Then, the components can be scaled by styles (amplifiers/scale
and chips/scale
)...
So this is what you can have to have the distance between the small amplifiers input match the chips:
documentclass[border=10pt]{standalone}
usepackage[siunitx, RPvoltages]{circuitikz}
% ctikzset{amplifiers/scale=1.5} % this will change the relative sizes
begin{document}
begin{tikzpicture}
pgfmathsetmacro{myscale}{
ctikzvalof{multipoles/dipchip/pin spacing}*
ctikzvalof{chips/scale} /
(ctikzvalof{tripoles/op amp/height}*
ctikzvalof{tripoles/op amp/input height}*
ctikzvalof{amplifiers/scale})
}
draw (0,2) node[]{myscale}; % show the magic number
% DIP chip
draw (0,0) node[dipchip,
num pins=8,
external pins width=0.3,
external pad fraction=3,
hide numbers](C){};
% amplifier --- position it relative to the chip
%(so I can move it around)
draw (C.bpin 2) node[op amp, scale=myscale, anchor=-](OA){};
% amplifier connection to the chip pins
draw (OA.-) |- (C.bpin 2)
(OA.+) |- (C.bpin 3)
(OA.out) |- (C.bpin 6);
end{tikzpicture}
end{document}
Notice also that I used relative positioning for the internal op-amp symbol so that you can move the main chip around without changing anything.
Answered by Rmano on February 11, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP