方程数组超出右边距

方程数组超出右边距

eqnarray使用 Latex 编写方程式,但有些行超出了右边距,如何解决?

这是我的代码:

\begin{eqnarray}    
    k_1&=&hf(t_i, y_i)=hf_i \label{$k_1$ RK-4}\\
    k_2&=&hf(t_i+p_1h, y_i+q_11_k1)\nonumber\\
       &=&h(f_i+p_1hf_t+q_{11}k_1f_y)\nonumber\\
       &=&h(f_i+p_1hf_t+q_{11}hf_if_y)\\    
    k_3&=&hf(t_i+p_2h,y_i+q_21k_1+q_22k_2)\nonumber\\
       &=&h(f_i+p_2hf_t+q_21k_1f_y+q_22k_2f_y)\nonumber\\
       &=&h(f_i+p_2hf_t+q_{21}hf_if_y+q_{22} h(f_i+p_1hf_t+q_{11}hf_if_y)f_y)\nonumber\\
       &=&h(f_i+p_2hf_t+q_{21}hf_if_y+q_{22}hf_if_y +q_22h^2p_1f_tf_y+q_{11}q{22}h^2f_i(f_y)^2)\\
    k_4&=&hf(t_i+p_3h, y_i+q_31k_1+q_32k_2+q_33k_3)\nonumber\\
       &=&h(f_i+p_3hf_t+q_{31}k_1f_y+q_{32}k_2f_y+q_{33}k_3f_y)\nonumber\\
       &=&h(f_i+p_3hf_t+q_{31}hf_if_y+q_{32} h(f_i+p_1hf_t+q_{11}hf_if_y)f_y +q_{33}h(f_i+p_2hf_t+q_{21}hf_if_y+q_{22}hf_if_y+q_{22}h^2p_1f_tf_y+q_{21}q_{22}h^2f_i(f_y)^2)f_y)\nonumber\\
       &=&h(f_i+p_3hf_t+q_{31}hf_if_y+q_{32}hf_if_y +p_1q_{32}h^2f_tf_y +q_{11}q_{32}h^2f_i(f_y)^2+q_{33}hf_if_y+p_2q_{33}h^2f_tf_y+q_{21}q_{33}h^2f_i(f_y)^2+q_{22}q_{33}h^2f_i(f_y)^2+q_{22}q_{33}p_1h^3f_t(f_y)^2+q_{11}q_{22}q_{33}h^3f_i(f_y)^3)\\
\end{eqnarray}

结果如下:

在此处输入图片描述

答案1

eqnarray除了出于任何原因不使用的标准建议之外,请参阅eqnarray 与 align,我建议使用split它来将每个块分成一个单元。

通过该tbtags选项,我们可以确保附加在等式中的数字split被添加在底部(当等式数字在右边时)或顶部。

\documentclass{article}
\usepackage[tbtags]{amsmath} % for math

\begin{document}
\begin{align}    
k_1 &= hf(t_i, y_i)=hf_i \label{k1_RK_4}
\\
\begin{split}
k_2 &= hf(t_i+p_1h, y_i+q_{11}k_1) \\
    &= h(f_i+p_1hf_t+q_{11}k_1f_y) \\
    &= h(f_i+p_1hf_t+q_{11}hf_if_y)
\end{split}
\\
\begin{split}
k_3 &= hf(t_i+p_2h, y_i+q_{21}k_1+q_{22}k_2) \\
    &= h(f_i+p_2hf_t+q_{21}k_1f_y+q_{22}k_2f_y) \\
    &= h[f_i+p_2hf_t+q_{21}hf_if_y+q_{22}h(f_i+p_1hf_t+q_{11}hf_if_y)f_y] \\    
    &= h[f_i+p_2hf_t+q_{21}hf_if_y+q_{22}hf_if_y+q_{22}h^2p_1f_tf_y+
       q_{11}q_{22}h^2\!f_i(f_y)^2]
