# Trying to write the equation in one single line in block

I am trying to put an equation in a block in one single line. But I could not able to do that. HOw to do this. This is what I tried.

\documentclass{article}
\usepackage{tikz}

\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage{mathtools}

\begin{document}
\tikzstyle{block} = [rectangle, draw, fill=blue!20,
text width=9em, text centered, rounded corners,minimum width=30em, minimum height=5em,node distance=5em]
\tikzstyle{block2} = [rectangle, draw, fill=yellow!20,
text width=9em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']

\begin{tikzpicture}
\node [block] (gf) {\Large $EI_{zz}\,\frac{\partial ^4y\left(x,t\right)}{\partial x^4}+\rho A\frac{\partial ^2 y\left(x,t\right)}{\partial t^2}=-\sum_{j=1}^{m} k_{t,j}y(\zeta_{1,i})\delta(x-\zeta_{1,j})-\sum_{j=1}^{p}m_{j}\ddot{y}(\zeta_{2,j})\delta(x-\zeta_{2,j})+ \sum_{j=1}^{n}k_{r,s}y'(\zeta_{3,s})\delta(x-\zeta_{3,j})$ };
\end{tikzpicture}
\end{document}

• Off topic: you should not use \tikzstyle anymore. – JouleV Mar 20 at 7:55
• @JouleV should not is probably too strong. You can recommend (your personal taste that is shared with a lot of contributors on this site, I know, not me), but there is no reason to prohibit \tikzstyle. – Kpym Mar 20 at 8:50

If you require the equation to be set using \Large (for a 44% [!] linear increase in font size), the equation is just too long to fit on a single line.

The following solution uses a \multline* environment, and manages to place the equation on two rows. Observe that I changed text width=9em to text width=\textwidth. I also changed y' to \dot{y}; if you prefer the "prime" notation instead, you should probably change \ddot{y} to y''.

\documentclass{article}
\usepackage{tikz}
\usepackage{geometry} % set page parameters appropriately
\usepackage{amssymb,mathtools}
\DeclareMathOperator{\E}{E} % expectations operator

%% "\tikzstyle{block} = [...]}" is deprecated
%\tikzstyle{block} = [rectangle, draw, fill=blue!20,
%    text width=\textwidth, text centered, rounded corners]

%% Per @marmot's comment, use "\tikzset{block/.style={...}}" instead:
\tikzset{block/.style={rectangle, draw, fill=blue!20,
text width=\textwidth, text centered, rounded corners}}

\begin{document}

\noindent
\begin{tikzpicture}
\node [block] (gf) {\Large
\begin{multline*}
\E I_{zz}\,\frac{\partial^4 y(x,t)}{\partial x^4}
+\rho A\,\frac{\partial^2 y(x,t)}{\partial t^2}
=-\sum_{j=1}^{m} k_{t,j}y(\zeta_{1,i})\delta(x-\zeta_{1,j})\\
-\sum_{j=1}^{p}m_{j}\ddot{y}(\zeta_{2,j})\delta(x-\zeta_{2,j})
+ \sum_{j=1}^{n}k_{r,s}\dot{y}(\zeta_{3,s})\delta(x-\zeta_{3,j})%\$
\end{multline*}
};
\end{tikzpicture}
\end{document}

• Please note that \tikzstyle is deprecated. Use \tikzset{block/.style={rectangle, draw, fill=blue!20, text width=\textwidth, text centered, rounded corners}} instead. line is not used in the MWE. – marmot Mar 20 at 13:46
• @marmot - Many thanks for this; I've updated code accordingly. Out of curiosity: Would you know why the shaded block is currently slightly wider than \textwidth, even though the parameter text width=\textwidth is set? – Mico Mar 21 at 5:23