1

I have this problem with my Tikz figure:

enter image description here

As you can see, the different labels stay very close together and even get inside some blocks, as you can correct that to try to make the whole set as equidistant as possible

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows,arrows.meta,positioning,quotes}
\newcommand\ppbb{path picture bounding box}

\tikzstyle{block} = [draw, rectangle, minimum height=3em, minimum width=4em]
\tikzstyle{sum} = [draw, circle, node distance=1cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]
\begin{document}

    \begin{tikzpicture}[auto, node distance=2cm,>=latex']
        \node [input, name=input] {};
        \node [sum, right of=input] (sum) {};
        \node [block, right of=sum] (controller) {$\frac{1}{Ls+R}$};
        \node [block, right of=controller] (kt) {$k_t$};
        \node [block, right of=kt, node distance=2cm] (system) {$sist$};

        \node [output, right of=system] (output) {};
        \node [block, below of=kt] (measurements) {$k_e$};

        \draw [draw,->] (input) -- node {$V(s)$} (sum);
        \draw [->] (sum) -- node {} (controller);
        \draw [->] (controller) -- node {$I(s)$} (kt);
        \draw [->] (kt) -- node[name=u] {$T(s)$} (system);
        \draw [->] (system) -- node [name=y] {$\Omega(s)$}(output);
        \draw [->] (y) |- (measurements);
        \draw [->] (measurements) -| node[pos=1.00] {$-$} 
        node [near end] {$E(s)$} (sum);
    \end{tikzpicture}

    
\end{document}


  [1]: https://i.stack.imgur.com/RhVmn.png
1

You load the positioning package, but don't use its facilities.

  • Instead of right of=xxx, write right=of xxx, and likewise the rest.

  • Instead of right=of sum, write right=of input.

Now the boxes are equally and symmetrically spaced. For additional adjustements,

  • change node distance for global changes.

  • use right=15mm of xxx for individual changes.

  • If needed, there are also xshift=... and yshift=....

enter image description here

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows,arrows.meta,positioning,quotes}
\newcommand\ppbb{path picture bounding box}

\tikzstyle{block} = [draw, rectangle, minimum height=3em, minimum width=4em]
\tikzstyle{sum} = [draw, circle, node distance=1cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]
\begin{document}

    \begin{tikzpicture}[auto, node distance=2cm,>=latex']
        \node [input, name=input] {};
        \node [sum, right=of input] (sum) {};
        \node [block, right=of input] (controller) {$\frac{1}{Ls+R}$};
        \node [block, right=of controller] (kt) {$k_t$};
        \node [block, right=of kt] (system) {$sist$};

        \node [output, right=of system] (output) {};
        \node [block, below=of kt] (measurements) {$k_e$};

        \draw [draw,->] (input) -- node {$V(s)$} (sum);
        \draw [->] (sum) -- node {} (controller);
        \draw [->] (controller) -- node {$I(s)$} (kt);
        \draw [->] (kt) -- node[name=u] {$T(s)$} (system);
        \draw [->] (system) -- node [name=y] {$\Omega(s)$}(output);
        \draw [->] (y) |- (measurements);
        \draw [->] (measurements) -| node[pos=1.00] {$-$} 
        node [near end] {$E(s)$} (sum);
    \end{tikzpicture}
  
\end{document}
0

With se of the calc and chains libraries for positioning of diagram nodes is possible to make code for control diagram significant shorter:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta,
                calc, chains,
                positioning,
                quotes}
\usepackage{amsmath}

\begin{document}
    \begin{tikzpicture}[
node distance = 6mm and 12mm,
  start chain = going right,
%
  dot/.style = {circle, fill, inner sep=1pt, outer sep=0pt,
                node contents={}},
  box/.style = {draw, minimum height=2em, minimum width=3em},
  sum/.style = {circle, draw, minimum size=6mm, inner sep=0pt,
                 node contents={$+$}},
  arr/.style = {-Stealth}
                        ]
% nodes in main branch organised in chain
    \begin{scope}[nodes={on chain, join=by arr}]
\coordinate (in) ;
\node (sum)     [sum];
\node (cntrl)   [box]   {$\dfrac{1}{Ls+R}$};
\node (kt)      [box]   {$k_t$};
\node (sys)     [box]   {\emph{system}};
\coordinate (out);
    \end{scope}
\node (dot)     [dot,
                 at={($(sys.east)!0.5!(out)$)},
                 label=above:$\Omega(s)$];
% feedback node
\node (fb)      [box, below=of kt]  {$k_e$};
% connections not consider in "join" macro
\draw[arr]  (dot) |- (fb)
            (fb)  -| (sum) node[pos=0.75, left] {$E(s)$}
                           node[pos=0.98, left] {$-$};
% labels as quotes on nodes connections
\path   (in)    to["$V(s)$"]    (sum)       
        (cntrl) to["$I(s)$"]    (kt) 
        (kt)    to["$T(s)$"]    (sys);
    \end{tikzpicture}
\end{document}

enter image description here

Note:

  • In chains is considered positioning library syntax, so with node distance=6mm and 12mmm is determined vertical distance between nodes (in main and feedback branch) and horizontal distance between nodes in main branch.
  • styles of image elements are determined as options of tikzpicture. They can be collected in tikzset for example in preamble:
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta,
                calc, chains,
                positioning,
                quotes}
\usepackage{amsmath}
 \tikzset{
  dot/.style = {circle, fill, inner sep=1pt, outer sep=0pt,
                node contents={}},
  box/.style = {draw, minimum height=2em, minimum width=3em},
  sum/.style = {circle, draw, minimum size=6mm, inner sep=0pt,
                 node contents={$+$}},
  arr/.style = {-Stealth}
        }
ment}
    \begin{tikzpicture}[
node distance = 6mm and 12mm,
  start chain = going right,
                        ]
% nodes in main branch
...

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.