将整个文档旋转 90 度

将整个文档旋转 90 度

以下代码如下图所示:

\documentclass[tikz,border=2mm]{standalone} 
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}[block/.style={rounded corners, minimum width=3cm, minimum height=2cm, draw}]

\node[block] (1) {This message stretches the box out quite a lot.};
\node[block, above right=-.5 and 2 of 1] (3) {3};
\node[block, above right=-.5 and 2 of 3] (5) {5};
\node[block, below=of 5] (6) {6};
\node[block, below left=-.5 and 2 of 6] (4) {4};
\node[block, below left=-.5 and 2 of 4] (2) {2};
\node[block, below=of 6] (7) {7}; 
\begin{scope}[->, shorten >=1mm, shorten <=1mm]
\draw (1) to[out=0,in=180] (3);
\draw (3) to[out=0,in=180] (5);
\draw (3) -- (4);
\draw (2) to[out=0,in=180] (4);
\draw (4) to[out=0,in=180] ([yshift=5mm]5.south west);
\draw (2) to[out=-30,in=230] (6);
\draw (6) -- (7);
\draw (5) to[out=0,in=0] (7);
\end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述

(感谢 Ignasi该代码

我有两个问题:

  • 我怎样才能将整个东西翻转 90 度?我希望箭头向下流动。
  • 我怎样才能将消息分成两行,这样它就不会将第一个块拉伸太多?我尝试添加 \,但没有任何效果。

答案1

这是一个解决方案

\documentclass[border=2mm]{standalone} 
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
\rotatebox{270}{%
\begin{tikzpicture}[block/.style={rounded corners, minimum width=3cm, minimum height=2cm, draw}]
\node[block, text width=3cm] (1) {This message stretches the box out quite a lot.};
\node[block, above right=-.5 and 2 of 1] (3) {3};
\node[block, above right=-.5 and 2 of 3] (5) {5};
\node[block, below=of 5] (6) {6};
\node[block, below left=-.5 and 2 of 6] (4) {4};
\node[block, below left=-.5 and 2 of 4] (2) {2};
\node[block, below=of 6] (7) {7}; 
\begin{scope}[->, shorten >=1mm, shorten <=1mm]
\draw (1) to[out=0,in=180] (3);
\draw (3) to[out=0,in=180] (5);
\draw (3) -- (4);
\draw (2) to[out=0,in=180] (4);
\draw (4) to[out=0,in=180] ([yshift=5mm]5.south west);
\draw (2) to[out=-30,in=230] (6);
\draw (6) -- (7);
\draw (5) to[out=0,in=0] (7);
\end{scope}
\end{tikzpicture}}
\end{document}

第二种解决方案

\documentclass[border=2mm]{standalone} 
\usepackage{tikz}
\usepackage{rotating}
\usetikzlibrary{positioning}

\begin{document}
\begin{turn}{270}
\begin{tikzpicture}[block/.style={rounded corners, minimum width=3cm, minimum height=2cm, draw}]
\node[block, text width=3cm] (1) {This message stretches the box out quite a lot.};
\node[block, above right=-.5 and 2 of 1] (3) {3};
\node[block, above right=-.5 and 2 of 3] (5) {5};
\node[block, below=of 5] (6) {6};
\node[block, below left=-.5 and 2 of 6] (4) {4};
\node[block, below left=-.5 and 2 of 4] (2) {2};
\node[block, below=of 6] (7) {7}; 
\begin{scope}[->, shorten >=1mm, shorten <=1mm]
\draw (1) to[out=0,in=180] (3);
\draw (3) to[out=0,in=180] (5);
\draw (3) -- (4);
\draw (2) to[out=0,in=180] (4);
\draw (4) to[out=0,in=180] ([yshift=5mm]5.south west);
\draw (2) to[out=-30,in=230] (6);
\draw (6) -- (7);
\draw (5) to[out=0,in=0] (7);
\end{scope}
\end{tikzpicture}
\end{turn}
\end{document}

相关内容