下列等式的最佳书写方式是什么:
\begin{flalign}
\begin{aligned}
&\qquad\qquad\frac{\partial^2 \ell}{\partial \bm{\phi}\partial\bm{\phi}'}=\\
&\sum_{i=1}^{N-N^*} \Bigg(\bigg[\sum_{j=2}^{d_i-1} -\;\tfrac{\bm{P}_{ij}'\bm{P}_{ij} (1-\bm{P}_{ij})'}{(1-\bm{P}_{ij})'(1-\bm{P}_{ij})+\bm{P}_{ij}'\bm{P}_{ij}}\mathbf{\tilde{Y}}_j \mathbf{\tilde{Y}}'_j + \tfrac{\bm{P}_{id_i}'(1-\bm{P}_{id_i})'(1-\bm{P}_{id_i})}{(1-\bm{P}_{id_i})'(1-\bm{P}_{id_i})+\bm{P}_{id_i}'\bm{P}_{id_i}}
\mathbf{\tilde{Y}}_{d_i} \mathbf{\tilde{Y}}'_{d_i}\bigg]\\
&-\bigg[\sum_{j=2}^{d_i-1} \tfrac{\bm{P}_{ij}}{(1-\bm{P}_{ij})'}
\mathbf{\tilde{Y}}_j \bm{P}_{ij}(1-\bm{P}_{ij}) \mathbf{\tilde{Y}}'_j+\tfrac{(1-\bm{P}_{id_i})}{\bm{P}'_{id_i}}
\mathbf{\tilde{Y}}_{d_i} \bm{P}_{id_i}(1-\bm{P}_{id_i}) \mathbf{\tilde{Y}}'_{d_i} \bigg]\Bigg)\\
&-\sum_{i=1}^{N^*} \sum_{j=2}^{n_i}\bigg[\tfrac{\bm{P}_{ij}'\bm{P}_{ij} (1-\bm{P}_{ij})'}{(1-\bm{P}_{ij})'(1-\bm{P}_{ij})+\bm{P}_{ij}'\bm{P}_{ij}}\mathbf{\tilde{Y}}_j \mathbf{\tilde{Y}}'_j + \tfrac{\bm{P}_{ij}}{(1-\bm{P}_{ij})'}
\mathbf{\tilde{Y}}_j \bm{P}_{ij}(1-\bm{P}_{ij}) \mathbf{\tilde{Y}}'_j\bigg]
\end{aligned}
&&
\end{flalign}
下面是我按照上面的代码编写的图像
我也尝试使用,multiline
但也没有得到很好的效果。
我使用更改代码footnotesize
,新代码是
{\footnotesize
\begin{flalign} \label{18}
\begin{aligned}
\frac{\partial^2 \ell}{\partial \bm{\phi}\partial\bm{\phi}'}&=\sum_{i=1}^{N-N^*} \Bigg(\bigg[\sum_{j=2}^{d_i-1} -\;\tfrac{\bm{P}_{ij}'\bm{P}_{ij} (1-\bm{P}_{ij})'}{(1-\bm{P}_{ij})'(1-\bm{P}_{ij})+\bm{P}_{ij}'\bm{P}_{ij}}\mathbf{\tilde{Y}}_j \mathbf{\tilde{Y}}'_j + \tfrac{\bm{P}_{id_i}'(1-\bm{P}_{id_i})'(1-\bm{P}_{id_i})}{(1-\bm{P}_{id_i})'(1-\bm{P}_{id_i})+\bm{P}_{id_i}'\bm{P}_{id_i}}
\mathbf{\tilde{Y}}_{d_i} \mathbf{\tilde{Y}}'_{d_i}\bigg]\\
&\qquad-\bigg[\sum_{j=2}^{d_i-1} \tfrac{\bm{P}_{ij}}{(1-\bm{P}_{ij})'}
\mathbf{\tilde{Y}}_j \bm{P}_{ij}(1-\bm{P}_{ij}) \mathbf{\tilde{Y}}'_j+\tfrac{(1-\bm{P}_{id_i})}{\bm{P}'_{id_i}}
\mathbf{\tilde{Y}}_{d_i} \bm{P}_{id_i}(1-\bm{P}_{id_i}) \mathbf{\tilde{Y}}'_{d_i} \bigg]\Bigg)\\
&\qquad-\sum_{i=1}^{N^*} \sum_{j=2}^{n_i}\bigg[\tfrac{\bm{P}_{ij}'\bm{P}_{ij} (1-\bm{P}_{ij})'}{(1-\bm{P}_{ij})'(1-\bm{P}_{ij})+\bm{P}_{ij}'\bm{P}_{ij}}\mathbf{\tilde{Y}}_j \mathbf{\tilde{Y}}'_j + \tfrac{\bm{P}_{ij}}{(1-\bm{P}_{ij})'}
\mathbf{\tilde{Y}}_j \bm{P}_{ij}(1-\bm{P}_{ij}) \mathbf{\tilde{Y}}'_j\bigg]
\end{aligned}
&&
\end{flalign}
}
答案1
写六行。我将一些括号的位置从求和符号之前移到了之后,并缩小了尺寸。
请注意,它应该是\bigl
左分隔符和右分隔符(具有、和 的\bigr
明显变化)。Big
bigg
Bigg
\documentclass{article}
\usepackage{amsmath,bm}
\begin{document}
\begin{flalign}
\begin{aligned}
\frac{\partial^2 \ell}{\partial \bm{\phi}\,\partial\bm{\phi}'}={}&
\begin{aligned}[t]
\sum_{i=1}^{N-N^*}
\biggl(\,\sum_{j=2}^{d_i-1}\Bigl[
& -\frac{\bm{P}_{ij}'\bm{P}_{ij} (1-\bm{P}_{ij})'}
{(1-\bm{P}_{ij})'(1-\bm{P}_{ij})+\bm{P}_{ij}'\bm{P}_{ij}}
\tilde{\mathbf{Y}}_j \tilde{\mathbf{Y}}'_j
\\
& +\frac{\bm{P}_{id_i}'(1-\bm{P}_{id_i})'(1-\bm{P}_{id_i})}
{(1-\bm{P}_{id_i})'(1-\bm{P}_{id_i})+\bm{P}_{id_i}'\bm{P}_{id_i}}
\tilde{\mathbf{Y}}_{d_i} \tilde{\mathbf{Y}}'_{d_i}\Bigr]
\\
-\sum_{j=2}^{d_i-1}\Bigl[
& \frac{\bm{P}_{ij}}{(1-\bm{P}_{ij})'}
\tilde{\mathbf{Y}}_j \bm{P}_{ij}(1-\bm{P}_{ij}) \tilde{\mathbf{Y}}'_j
\\
& +\frac{(1-\bm{P}_{id_i})}{\bm{P}'_{id_i}}
\tilde{\mathbf{Y}}_{d_i} \bm{P}_{id_i}(1-\bm{P}_{id_i}) \tilde{\mathbf{Y}}'_{d_i} \Bigr]\biggr)
\end{aligned}
\\
&\begin{aligned}[t]
-\sum_{i=1}^{N^*} \sum_{j=2}^{n_i}\Bigl[
& \frac{\bm{P}_{ij}'\bm{P}_{ij} (1-\bm{P}_{ij})'}
{(1-\bm{P}_{ij})'(1-\bm{P}_{ij})+\bm{P}_{ij}'\bm{P}_{ij}}
\tilde{\mathbf{Y}}_j \tilde{\mathbf{Y}}'_j
\\
& + \frac{\bm{P}_{ij}}{(1-\bm{P}_{ij})'}
\tilde{\mathbf{Y}}_j \bm{P}_{ij}(1-\bm{P}_{ij}) \tilde{\mathbf{Y}}'_j\Bigr]
\end{aligned}
\end{aligned}
&&
\end{flalign}
\end{document}
我把所有都改成了这样,\mathbf{\tilde{Y}}
这样\tilde{\mathbf{Y}}
在概念上更合理。您可能还想使用\widetilde
,但我不建议这样做。
答案2
减小文本大小或使其分成几行。
\begin{flalign}
{\footnotesize
\begin{aligned}
\frac{\partial^2 \ell}{\partial \bm{\phi}\partial\bm{\phi}'}=
&\sum_{i=1}^{N-N^*} \Bigg(\bigg[\sum_{j=2}^{d_i-1} -\;\tfrac{\bm{P}_{ij}'\bm{P}_{ij} (1-\bm{P}_{ij})'}{(1-\bm{P}_{ij})'(1-\bm{P}_{ij})+\bm{P}_{ij}'\bm{P}_{ij}}\mathbf{\tilde{Y}}_j \mathbf{\tilde{Y}}'_j + \tfrac{\bm{P}_{id_i}'(1-\bm{P}_{id_i})'(1-\bm{P}_{id_i})}{(1-\bm{P}_{id_i})'(1-\bm{P}_{id_i})+\bm{P}_{id_i}'\bm{P}_{id_i}}\\&
\mathbf{\tilde{Y}}_{d_i} \mathbf{\tilde{Y}}'_{d_i}\bigg]
-\bigg[\sum_{j=2}^{d_i-1} \tfrac{\bm{P}_{ij}}{(1-\bm{P}_{ij})'}
\mathbf{\tilde{Y}}_j \bm{P}_{ij}(1-\bm{P}_{ij}) \mathbf{\tilde{Y}}'_j+\tfrac{(1-\bm{P}_{id_i})}{\bm{P}'_{id_i}}
\mathbf{\tilde{Y}}_{d_i} \bm{P}_{id_i}(1-\bm{P}_{id_i}) \mathbf{\tilde{Y}}'_{d_i} \bigg]\Bigg)\\
&-\sum_{i=1}^{N^*} \sum_{j=2}^{n_i}\bigg[\tfrac{\bm{P}_{ij}'\bm{P}_{ij} (1-\bm{P}_{ij})'}{(1-\bm{P}_{ij})'(1-\bm{P}_{ij})+\bm{P}_{ij}'\bm{P}_{ij}}\mathbf{\tilde{Y}}_j \mathbf{\tilde{Y}}'_j + \tfrac{\bm{P}_{ij}}{(1-\bm{P}_{ij})'}
\mathbf{\tilde{Y}}_j \bm{P}_{ij}(1-\bm{P}_{ij}) \mathbf{\tilde{Y}}'_j\bigg]
\end{aligned}}
\end{flalign}
答案3
我使代码更加清晰易读,并将 \Bigg( 更改为 \Biggl( 等。另外,我使用了 amsmath 的多行环境,它在这里很适用。
\documentclass{article}
\usepackage{amsmath}
\usepackage{bm}
\usepackage[margin=1in]{geometry}
\newcommand{\bP}{\bm{P}}
\newcommand{\tY}{\mathbf{\tilde Y}}
\begin{document}
\begin{multline}
\frac{\partial^2 \ell}{\partial \bm{\phi}\partial\bm{\phi}'}=
\sum_{i=1}^{N-N^*} \Biggl(\biggl[\sum_{j=2}^{d_i-1} -\;\frac{\bP_{ij}'\bP_{ij} (1-\bP_{ij})'}{(1-\bP_{ij})'(1-\bP_{ij})+\bP_{ij}'\bP_{ij}}\tY_j \tY'_j + \frac{\bP_{id_i}'(1-\bP_{id_i})'(1-\bP_{id_i})}{(1-\bP_{id_i})'(1-\bP_{id_i})+\bP_{id_i}'\bP_{id_i}}
\tY_{d_i} \tY'_{d_i}\biggr]\\
-\biggl[\sum_{j=2}^{d_i-1} \frac{\bP_{ij}}{(1-\bP_{ij})'}
\tY_j \bP_{ij}(1-\bP_{ij}) \tY'_j+\frac{(1-\bP_{id_i})}{\bP'_{id_i}}
\tY_{d_i} \bP_{id_i}(1-\bP_{id_i}) \tY'_{d_i} \biggr]\Biggr)\\
-\sum_{i=1}^{N^*} \sum_{j=2}^{n_i}\biggl[\frac{\bP_{ij}'\bP_{ij} (1-\bP_{ij})'}{(1-\bP_{ij})'(1-\bP_{ij})+\bP_{ij}'\bP_{ij}}\tY_j \tY'_j + \frac{\bP_{ij}}{(1-\bP_{ij})'}
\tY_j \bP_{ij}(1-\bP_{ij}) \tY'_j\biggr]
\end{multline}
\end{document}
答案4
我建议使用包geometry
。如果您有具有大边距的默认布局,则可以将方程内容嵌套在环境中medsize
(nccmath
约为以前大小的 80%):
\documentclass{article}
\usepackage{geometry}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.3pt}
\usepackage{amsmath, bm, nccmath}
\usepackage{diffcoeff}
\begin{document}
\begin{equation}
\begin{aligned}\diffp[1,1]{\ell}{\bm{\phi},\bm{\phi}'} =
\sum_{i=1}^{N-N^*} \Bigg( & \bigg[\begin{aligned}[t]\sum_{j=2}^{d_i-1} -\;\tfrac{\bm{P}_{ij}'
\bm{P}_{ij} (1-\bm{P}_{ij})'}{(1-\bm{P}_{ij})'(1-\bm{P}_{ij})+\bm{P}_{ij}'\bm{P}_{ij}}\mathbf{\tilde{Y}}_j \mathbf{\tilde{Y}}'_j + \tfrac{\bm{P}_{id_i}'(1-\bm{P}_{id_i})'(1-\bm{P}_{id_i})}{(1-\bm{P}_{id_i})'(1-\bm{P}_{id_i})+\bm{P}_{id_i}'\bm{P}_{id_i}}
\mathbf{\tilde{Y}}_{d_i} \mathbf{\tilde{Y}}'_{d_i} & \bigg]\\
%&
- \bigg[\sum_{j=2}^{d_i-1} \tfrac{\bm{P}_{ij}}{(1-\bm{P}_{ij})'}
\mathbf{\tilde{Y}}_j \bm{P}_{ij}(1-\bm{P}_{ij}) \mathbf{\tilde{Y}}'_j+\tfrac{(1-\bm{P}_{id_i})}{\bm{P}'_{id_i}}
\mathbf{\tilde{Y}}_{d_i} \bm{P}_{id_i}(1-\bm{P}_{id_i}) \mathbf{\tilde{Y}}'_{d_i} &\bigg]\Bigg)
\end{aligned}\\
% &
-\sum_{i=1}^{N^*} \sum_{j=2}^{n_i} & \bigg[\tfrac{\bm{P}_{ij}'\bm{P}_{ij} (1-\bm{P}_{ij})'}{(1-\bm{P}_{ij})'(1-\bm{P}_{ij})+\bm{P}_{ij}'\bm{P}_{ij}}\mathbf{\tilde{Y}}_j \mathbf{\tilde{Y}}'_j + \tfrac{\bm{P}_{ij}}{(1-\bm{P}_{ij})'}
\mathbf{\tilde{Y}}_j \bm{P}_{ij}(1-\bm{P}_{ij}) \mathbf{\tilde{Y}}'_j\bigg]
\end{aligned}
\end{equation}
\bigskip
\begin{equation}
\begin{medsize}
\begin{aligned}\diffp[1,1]{\ell}{\bm{\phi},\bm{\phi}'} =
\sum_{i=1}^{N-N^*} \Biggl( & \Biggl[\begin{aligned}[t]\sum_{j=2}^{d_i-1} -\;\tfrac{\bm{P}_{ij}'
\bm{P}_{ij} (1-\bm{P}_{ij})'}{(1-\bm{P}_{ij})'(1-\bm{P}_{ij})+\bm{P}_{ij}'\bm{P}_{ij}}\mathbf{\tilde{Y}}_j \mathbf{\tilde{Y}}'_j + \tfrac{\bm{P}_{id_i}'(1-\bm{P}_{id_i})'(1-\bm{P}_{id_i})}{(1-\bm{P}_{id_i})'(1-\bm{P}_{id_i})+\bm{P}_{id_i}'\bm{P}_{id_i}}
\mathbf{\tilde{Y}}_{d_i} \mathbf{\tilde{Y}}'_{d_i} & \Biggr]\\
%&
- \Biggl[\sum_{j=2}^{d_i-1} \tfrac{\bm{P}_{ij}}{(1-\bm{P}_{ij})'}
\mathbf{\tilde{Y}}_j \bm{P}_{ij}(1-\bm{P}_{ij}) \mathbf{\tilde{Y}}'_j+\tfrac{(1-\bm{P}_{id_i})}{\bm{P}'_{id_i}}
\mathbf{\tilde{Y}}_{d_i} \bm{P}_{id_i}(1-\bm{P}_{id_i}) \mathbf{\tilde{Y}}'_{d_i} &\Biggr]\Biggr)
\end{aligned}\\
% &
-\sum_{i=1}^{N^*} \sum_{j=2}^{n_i} & \biggl[\tfrac{\bm{P}_{ij}'\bm{P}_{ij} (1-\bm{P}_{ij})'}{(1-\bm{P}_{ij})'(1-\bm{P}_{ij})+\bm{P}_{ij}'\bm{P}_{ij}}\mathbf{\tilde{Y}}_j \mathbf{\tilde{Y}}'_j + \tfrac{\bm{P}_{ij}}{(1-\bm{P}_{ij})'}
\mathbf{\tilde{Y}}_j \bm{P}_{ij}(1-\bm{P}_{ij}) \mathbf{\tilde{Y}}'_j\biggr]
\end{aligned}
\end{medsize}
\end{equation}
\end{document}