3

as you can see the horizontal line goes beyond where I want it to go instead of going straight down, I want it to go in the green path I've marked, how do I do it? and why in the first place I have this problem. (the code and picture are the cut-down versions of bigger things but only that single line has a problem)

\documentclass{article}
\usepackage{circuitikz}

\begin{document}
\begin{circuitikz} 

% Define positions for the w, x, y, z labels 
\node[anchor=base] (label_1) at (1, 2) {$1$};

\node [muxdemux,   muxdemux def={NL=5, NR=1, NB=0, w=3, square pins=0, Lh=6, Rh=6}, rotate=0](C) at (4.5,0) {\rotatebox{0}{\small \ttfamily $f$}}; 
\node[left] at (C.lpin 1) {\scriptsize $f\left(X,1,1,1,1\right)$}; 
\node[left] at (C.lpin 2) {\scriptsize $f\left(Y,1,1,1,1\right)$}; 
\node[above] at (C.lpin 3) {$0$}; 
\node[above] at (C.lpin 4) {$1$};
\node[above] at (C.lpin 5) {$0$}; 
\node[right] at (C.rpin 1) {$X+Y$};

\begin{scope}

%the culprit
\draw[draw opacity=0.4] (label_1)  |- node[circ]{} ([yshift=0.625cm]C.lpin 4) -- ([xshift=-1.25cm]C.lpin 4) |- (C.lpin 4);
\end{scope}

\end{circuitikz}
\end{document}

enter image description here

2
  • 3
    add an xshift to the intermediate point as well, like in \begin{scope} \draw[draw opacity=0.4] (label_1) |- node[circ]{} ([yshift=0.625cm,xshift=-1.25cm]C.lpin 4) -- ([xshift=-1.25cm]C.lpin 4) |- (C.lpin 4); \end{scope}
    – Ronald
    Commented May 30 at 11:31
  • @Ronald thanks that solved it
    – Nate3384
    Commented May 30 at 11:42

1 Answer 1

4

I suggest using a more direct way (without any magic shift) like the following one (you can change pos=0.5 if you want to move the branch point):


\documentclass{article}
\usepackage{circuitikz}

\begin{document}
\begin{circuitikz}

    % Define positions for the w, x, y, z labels
    \node[anchor=base] (label_1) at (1, 2) {$1$};

    \node [muxdemux,   muxdemux def={NL=5, NR=1, NB=0, w=3, square pins=0, Lh=6, Rh=6}, rotate=0](C) at (4.5,0) {\rotatebox{0}{\small \ttfamily $f$}};
    \node[left] at (C.lpin 1) {\scriptsize $f\left(X,1,1,1,1\right)$};
    \node[left] at (C.lpin 2) {\scriptsize $f\left(Y,1,1,1,1\right)$};
    \node[above] at (C.lpin 3) {$0$};
    \node[above] at (C.lpin 4) {$1$};
    \node[above] at (C.lpin 5) {$0$};
    \node[right] at (C.rpin 1) {$X+Y$};

    \begin{scope}
        \draw[draw opacity=0.4] (label_1) to[short, -*] (label_1 |- C.lpin 3)
        -- coordinate[pos=0.5](mid_to_3) (C.lpin 3);
        \draw[draw opacity=0.4] (mid_to_3) |- (C.lpin 4);
    \end{scope}

\end{circuitikz}
\end{document}

enter image description here

I imagine that the scope environment is needed for other things, here it does nothing 😉...

Notice that the strange differences in the width of lines are due to the (terrible) antialiasing algorithm of okular. I advise using colors; normally, they rend better in viewers than opacity. (Like black!30 or something like that).

You must log in to answer this question.

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