2

I am trying to flip a node without flipping text inside. I tried using \rotatebox, but it won't help in flipping. Is there any way to do so? I have attached minimal code example below.

\begin{tikzpicture}
\node [draw,shape=trapezium,trapezium left angle=40,trapezium right angle=-40,minimum height=1in,minimum width=1in,trapezium stretches=true,xscale=-1] at (5.38in,-5.38in) { text here};
\end{tikzpicture}

output:

After flipping

  • give angles as -40 and 40 instead ? – percusse Dec 29 '17 at 14:25
  • That is fine for this example but there are some shapes for which this won't be possible, so flipping is the only option. And I don't want text to get rotated with that. How to achieve it? – charles bell Dec 29 '17 at 14:29
  • Create the flipped node with \phantom text to fix its size and place the non flipped text (with another node) on its center – Ignasi Dec 29 '17 at 15:30
3

Transformations don't apply on the nodes, unless you want it like you do. To solve this problem, you just have to build a path on which you will place two nodes, the first one having the width of the text but made invisible, the second one the text itself.

\begin{tikzpicture}
\path (5.38in,-5.38in) node [draw,shape=trapezium,trapezium left angle=40,
 trapezium right angle=-40,minimum height=1in,minimum width=1in,
 trapezium stretches=true,xscale=-1]{\phantom{text here}}
 node {text here};
\end{tikzpicture}

output:

flip-node

| improve this answer | |
1

I had a similar problem with tikzduck. It's enough to reflect the node text (with \reflectbox).

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes}

\begin{document}
\begin{tikzpicture} 
\node [
    draw,
    shape=trapezium,
    trapezium left angle=40,
    trapezium right angle=-40,
    minimum height=1in,
    minimum width=1in,
    trapezium stretches=true,
    xscale=-1
    ] at (5.38in,-5.38in) 
    {\reflectbox{text here}}; 
\end{tikzpicture}

\end{document}

enter image description here

| improve this answer | |

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.