# Manually setting the size of a node and forcing contents to 'fill' node

I have an expression "a = function(b)" inside a node. But "a =" and "function(b)" appear on separate lines. I can force the node to be wider, but this doesn't change how the writing inside is laid out. How can I fix this?

Thanks

\documentclass[12pt article]{article}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}

\begin{document}

\begin{tikzpicture}[node distance = 2cm, auto]

\tikzstyle{block} = [rectangle, draw, fill=blue!20,
text width=5em, text centered, rounded corners, minimum height=4em]

\node [block] (A) {Some writing, a = function(b)};

\end{tikzpicture}

\end{document}

-
Please post a short example of the code that's causing you trouble. –  Count Zero Jan 7 '12 at 23:24
Did you use the text width option by any chance? Nevermind, I see that you do. It is simply due to the fact that your defined width is too narrow for it. –  percusse Jan 7 '12 at 23:35
The width of the text block is defined by text width, so even if you increase the size of the node, that won't change the text. Can't you set text width to a larger value, e.g. 8em? Another option is perhaps to not set the text width, and define the line breaks manually, with \\. (Edit: Too late ...) –  Torbjørn T. Jan 7 '12 at 23:38
as already said it is the text width setting. so forcing it will result in a bad box warning. –  someonr Jan 7 '12 at 23:54

If it's in math mode, you solve it by adding curly braces, such as

${a = function(b)}$


If it's in text mode, though I would use math mode, you could use \mbox:

\mbox{a = function(b)}


Both prevent the line break, also in TikZ nodes.

-
But I think there shouldn't be any reason for tikz to break the line if there is enough space (Matt said "I can force the node to be wider"). I think there might be some problem with his code... –  someonr Jan 7 '12 at 23:32
Thanks, your first suggestion sorted my problem. –  Matt Jan 7 '12 at 23:34