尝试在块中用一行写出方程式

尝试在块中用一行写出方程式

我正在尝试将方程式放在一行中。但我做不到。如何做到这一点。这是我尝试过的。

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,shadows,arrows}

\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}

答案1

如果您需要使用(字体大小线性增加 44% [!])来设置方程式\Large,则方程式太长,无法放在一行中。

以下解决方案使用\multline*环境,并设法将方程放在两行上。请注意,我将其更改text width=9emtext width=\textwidth。我还将其更改y'\dot{y};如果您更喜欢“素数”符号,则可能应该将其更改\ddot{y}y''

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,shadows,arrows}
\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}

相关内容