1

I have a number of multiplexer drawings and I want to label the inputs starting at 0 rather than one. I am using a loop and the code example below works fine:

\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}
\tikzset{
            mux 10by2/.style={muxdemux,muxdemux def={Lh=10, NL=10, Rh=8,NB=0,NT=2, w=2}                     }
            }
   \node [mux 10by2](MuxA) at (0,0){MUX};
   \foreach \x in {1,2,3,4,5,6,7,8,9,10}
   \node [right, font=\tiny] at ($(MuxA.lpin \x)+(0.2,0)$) {\x};
\end{circuitikz}
\end{document}

This works fine however it labels the inputs 1 to 10 rather than 0 to 9. I need the origin at 0.

2

See pgfmanual sec 89 Repeating Things

\documentclass{article}
\usepackage{tikz}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}
\tikzset{
            mux 10by2/.style={muxdemux,muxdemux def={Lh=10, NL=10, Rh=8,NB=0,NT=2, w=2}                     }
            }
   \node [mux 10by2](MuxA) at (0,0){MUX};
   \foreach \x [count=\c] in {0,...,9}
   \node [right, font=\tiny] at ($(MuxA.lpin \c)+(0.2,0)$) {\x};
\end{circuitikz}
\end{document}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.