\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{circuits.logic.US,circuits.logic.IEC}
\begin{document}
\begin{tikzpicture}[minimum height=0.75cm]
\node[or gate US, draw,logic gate inputs=nnn] (A) {};
\foreach \a in {1,...,3}
\draw (A.input \a -| -1,0) -- (A.input \a);
\draw (A.output) -- ([xshift=0.5cm]A.output);
\end{tikzpicture}
\begin{tikzpicture}[minimum height=0.75cm]
\node[and gate US, draw,logic gate inputs=nnn] (A) {};
\foreach \a in {1,...,3}
\draw (A.input \a -| -1,0) -- (A.input \a);
\draw (A.output) -- ([xshift=0.5cm]A.output);
\end{tikzpicture}
\end{document}
By slight modification of this code you can acheive gates with more inputs (modifying inputs=nnn
and \foreach \a in {1,...,3}
).
For more, check TikZ & PGF manual section 29.3 Page 300
\draw (20,12) -- ++(2,0) -- ++(0,2) -- ++(-3,0) -- ++(45:3);
Use ++
before each new incremental coordinate to make it relative to the last one and put the pencil there.
Here's a complete example:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\tikz\draw (20,12) -- ++(2,0) -- ++(0,2) -- ++(-3,0) -- ++(30:3) {[rounded corners=10pt]-- ++(5,0) -- ++(0,-6)} -- ++(-7,0) -- cycle;
\end{document}
Of course, combining this with the -| or |- path operators can simplify the code even further; the following two pieces of code produce the same result:
\tikz\draw (20,12) -- ++(2,0) -- ++(0,2) -- ++(3,0) -- ++(0,1) -- ++(1,0) -- ++(0,-3) -- ++(2,0);\par\bigskip
and
\tikz\draw (20,12) -| ++(2,2) -| ++(3,1) -- ++(1,0) |- ++(2,-3);
I don't think that defining commands in this case adds anything; in fact, I think it reduces the functionality of the existing syntax (which is already simple). The example demonstrates that you can use, for example, polar coordinates and modify (up to TikZ limitations) the path attributes midways; even if the current question doesn't require this, it's a good thing to have the possibility to do those kind of modification if they are required.
Best Answer
You can place nodes for the labels:
To extend a line you can use
which draws a horizontal line from the
myand1.in 2
node to a point vertically below themyor1.in 2
node.Code: