4

I have a figure which I generated using the code below. Basically, when I use [rotate=45] option, I would like to ensure that the strike out symbol is rotated as well.

Also, related to this figure, how can I make it connect 2 nodes? (such that its size automatically fits the space between)?

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri,calc,shapes.misc}

\begin{document}
\begin{tikzpicture}[rotate=45]
    \draw (-0.5,0)-- ++(+0.5,0);
    \coordinate (B) at (0,0);
    \draw ++(-0.5,0.15) -- ++(+0.5,0);
    \draw (-0.15,-0.15)-- (0,0);
    \draw ++(0,0.15)--+(-0.15,+0.15);
    \draw (0,0) .. controls (+0.075,+0.075) .. (0,0.15);
    \coordinate (A) at (-0.5,0.15);
    \node [strike out,draw,anchor=text] (X) at ++($ (A)!.5!(B) $) {};
    \end{tikzpicture}

\end{document}

A screenshot of the result:

enter image description here

As As you might observe, the striking out symbol remains as is.


Here is a before and after, for comparison:

enter image description here

  • 3
    A screenshot of the output you get would help people immediately understand the issue you're having. – jub0bs Aug 07 '14 at 17:04
  • 5
    \begin{tikzpicture}[rotate=45,transform shape]...\end{tikzpicture} – Gonzalo Medina Aug 07 '14 at 17:10
  • @GonzaloMedina: Thanks very much, indeed. Could you please help me with the other issue as well? I would like to make this figure as a 'connector' between two nodes. Cheers – Abhimanyu Arora Aug 07 '14 at 17:14
  • 3
    You seem to be asking two unrelated questions, here. On TeX.SX, we try to keep unrelated questions on separate pages. If you have multiple questions that are unrelated to one another, you should ask each in a separate TeX.SX "question". You'll stand a better chance of getting a satisfactory answer to each of your questions. – jub0bs Aug 07 '14 at 17:15

1 Answers1

5

As I mentioned in a comment, adding the transform shape option to the tikzpicture environment solves the rotation issue:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri,calc,shapes.misc}

\begin{document}
\begin{tikzpicture}[rotate=45,transform shape]
    \draw (-0.5,0)-- ++(+0.5,0);
    \coordinate (B) at (0,0);
    \draw ++(-0.5,0.15) -- ++(+0.5,0);
    \draw (-0.15,-0.15)-- (0,0);
    \draw ++(0,0.15)--+(-0.15,+0.15);
    \draw (0,0) .. controls (+0.075,+0.075) .. (0,0.15);
    \coordinate (A) at (-0.5,0.15);
    \node [strike out,draw,anchor=text] (X) at ++($ (A)!.5!(B) $) {};
    \end{tikzpicture}

\end{document}

enter image description here

Gonzalo Medina
  • 505,128
  • Many thanks indeed, accepted with great pleasure! Just a minor question, how can I ensure that a figure I make in Tikz (say the one above) lies between two specific nodes, please? (so that its size is automatically adjusted) – Abhimanyu Arora Aug 08 '14 at 13:47
  • 1
    @AbhimanyuArora Thanks you very much for accepting the answer! Regarding the other issue, I see that you've already opened a new question for this http://tex.stackexchange.com/questions/195355/how-to-connect-nodes-with-a-figure-created-in-tikz so perhaps someone will provide an answer there (I might have a look at it later). – Gonzalo Medina Aug 08 '14 at 18:14