1

I want to draw logic gate constructions with European gates. Works well with Circuitikz except for one thing: the negation at the input gate. I know a way to place those using ocirc, but I would like to put a small triangle like the one at the output (see MWE below). How can I make a node shape looking like that?

tia, Guido

\documentclass[11pt,fleqn]{article}
\usepackage{circuitikz}
\tikzstyle{branch}=[fill,shape=circle,minimum size=3pt,inner sep=0pt]

\begin{document}
  \begin{circuitikz}
    \ctikzset{logic ports = european}
    \draw
    (0,2) node[and port] (and1) {}
    (0,0) node[and port] (and2) {}
    (2.5,1) node[nor port] (or1) {}
    (and1.in 1) node[left=.2cm](a0) {$ A_0 $}
    (and1.in 2) node[left = .2cm](a1) {$ A_1 $}
    (and1.out) -| (or1.in 1)
    (a0) -| (and1.in 1)
    (a1) -| (and1.in 2)
    (and2.in 2) node[left = .2cm](a0) {$ A_0 $}
    (and2.out) -| (or1.in 2)
    (a1 -| and2.in 1) node[branch] {} -- (and2.in 1)
    (a0) -| (and2.in 2)
    (or1.out) node [right=0.2] (x) {$X$}
    ;
    \node at (and1.bin 1)[ocirc,left] {};
    \node at (and2.bin 1)[ocirc,left] {};
  \end{circuitikz}
\end{document}
1

1 Answer 1

2

Well --- that would be a quite non-standard notation, (at least based on https://github.com/circuitikz/circuitikz/issues/385), but you can use a little macro for this (btw, I used circ shape instead of your branch, for coherence with the ocirc one):


\documentclass[11pt,fleqn]{article}
\usepackage[RPvoltages]{circuitikz}
\newcommand{\trianglenotin}[1]{% argument: input pin anchor to negate
    \draw (#1) +(0, 3pt) -- +(-4pt,0);
}

\begin{document}
  \begin{circuitikz}
    \ctikzset{logic ports = european}
    \draw
    (0,2) node[and port] (and1) {}
    (0,0) node[and port] (and2) {}
    (2.5,1) node[nor port] (or1) {}
    (and1.in 1) node[left=.2cm](a0) {$ A_0 $}
    (and1.in 2) node[left = .2cm](a1) {$ A_1 $}
    (and1.out) -| (or1.in 1)
    (a0) -| (and1.in 1)
    (a1) -| (and1.in 2)
    (and2.in 2) node[left = .2cm](a0) {$ A_0 $}
    (and2.out) -| (or1.in 2)
    (a1 -| and2.in 1) node[circ] {} -- (and2.in 1)
    (a0) -| (and2.in 2)
    (or1.out) node [right=0.2] (x) {$X$}
    ;
    % \node at (and1.bin 1)[ocirc,left] {};
    % \node at (and2.bin 1)[ocirc,left] {};
    \trianglenotin{and1.bin 1}
    \trianglenotin{and2.bin 1}
  \end{circuitikz}
\end{document}

enter image description here

You can easily change the triangle shape in the macro.

As said in the comment (I didn't know!), if you change the macro to:

\newcommand{\trianglenotin}[1]{% argument: input pin anchor to negate
    \draw (#1) ++(-4pt, 0) -- ++(0, 3pt) -- (#1);
}

you have the triangles the other way around:

enter image description here

...and while at it, you can also add edge-sensitive inputs...

\documentclass[11pt,fleqn]{article}
\usepackage[RPvoltages]{circuitikz}
\newcommand{\trianglenotin}[1]{% argument: input pin anchor to negate
    \draw (#1) ++(-4pt, 0) -- ++(0, 3pt) -- (#1);
}
\newcommand{\addedgeinright}[1]{% argument: input pin anchor to add the edge to 
    \draw (#1) ++(0, 3pt) -- ++(3pt, -3pt) -- ++(-3pt, -3pt);
}

\begin{document}
  \begin{circuitikz}
    \ctikzset{logic ports = european}
    \draw
    (0,2) node[and port] (and1) {}
    (0,0) node[and port] (and2) {}
    (2.5,1) node[nor port] (or1) {}
    (and1.in 1) node[left=.2cm](a0) {$ A_0 $}
    (and1.in 2) node[left = .2cm](a1) {$ A_1 $}
    (and1.out) -| (or1.in 1)
    (a0) -| (and1.in 1)
    (a1) -| (and1.in 2)
    (and2.in 2) node[left = .2cm](a0) {$ A_0 $}
    (and2.out) -| (or1.in 2)
    (a1 -| and2.in 1) node[circ] {} -- (and2.in 1)
    (a0) -| (and2.in 2)
    (or1.out) node [right=0.2] (x) {$X$}
    ;
    \trianglenotin{and1.bin 1}
    \trianglenotin{and2.bin 1}
    \addedgeinright{and2.bin 2}
  \end{circuitikz}
\end{document}

enter image description here

...relative coordinates drawing is quite useful!

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .