缩放Tikz图片而不重叠文本

缩放Tikz图片而不重叠文本

我有一个与以下问题类似的问题:TikZ 图片与文字重叠 我尝试了 Jake 提供的解决方案。但这导致我的图片无法按预期调整大小(缩放)。

无论我给Set scale=0.4Set scale=0.8图片的大小保持不变

这是我使用的代码:

\begin{figure}[ht!]
\centering
\begin{tikzpicture}[Set scale=0.4, every node/.append style={transform shape},]
% STYLES
\tikzstyle{every node}=[rectangle,rounded corners, minimum width=100pt,
    align=center,node distance=3cm,fill=black!10,inner sep=5pt,text width=3cm,minimum height=1.75cm,>=stealth,text badly centered]
% Draw forces
\node [force, above of=rivalry] (top) {Firm strategy, structure and rivalry};
\node [force, left=1cm of rivalry] (left) {Factor conditions};
\node [force, right=1cm of rivalry] (right) {Demand Conditions};
\node [force, below of=rivalry] (bottom) {Related and Supporting industries};
%%%%%%%%%%%%%%%%
% Draw the links between forces
\path[<->,thick] 
(left) edge (right)
(left) edge (top)
(left) edge (bottom)
(top) edge (right)
(bottom) edge (right);
\path[<->,thick] 
(bottom) edge (top);
\end{tikzpicture}
\caption{Porter's Diamond source:~\cite{Porter:1980}}%
\label{fig:diamond} 
\end{figure}

在此处输入图片描述

答案1

该选项是scale并且transform shape可以*作为直接选项给出{tikzpicture}

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning}


\begin{document}
\begin{tikzpicture}[%
    scale=0.8,transform shape,
    % STYLES
    force/.style={%
        rectangle,rounded corners, minimum width=100pt,
        align=center,node distance=3cm,fill=black!10,inner sep=5pt,
        text width=3cm,minimum height=1.75cm,text badly centered
    },
    >=stealth,% had no effect in a node style ...
]
% Draw forces
\node (rivalry) {};% was missing!!
\node [force, above of=rivalry] (top) {Firm strategy, structure and rivalry};
\node [force, left=1cm of rivalry] (left) {Factor conditions};
\node [force, right=1cm of rivalry] (right) {Demand Conditions};
\node [force, below of=rivalry] (bottom) {Related and Supporting industries};
% Draw the links between forces
\path[<->,thick]
    (left) edge (right)
    (left) edge (top)
    (left) edge (bottom)
    (top) edge (right)
    (bottom) edge (right);
\path[<->,thick] (bottom) edge (top);
\end{tikzpicture}
\end{document}

我必须添加一个节点,(rivalry)因为您的示例中缺少该节点。请使用\tikzset(或{tikzpicture}像我一样使用选项)和/.style附录。\tikzstyle已过时。此外,>=stealth在节点样式定义中不会产生影响,因此我将其移至…


*我错了,Qrrbrbirlbel 对你的问题的评论提到了真正的问题:transform shape也可以设置为every node但在你的例子中被覆盖了。

相关内容