2

I have a schematics (grossly simplified in the below MWE) that I would like to use both upright and rotated, from the same source (i.e. the only difference should be in the \begin{tikzpicture} parameters, not in the code of individual nodes).

The problem is that if I use rotate without transform shape, the whole picture falls apart; and if I use it with transform shape, then the labels are rotated as well. I'm looking for a setting that behaves like transform shape, but applies a reverse rotation to all text labels.

Based on this answer, I tried the following, but it doesn't seem to do anything:

\tikzset{
  every label/.append style={reset transform},
  reset transform/.code={\pgftransformreset}
}

Full code:

\documentclass[varwidth,margin=3mm]{standalone}

\usepackage{tikz} \usepackage{circuitikz}

\begin{document}

\newcommand{\schematics}{ \draw (0,0) nodedipchip, num pins=6{\ttfamily ADD}; \draw (add.pin 1) -- ++(-1,0) node[left]{\ttfamily x0}; \draw (add.pin 3) -- ++(-1,0) node[left]{\ttfamily y0}; \draw (add.pin 5) -- ++(1,0) node[right]{\ttfamily z0}; }

\begin{tikzpicture} \schematics \end{tikzpicture}

\begin{tikzpicture}[rotate=-90] \schematics \end{tikzpicture}

\begin{tikzpicture}[rotate=-90,transform shape] \schematics \end{tikzpicture}

\end{document}

enter image description here

Cactus
  • 1,107

1 Answers1

3

No, it will not work, sorry.

enter image description here

I tried to correct this last year, but changes where too invasives and... scary: https://github.com/circuitikz/circuitikz/pull/257

What you can do is rotate \myangle with transform shape, and counter-rotate the labels manually with a \rotatebox{\myangle}{...} command where needed:

\documentclass[varwidth,margin=3mm]{standalone}

\usepackage{tikz} \usepackage{circuitikz}

\begin{document}

\newcommand{\myangle}{0}\newcommand\slap[1]{\rotatebox{\myangle}{#1}} \newcommand{\schematics}{ \draw (0,0) nodedipchip, num pins=6{\slap{\ttfamily ADD}}; \draw (add.pin 1) -- ++(-1,0) node[left]{\slap{\ttfamily x0}}; \draw (add.pin 3) -- ++(-1,0) node[left]{\slap{\ttfamily y0}}; \draw (add.pin 5) -- ++(1,0) node[right]{\slap{\ttfamily z0}}; }

\begin{tikzpicture} \schematics \end{tikzpicture}

\renewcommand{\myangle}{90} \begin{tikzpicture}[rotate=-\myangle,transform shape] \schematics \end{tikzpicture}

\end{document}

enter image description here

Rmano
  • 40,848
  • 3
  • 64
  • 125