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.



\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']

\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})$ };   
  • 1
    Off topic: you should not use \tikzstyle anymore.
    – user156344
    Mar 20, 2019 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, 2019 at 8:50

1 Answer 1


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''.

enter image description here

\usepackage{geometry} % set page parameters appropriately
\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}}


\node [block] (gf) {\Large 
\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}^{n}k_{r,s}\dot{y}(\zeta_{3,s})\delta(x-\zeta_{3,j})%$
  • 1
    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.
    – user121799
    Mar 20, 2019 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, 2019 at 5:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .