You can use \hfill
between the letter and the equation to get simultaneous left and right adjustment. This only works if you specify the text width
explicitly, though (as you've done in your code).
For decreasing the size of the circle, you'll have to decrease the inner sep
(which is set to 2pt
by default). If you want the node to be smaller still, you'll have to choose a smaller font size (using font=\small
, for instance), or scale the node using scale=<value>
.
Here's a minimal example (this is also the preferred form of posting code like yours in a question, since it saves people the trouble of guessing the required libraries/packages, and makes sure that the code is actually complete):
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\tikzstyle{int}=[draw, fill=blue!20, minimum size=2em, text width=2.5cm]
\tikzstyle{sum}=[draw, fill=blue!20, shape=circle, inner sep=1pt, node distance=2.5cm]
\begin{figure}[htbp]
\centering
\begin{tikzpicture}[node distance=1.5cm,auto,>=latex']
\node [int] (kp) {P\hfill$k_p e(t)$};
\node [int] (ki) [below of=kp] {I\hfill$k_i \int{e(t)dt}$};
\node [int] (kd) [below of=ki] {D\hfill$k_d \frac{e(t)}{dt}$};
\node [sum] (sum) [right of=ki] {$\sum$};
\node [coordinate] (joint1) [left of=ki, node distance=2cm]{};
\node [coordinate] (begin) [left of=joint1, node distance=2cm]{};
\node [coordinate] (end) [right of=sum, node distance=2cm]{};
\draw[-] (begin) -- node {$e(t)$} (joint1);
\draw[->] (joint1) |- (kp.west);
\draw[->] (joint1) -- (ki);
\draw[->] (joint1) |- (kd);
\draw[->] (kp.east) -| node [pos=0.95] {$+$} (sum.north);
\draw[->] (ki.east) -- node [pos=0.8] {$+$} (sum.west);
\draw[->] (kd.east) -| node [pos=0.95] {$+$} (sum.south);
\draw[->] (sum.east) -- (end);
\end{tikzpicture}
\end{figure}
\end{document}
I don't really get the question so I hope this is what you wanted. If you include a full document (such that we copy paste and see the problem on our systems) things are much more easier.
Here, you can change the default setting within a scope but your block
style had a node distance
which was resetting every time it is issued. I've made it 2mm such that we can see the difference easier.
\documentclass[tikz]{standalone}
\usetikzlibrary{arrows,shapes.geometric,positioning}
\begin{document}
\begin{tikzpicture}[decision/.style={diamond, draw, text width=4.5em, text badly centered, node distance=3.5cm, inner sep=0pt},
block/.style ={rectangle, draw, text width=6em, text centered, rounded corners, minimum height=4em, minimum height=2em},
cloud/.style ={draw, ellipse, minimum height=2em},
line/.style ={draw,-latex'},
node distance = 1cm,
auto]
\node [block] (1st) {1st};
\node [block, right= of 1st] (2nd1) {2nd1};
\begin{scope}[node distance=2mm and 10mm]%Here we change it for everything inside this scope
\node [block, above= of 2nd1] (2nd2) {2nd2};
\node [block, below= of 2nd1] (2nd3) {2nd3};
\node [block, right= of 2nd1] (3rd1) {3rd1};
\node [block, above= of 3rd1] (3rd2) {3rd2};
\node [block, above= of 3rd2] (3rd3) {3rd3};
\end{scope}
\node [block, below= of 3rd1] (3rd4) {3rd4};
\node [block, below= of 3rd4] (3rd5) {3rd5};
\path [line] (1st) -- (2nd1);
\path [line] (2nd1) -- (2nd2);
\path [line] (2nd1) -- (2nd3);
\path [line] (2nd2) -- (3rd3);
\path [line] (2nd1) -- (3rd1);
\path [line] (1st) -- (2nd1);
\end{tikzpicture}
\end{document}
Best Answer
You need to specify a minimum width for each of the nodes so that they are all the same size. If this is something you will be doing a lot, it's easiest to create a style for this, as I've done in the example below:
This solution has a certain advantage over using the
every node/.style
since if you have other nodes in the drawing you may not want them all to be of the same size.