Circuitikz flipflops: shift labels

circuitikzlabels

Given circuitikz flip-flops (or multipoles), how can I shift the pin labels up or down a bit? (context: I want to draw some internal lines, and they overlap with the pin labels)

Something like this:

\documentclass{standalone}

\usepackage{circuitikz}
\usetikzlibrary{positioning}

\begin{document}

\begin{circuitikz}
  % not what I want 
  \node [flipflop SR] (sr1) {};
  \draw [red] (sr1.bpin 1) -- (sr1.bpin 6) (sr1.bpin 3) -- (sr1.bpin 4) ;

  % something like this, but with proper distances,
  % and less cumbersome to write down: 
  \node [flipflop, right=of sr1] (sr2) {};
  \node [above right=0.05cm of sr2.bpin 1] {S}; 
  \node [below right=0.05cm of sr2.bpin 3] {R}; 
  \node [above left=0.05cm of sr2.bpin 6] {Q}; 
  \node [below left=0.05cm of sr2.bpin 4] {\ctikztextnot{Q}}; 
  \draw [red] (sr2.bpin 1) -- (sr2.bpin 6) (sr2.bpin 3) -- (sr2.bpin 4) ;
\end{circuitikz}

\end{document}

left: not nice; right: something like that

Best Answer

enter image description here

\documentclass{standalone}

\usepackage{circuitikz}
\usetikzlibrary{positioning}
\tikzset{
  flipflop SR shifted/.style={
    flipflop,
    flipflop def={
      t1=\raisebox{\dimexpr0.5ex+\height}{S},
      t3=\raisebox{-\dimexpr0.5ex+\height}{R},
      t6=\raisebox{\dimexpr0.5ex+\height}{Q},
      t4=\raisebox{-\dimexpr0.5ex+\height}{\ctikztextnot{Q}}
    }
  },
}
\begin{document}

\begin{circuitikz}
  \node [flipflop SR shifted] (sr1) {};
  \draw [red] (sr1.bpin 1) -- (sr1.bpin 6) (sr1.bpin 3) -- (sr1.bpin 4) ;
\end{circuitikz}

\end{document}

Related Question