\end{split}
\\
\begin{split}
k_4 &= hf(t_i+p_3h, y_i+q_{31}k_1+q_{32}k_2+q_{33}k_3) \\
    &= h(f_i+p_3hf_t+q_{31}k_1f_y+q_{32}k_2f_y+q_{33}k_3f_y) \\
    &= h\{f_i+p_3hf_t+q_{31}hf_if_y+q_{32}h(f_i+p_1hf_t+q_{11}hf_if_y)f_y \\
    &\qquad +q_{33}h[f_i+p_2hf_t+q_{21}hf_if_y+q_{22}hf_if_y+q_{22}h^2p_1f_tf_y \\
    &\qquad +q_{21}q_{22}h^2\!f_i(f_y)^2]f_y\} \\
    &= h\{f_i+p_3hf_t+q_{31}hf_if_y+q_{32}hf_if_y+p_1q_{32}h^2\!f_tf_y+
       q_{11}q_{32}h^2\!f_i(f_y)^2 \\
    &\qquad +q_{33}hf_if_y+p_2q_{33}h^2\!f_tf_y+q_{21}q_{33}h^2\!f_i(f_y)^2+
     q_{22}q_{33}h^2\!f_i(f_y)^2 \\
    &\qquad+q_{22}q_{33}p_1h^3\!f_t(f_y)^2+q_{11}q_{22}q_{33}h^3\!f_i(f_y)^3\}
\end{split}
\end{align}

\end{document}

在此处输入图片描述

答案2

除了在最后两行手动插入一些换行符之外,还需要根据需要在术语、、等中添加花括号来修复一些符号q_11(应该是,对吧?)。当括号结构嵌套时,如果除了圆括号之外还使用方括号和花括号q_21,则有助于读者检测括号的顺序。q_22_k1k_1

你绝对应该不是使用严重弃用的eqnarray环境。请使用align软件包提供的环境amsmath

在此处输入图片描述

\documentclass{article}
\usepackage{amsmath} % for 'align' environment and '\notag' macro

\begin{document}
\begin{align}    
    k_1 &= hf(t_i, y_i)=hf_i \label{k1_RK_4}\\
    k_2 &= hf(t_i+p_1h, y_i+q_{11}k_1) \notag\\
     &= h(f_i+p_1hf_t+q_{11}k_1f_y) \notag\\
     &= h(f_i+p_1hf_t+q_{11}hf_if_y)\\   
    k_3 &= hf(t_i+p_2h, y_i+q_{21}k_1+q_{22}k_2)  \notag\\
     &= h(f_i+p_2hf_t+q_{21}k_1f_y+q_{22}k_2f_y) \notag\\
     &= h[f_i+p_2hf_t+q_{21}hf_if_y+q_{22}h(f_i+p_1hf_t+q_{11}hf_if_y)f_y] \notag\\    
     &= h[f_i+p_2hf_t+q_{21}hf_if_y+q_{22}hf_if_y+q_{22}h^2p_1f_tf_y+q_{11}q_{22}h^2\!f_i(f_y)^2]\\
    k_4 &= hf(t_i+p_3h, y_i+q_{31}k_1+q_{32}k_2+q_{33}k_3) \notag\\
     &= h(f_i+p_3hf_t+q_{31}k_1f_y+q_{32}k_2f_y+q_{33}k_3f_y) \notag\\
     &= h\{f_i+p_3hf_t+q_{31}hf_if_y+q_{32}h(f_i+p_1hf_t+q_{11}hf_if_y)f_y \notag\\
     &\qquad +q_{33}h[f_i+p_2hf_t+q_{21}hf_if_y+q_{22}hf_if_y+q_{22}h^2p_1f_tf_y \notag\\
     &\qquad +q_{21}q_{22}h^2\!f_i(f_y)^2]f_y\} \notag\\   
     &= h\{f_i+p_3hf_t+q_{31}hf_if_y+q_{32}hf_if_y+p_1q_{32}h^2\!f_tf_y+q_{11}q_{32}h^2\!f_i(f_y)^2 \notag\\
     &\qquad +q_{33}hf_if_y+p_2q_{33}h^2\!f_tf_y+q_{21}q_{33}h^2\!f_i(f_y)^2+q_{22}q_{33}h^2\!f_i(f_y)^2 \notag\\
     &\qquad+q_{22}q_{33}p_1h^3\!f_t(f_y)^2+q_{11}q_{22}q_{33}h^3\!f_i(f_y)^3\}
\end{align}
\end{document}

相关内容