3

I am trying to put vertically rotated text inside a rectangle and I have not been able to get it centred vertically. Here is my minimal code and what I get. Any help would be appreciated.

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

\begin{document}
\begin{tikzpicture}

\coordinate (dm1) at (0,3);
\coordinate (dm2) at (0,-3);
\node[rectangle,draw,minimum width=2cm,align=center] [fit = (dm1) (dm2)] (bx4) {\rotatebox{90}{\large Storage Advisor}};

\end{tikzpicture}
\end{document}]

1

  • 1
    Use rotate=90 on the node instead of rotatebox – percusse Aug 21 '14 at 20:29
  • Unfortunately that doesn't work. That rotates the entire rectangle which I don't want (it is already a vertical rectangle) -- all I want is to rotate the text, which happens, but I also want it centred, which is not happening. – ozsu Aug 21 '14 at 22:22
5

Draw the node separately again.

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

\begin{document}
\begin{tikzpicture}

\coordinate (dm1) at (0,3);
\coordinate (dm2) at (0,-3);
\node[rectangle,draw,minimum width=2cm] [fit = (dm1) (dm2)] (bx4) {};
\node[align=center,font=\large,rotate=90] at (bx4.center) {Storage Advisor};

\end{tikzpicture}
\end{document}

enter image description here

  • Perfect, thanks very much. That is straightforward, but I failed to see it. – ozsu Aug 22 '14 at 0:27

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.