在寻找类似的东西之后这里并搜索了网站。我还没有找到有用的方法(可能是我漏掉了一些重要的东西)。
我想要一种自动化的方法来告知tikz
最终的尺寸tikzpicture
。
我想画一些东西,我想tikz
自动计算比例以显示最大可能值。类似的东西\begin{tikzpicture}[scale to width = \textwidth]
会缩放图形,因此最终的tikzpicture
宽度为\textwidth
。很酷的事情是制作类似的东西scale to height = …
,两种形式都保持原始比例tikzpicture
。但如果两者同时发布,应该有一种方法可以固定最终尺寸。
我希望它在tikzpicture
(而不是scalebox
或resizebox
)内工作,以便生成的图像具有正确的字体大小和线宽。
例子:
\documentclass{scrartcl}
\usepackage{tikz}
…% Some magic code
\begin{document}
\begin{tikzpicture}
\draw (0,0) rectangle (1,1);
\draw (0.5,0.5) node {Center};
\end{tikzpicture}% This should be a square of 1cm x 1cm.
\begin{tikzpicture}[scale to with = 10cm]
\draw (0,0) rectangle (1,1);
\draw (0.5,0.5) node {Center};
\end{tikzpicture}% This should be a square of 10cm x 10cm with the word in correct size
\begin{tikzpicture}[scale to height = 8cm]
\draw (0,0) rectangle (1,1);
\draw (0.5,0.5) node {Center};
\end{tikzpicture}% This should be a square of 8cm x 8cm with the word in a correct size
\begin{tikzpicture}[scale to with = 10cm, scale to height = 6cm]
\draw (0,0) rectangle (1,1);
\draw (0.5,0.5) node {Center};
\end{tikzpicture}% This should be a rectangle of 10cm x 6cm with the word in a correct size/shape
\end{document}