如何校正不对称的 TikZ 图形?

如何校正不对称的 TikZ 图形?

我用 Ti 创建了一个图表Z. 问题是箭头的长度不一致,所以整个图形不对称。有办法纠正吗?

\documentclass{article}
\usepackage\[utf8\]{inputenc}
\usepackage{adjustbox}
\usepackage{tikz}
\begin{document}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{amsthm}
\usepackage\[svgnames\]{xcolor}
\usepackage{soul}
\usenavigationsymbolstemplate{}
\newcommand{\mathcolorbox}\[2\]{\colorbox{#1}{$\displaystyle #2$}}
\usepackage{amsmath}
\usepackage{bbm}
\usepackage{attrib} %use for quotes
\usepackage\[utf8x\]{inputenc}
\usepackage{lmodern,textcomp} %use for euro sign.
\usepackage{threeparttable}
\usepackage{siunitx} %align columns in reg table
\usepackage\[justification=centering\]{caption}
\usepackage{lmodern,textcomp} 
\usepackage{mathtools}%Euro sig
\usepackage\[backposition=title\]{beamerappendixnote}
\usepackage{comment}
\usepackage{subfig}
\usepackage{physics}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{mathdots}
\usepackage{yhmath}
\usepackage{cancel}
\usepackage{color}
\usepackage{siunitx}
\usepackage{array}
\usepackage{multirow}
\usepackage{amssymb}
\usepackage{gensymb}
\usepackage{tabularx}
\usepackage{extarrows}
\usepackage{booktabs}
\usetikzlibrary{fadings}
\usetikzlibrary{patterns}
\usetikzlibrary{shadows.blur}
\usetikzlibrary{shapes}
\usepackage{graphicx}
\usepackage{xcolor}
\usetikzlibrary{arrows.meta,
                calc,
                positioning,
                quotes,
                shapes}
\usepackage{changepage}



\bigskip
\bigskip
\bigskip
\bigskip
\bigskip



\begin{frame}
    \begin{itemize}


    \begin{tikzpicture}\[%x=0.5pt,y=0.5pt,%yscale=-1,
node distance = 2mm and 6mm,
  base/.style = {draw=blue, semithick, minimum width=3.3em, minimum height=3ex,
                 inner ysep=2mm, outer sep=1pt,   
                 execute at end node=\vphantom{g}
                 },  
   box/.style = {base, rounded corners},
    io/.style = {base, inner xsep=-2pt,
                 signal, signal to=west and east,
                 draw, semithick, minimum width=3em},
every edge/.style = {draw, -{Straight Barb\[scale=0.8\]}},
every edge quotes/.style = {auto,font=\footnotesize\linespread{0.84}\selectfont,
                            inner sep=2pt, align=center}
                        \]
%% nodes  
\node (n1) \[box\] {Politische Stimmung};
\node (n2)  \[box, below left=30mm of n1\]    {Ökonomische Lage};
\node (n3)  \[box, below=50mm of n1\]      {Wählerinnen};
\node (n4)  \[box,below right=30mm of n1\]             {Umfragewerte};

%% arrows 
\path   (n1.south)  edge \[sloped,anchor=center,"polit. Instrumente" 
                  \]    (n2.north)
        (n2.south)  edge \[sloped,anchor=center,"Indikatoren" 
                  \]    (n3.north)
        (n3.north)  edge \["Indiv. Wahlneigung",
                  sloped,anchor=center\]    (n4.south)
        (n4.north)  edge \["Reaktion der Parteien",
                  sloped,anchor=center
                  \]    (n1.south)
    \end{tikzpicture}
    
\end{itemize}

\end{frame}
    
    
\end{document}

在此处输入图片描述

答案1

  • 肯定显示的图像不是由提供的代码生成的!
  • 所提供的代码非常混乱,几乎每一行代码都有错误。
  • 此外,从某处复制的图像代码(对我来说相当熟悉)也被破坏了。
  • 对于您的问题,MWE(考虑@SebGlav 评论)可以是:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                fadings,
                patterns, positioning, 
                quotes,
                shadows.blur, shapes}

\begin{document}

    \begin{tikzpicture}[
node distance = 17mm and 13mm,  % <--- changed
  base/.style = {draw=blue, semithick, minimum width=3.3em, minimum height=3ex,
                 inner ysep=2mm, outer sep=1pt,
                 text width=9em, align=center,  % <--- new
                 execute at end node=\vphantom{g}
                 },
   box/.style = {base, rounded corners},
    io/.style = {base, inner xsep=-2pt,
                 signal, signal to=west and east,
                 draw, semithick, minimum width=3em},
every edge/.style = {draw, -{Straight Barb[scale=0.8]}},
every edge quotes/.style = {auto,font=\footnotesize\linespread{0.84}\selectfont,
                            inner sep=2pt, align=center, sloped}
                        ]
%% nodes
\node (n1)  [box]                       {Politische Stimmung};
\node (n2)  [box, below  left=of n1]    {Ökonomische Lage};
\node (n3)  [box, below right=of n2]    {Wählerinnen};
\node (n4)  [box, below right=of n1]    {Umfragewerte};
%% arrows
\path   (n1.260)    edge ["polit. Instrumente"]     (n2.north)
        (n2.south)  edge ["Indikatoren"]            (n3.100)
        (n3.80)     edge ["Indiv. Wahlneigung"]     (n4.south)
        (n4.north)  edge ["Reaktion der Parteien"]  (n1.280);
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容