8

Is there some reason why the center anchor for circuitikz logic gates are so far from the actual center (\pgfpointorigin)? Is this just where the author liked to align his gates and was too lazy to add a new anchor and use [anchor=anchorname]?

\documentclass{standalone}
\usepackage{circuitikz}

\begin{document}
\begin{circuitikz}
\draw[red] (-1,0) -- (1,0) (0,-1) -- (0,1);
\node[american or port] (A) at (0,0) {};
\draw[green] (A.south west) rectangle (A.north east);
\end{circuitikz}
\end{document}

demo

  • Probably pgfcirctripoles.tex line 182. I find no reason. – Symbol 1 Jun 2 '17 at 14:21
  • My best guess is that it is pointless to refer to the actual center of a port. Therefore the anchor is set to somewhere that looks like a wise choice. – Symbol 1 Jun 2 '17 at 14:44
  • Whether this is a bug of a feature, we will probably have to preserve backward compatibility. – John Kormylo Jun 2 '17 at 23:37
2

As mentioned in the comments by @JohnKormylo, whether it's a bug or feature, it is preserved for backward compatibility. But center anchor can be set at actual center with the command

% From Circuitikz version 0.9.0
\ctikzset{logic ports origin=center}

enter image description here

\documentclass[border=3mm]{standalone}
\usepackage{circuitikz}
\ctikzset{logic ports origin=center}
\begin{document}
\begin{circuitikz}
\draw[red] (-1,0) -- (1,0) (0,-1) -- (0,1);
\node[american or port] (A) at (0,0) {};
\draw[green] (A.south west) rectangle (A.north east);
\end{circuitikz}
\end{document}

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.