有人可以帮我使用 WinEdt 宏自动拆分方程式吗:
参见下面的示例:
原始代码:
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\begin{align}
\rho (v_{a}) &= \rho_{a}^{i}(x)\ e_{i}, \label{anch} \\[4pt]
\lbrack v_{a},v_{b}] &= C_{ab}^{c}(\mathrm{x})\ v_{c} \label{liea}
\end{align}
\begin{align}
\widehat{\rho }_{a}^{j}e_{j}({}\widehat{\rho }_{b}^{i})-\widehat{\rho }_{b}^{j}e_{j}
(\widehat{\rho }_{a}^{i}) &= \widehat{\rho }_{e}^{j}\mathbf{C}_{ab}^{e},
\nonumber \\ \hspace*{-12pt}
\sum\limits_{cyclic(a,b,e)}\left( \widehat{\rho }_{a}^{j}e_{j}(
\mathbf{C}_{be}^{f})+\mathbf{C}_{ag}^{f}\mathbf{C}_{be}^{g}-\mathbf{C}
_{b^{\prime }e^{\prime }}^{f^{\prime }} \widehat{\rho }_{a}^{j}
\mathbf{Q}_{f^{\prime }bej}^{fb^{\prime }e^{\prime }}\right) &= 0, \label{lased}
\end{align}
\begin{align}
L_{b^{\prime }e^{\prime }}^{a^{\prime }} \;\;&=\;\; \left( \mathcal{D}_{e^{\prime }}
\mathbf{z}_{b^{\prime }}\right) \rfloor \mathbf{z}^{a^{\prime }},\quad L_{be^{\prime }}^{a}=\left( \mathcal{D}_{e^{\prime }}\mathbf{v}_{b}\right) \rfloor \mathbf{v}^{a} \label{hcov} \\
K_{b^{\prime }c}^{a^{\prime }} \;\;&=\;\; \left( \mathcal{D}_{c}\mathbf{z}_{b^{\prime }}\right) \rfloor \mathbf{z}^{a^{\prime }},\quad K_{bc}^{a}=\left( \mathcal{D}_{c}\mathbf{v}_{b}\right) \rfloor
\mathbf{v}^{a}. \label{vcov}
\end{align}
\begin{align}
A_{A}^{\underline{A}} \;\;&=\;\; \mathbf{e}_{A}^{\underline{A}}=\left[
\begin{array}{cc}
e_{a}^{\underline{a}} & N_{a}^{b}e_{b}^{\underline{a}} \\
0 & e_{a}^{\underline{a}}
\end{array}\right] , \label{vt1} \\ A_{\underline{B}}^{B} \;\;&=\;\; \mathbf{e}_{\underline{B}}^{B}=\left[
\begin{array}{cc}
e_{\underline{a}}^{a} & -N_{a}^{b} e_{\underline{a}}^{a} \\
0 & e_{\underline{a}}^{a}
\end{array}\right] ,
\label{vt2}
\end{align}
\begin{align}
R_{e^{\prime }b^{\prime }c^{\prime }}^{a^{\prime }} \;\;&=\;\; \mathbf{z}^{a^{\prime }}\rfloor \mathcal{R}\left( \mathbf{z}_{c^{\prime }},\mathbf{z}_{b^{\prime }}\right) \mathbf{z}_{e^{\prime }},
R_{ bb^{\prime }e^{\prime }}^{a}=v^{a}\rfloor \mathcal{R}\left( \mathbf{z}_{e^{\prime }},\mathbf{z}
_{b^{\prime }}\right) \mathbf{v}_{b}, \label{curvaturehv} \\
P_{ b^{\prime }c^{\prime }c}^{a^{\prime }} \;\;&=\;\; \mathbf{z}^{a^{\prime}}\rfloor \mathcal{R}\left( \mathbf{v}_{c},\mathbf{z}_{c^{\prime }}\right) \mathbf{z}_{b^{\prime }},~P_{ bc^{\prime}c}^{a}= \mathbf{v}^{a}\rfloor \mathcal{R}\left( \mathbf{v}_{c},\mathbf{z}_{c^{\prime }}\right)
\mathbf{v}_{b}, \nonumber \\
S_{b^{\prime }bc}^{a^{\prime }} \;\;&=\;\; \mathbf{z}^{a^{\prime }}\rfloor \mathcal{R}\left( \mathbf{v}_{c},\mathbf{v}_{b}\right) \mathbf{z}_{b^{\prime }}, S_{bcd}^{a}=\mathbf{v}^{a}\rfloor \mathcal{R}\left( \mathbf{v}_{d}, \mathbf{v}_{c}\right) \mathbf{v}_{b}. \nonumber
\end{align}
\begin{align}
R_{e^{\prime }b^{\prime }c^{\prime }}^{a^{\prime }} \;\;&=\;\; \mathbf{z}
_{c^{\prime }}(L_{.e^{\prime }b^{\prime }}^{a^{\prime }})-\mathbf{z}
_{b^{\prime }}(L_{.e^{\prime }c^{\prime }}^{a^{\prime }})+L_{.e^{\prime
}b^{\prime }}^{d^{\prime }}L_{d^{\prime }c^{\prime }}^{a^{\prime
}}-L_{.e^{\prime }c^{\prime }}^{d^{\prime }}L_{d^{\prime }b^{\prime
}}^{a^{\prime }}-K_{.e^{\prime }a}^{a^{\prime }}\Omega_{.b^{\prime
}c^{\prime }}^{a}, \label{dcurv} \\
R_{ bb^{\prime }e^{\prime }}^{a} \;\;&=\;\; \mathbf{z}_{e^{\prime }}(L_{.bb^{\prime
}}^{a})-\mathbf{z}_{b^{\prime }}(L_{.be^{\prime }}^{a})+L_{.bb^{\prime
}}^{c}L_{.ce^{\prime }}^{a}-L_{.be^{\prime }}^{c}L_{.cb^{\prime
}}^{a}-K_{.bc}^{a} \Omega_{.b^{\prime }e^{\prime }}^{c}, \nonumber \\
P_{ e^{\prime }b^{\prime }a}^{a^{\prime }} \;\;&=\;\; \mathbf{v}_{a}(L_{.e^{\prime
}b^{\prime }}^{a^{\prime }})-(\mathbf{z}_{b^{\prime }}(K_{.e^{\prime
}a}^{a^{\prime }})+L_{.d^{\prime }b^{\prime }}^{a^{\prime }}K_{.e^{\prime
}a}^{d^{\prime }}-L_{.e^{\prime }b^{\prime }}^{d^{\prime }}K_{.d^{\prime
}a}^{a^{\prime }}-L_{.ab^{\prime }}^{c}K_{.e^{\prime }c}^{a^{\prime }}) \nonumber \\
&\quad\;\; +K_{.e^{\prime }b}^{a^{\prime }}T_{.b^{\prime }a}^{b}, \nonumber \\
P_{ ba^{\prime }a}^{c} \;\;&=\;\; \mathbf{v}_{a}(L_{.ba^{\prime }}^{c})-\left(
\mathbf{z}_{a^{\prime }}(K_{.ba}^{c})+L_{.da^{\prime
}}^{c\,}K_{.ba}^{d}-L_{.ba^{\prime }}^{d}K_{.da}^{c}-L_{.aa^{\prime}}^{d}K_{.bd}^{c}\right) \nonumber \\
&\quad\;\; +K_{.bd}^{c}T_{.a^{\prime }a}^{d}, \nonumber \\
S_{ b^{\prime }bc}^{a^{\prime }} \;\;&=\;\; S_{ jbc}^{i}=\mathbf{v}
_{c}(K_{.b^{\prime }b}^{a^{\prime }})-\mathbf{v}_{b}(K_{.b^{\prime
}c}^{a^{\prime }})+K_{.b^{\prime }b}^{e^{\prime }}K_{.e^{\prime
}c}^{a^{\prime }}-K_{.b^{\prime }c}^{e^{\prime }}K_{e^{\prime }b}^{a^{\prime }}, \nonumber \\
S_{ bcd}^{a} \;\;&=\;\; \mathbf{v}_{d}(K_{.bc}^{a})-\mathbf{v}_{c}(K_{.bd}^{a}) + K_{.bc}^{e}K_{.ed}^{a}-K_{.bd}^{e}K_{.ec}^{a}. \nonumber
\end{align}
\end{document}
输出应类似于下面的数据:
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\begin{align}
\rho (v_{a}) &= \rho_{a}^{i}(x)\ e_{i}, \label{anch} [4pt]
\end{align}
\begin{align}
\lbrack v_{a},v_{b}] &= C_{ab}^{c}(\mathrm{x})\ v_{c} \label{liea}
\end{align}
\begin{align}
\widehat{\rho }_{a}^{j}e_{j}({}\widehat{\rho }_{b}^{i})-\widehat{\rho }_{b}^{j}e_{j}
(\widehat{\rho }_{a}^{i}) &= \widehat{\rho }_{e}^{j}\mathbf{C}_{ab}^{e},
\nonumber \hspace*{-12pt}
\end{align}
\begin{align}
\sum\limits_{cyclic(a,b,e)}\left( \widehat{\rho }_{a}^{j}e_{j}(
\mathbf{C}_{be}^{f})+\mathbf{C}_{ag}^{f}\mathbf{C}_{be}^{g}-\mathbf{C}
_{b^{\prime }e^{\prime }}^{f^{\prime }} \widehat{\rho }_{a}^{j}
\mathbf{Q}_{f^{\prime }bej}^{fb^{\prime }e^{\prime }}\right) &= 0, \label{lased}
\end{align}
\begin{align}
L_{b^{\prime }e^{\prime }}^{a^{\prime }} \;\;&=\;\; \left( \mathcal{D}_{e^{\prime }}
\mathbf{z}_{b^{\prime }}\right) \rfloor \mathbf{z}^{a^{\prime }},\quad L_{be^{\prime }}^{a}=\left( \mathcal{D}_{e^{\prime }}\mathbf{v}_{b}\right) \rfloor \mathbf{v}^{a} \label{hcov}
\end{align}
\begin{align}
K_{b^{\prime }c}^{a^{\prime }} \;\;&=\;\; \left( \mathcal{D}_{c}\mathbf{z}_{b^{\prime }}\right) \rfloor \mathbf{z}^{a^{\prime }},\quad K_{bc}^{a}=\left( \mathcal{D}_{c}\mathbf{v}_{b}\right) \rfloor
\mathbf{v}^{a}. \label{vcov}
\end{align}
\begin{align}
A_{A}^{\underline{A}} \;\;&=\;\; \mathbf{e}_{A}^{\underline{A}}=\left[
\begin{array}{cc}
e_{a}^{\underline{a}} & N_{a}^{b}e_{b}^{\underline{a}} \\
0 & e_{a}^{\underline{a}}
\end{array}\right] , \label{vt1}
\end{align}
\begin{align}
A_{\underline{B}}^{B} \;\;&=\;\; \mathbf{e}_{\underline{B}}^{B}=\left[
\begin{array}{cc}
e_{\underline{a}}^{a} & -N_{a}^{b} e_{\underline{a}}^{a} \\
0 & e_{\underline{a}}^{a}
\end{array}\right] ,
\label{vt2}
\end{align}
\begin{align}
R_{e^{\prime }b^{\prime }c^{\prime }}^{a^{\prime }} \;\;&=\;\; \mathbf{z}^{a^{\prime }}\rfloor \mathcal{R}\left( \mathbf{z}_{c^{\prime }},\mathbf{z}_{b^{\prime }}\right) \mathbf{z}_{e^{\prime }},
R_{ bb^{\prime }e^{\prime }}^{a}=v^{a}\rfloor \mathcal{R}\left( \mathbf{z}_{e^{\prime }},\mathbf{z}
_{b^{\prime }}\right) \mathbf{v}_{b}, \label{curvaturehv}
\end{align}
\begin{align}
P_{ b^{\prime }c^{\prime }c}^{a^{\prime }} \;\;&=\;\; \mathbf{z}^{a^{\prime}}\rfloor \mathcal{R}\left( \mathbf{v}_{c},\mathbf{z}_{c^{\prime }}\right) \mathbf{z}_{b^{\prime }},~P_{ bc^{\prime}c}^{a}= \mathbf{v}^{a}\rfloor \mathcal{R}\left( \mathbf{v}_{c},\mathbf{z}_{c^{\prime }}\right)
\mathbf{v}_{b}, \nonumber
\end{align}
\begin{align}
S_{b^{\prime }bc}^{a^{\prime }} \;\;&=\;\; \mathbf{z}^{a^{\prime }}\rfloor \mathcal{R}\left( \mathbf{v}_{c},\mathbf{v}_{b}\right) \mathbf{z}_{b^{\prime }}, S_{bcd}^{a}=\mathbf{v}^{a}\rfloor \mathcal{R}\left( \mathbf{v}_{d}, \mathbf{v}_{c}\right) \mathbf{v}_{b}. \nonumber
\end{align}
\begin{align}
R_{e^{\prime }b^{\prime }c^{\prime }}^{a^{\prime }} \;\;&=\;\; \mathbf{z}
_{c^{\prime }}(L_{.e^{\prime }b^{\prime }}^{a^{\prime }})-\mathbf{z}
_{b^{\prime }}(L_{.e^{\prime }c^{\prime }}^{a^{\prime }})+L_{.e^{\prime
}b^{\prime }}^{d^{\prime }}L_{d^{\prime }c^{\prime }}^{a^{\prime
}}-L_{.e^{\prime }c^{\prime }}^{d^{\prime }}L_{d^{\prime }b^{\prime
}}^{a^{\prime }}-K_{.e^{\prime }a}^{a^{\prime }}\Omega_{.b^{\prime
}c^{\prime }}^{a}, \label{dcurv}
\end{align}
\begin{align}
R_{ bb^{\prime }e^{\prime }}^{a} \;\;&=\;\; \mathbf{z}_{e^{\prime }}(L_{.bb^{\prime
}}^{a})-\mathbf{z}_{b^{\prime }}(L_{.be^{\prime }}^{a})+L_{.bb^{\prime
}}^{c}L_{.ce^{\prime }}^{a}-L_{.be^{\prime }}^{c}L_{.cb^{\prime
}}^{a}-K_{.bc}^{a} \Omega_{.b^{\prime }e^{\prime }}^{c}, \nonumber
\end{align}
\begin{align}
P_{ e^{\prime }b^{\prime }a}^{a^{\prime }} \;\;&=\;\; \mathbf{v}_{a}(L_{.e^{\prime
}b^{\prime }}^{a^{\prime }})-(\mathbf{z}_{b^{\prime }}(K_{.e^{\prime
}a}^{a^{\prime }})+L_{.d^{\prime }b^{\prime }}^{a^{\prime }}K_{.e^{\prime
}a}^{d^{\prime }}-L_{.e^{\prime }b^{\prime }}^{d^{\prime }}K_{.d^{\prime
}a}^{a^{\prime }}-L_{.ab^{\prime }}^{c}K_{.e^{\prime }c}^{a^{\prime }}) \nonumber
\end{align}
\begin{align}
&\quad\;\; +K_{.e^{\prime }b}^{a^{\prime }}T_{.b^{\prime }a}^{b}, \nonumber
\end{align}
\begin{align}
P_{ ba^{\prime }a}^{c} \;\;&=\;\; \mathbf{v}_{a}(L_{.ba^{\prime }}^{c})-\left(
\mathbf{z}_{a^{\prime }}(K_{.ba}^{c})+L_{.da^{\prime
}}^{c\,}K_{.ba}^{d}-L_{.ba^{\prime }}^{d}K_{.da}^{c}-L_{.aa^{\prime}}^{d}K_{.bd}^{c}\right) \nonumber
\end{align}
\begin{align}
&\quad\;\; +K_{.bd}^{c}T_{.a^{\prime }a}^{d}, \nonumber
\end{align}
\begin{align}
S_{ b^{\prime }bc}^{a^{\prime }} \;\;&=\;\; S_{ jbc}^{i}=\mathbf{v}
_{c}(K_{.b^{\prime }b}^{a^{\prime }})-\mathbf{v}_{b}(K_{.b^{\prime
}c}^{a^{\prime }})+K_{.b^{\prime }b}^{e^{\prime }}K_{.e^{\prime
}c}^{a^{\prime }}-K_{.b^{\prime }c}^{e^{\prime }}K_{e^{\prime }b}^{a^{\prime }}, \nonumber
\end{align}
\begin{align}
S_{ bcd}^{a} \;\;&=\;\; \mathbf{v}_{d}(K_{.bc}^{a})-\mathbf{v}_{c}(K_{.bd}^{a}) + K_{.bc}^{e}K_{.ed}^{a}-K_{.bd}^{e}K_{.ec}^{a}. \nonumber
\end{align}
\end{document}
答案1
以下面的 WinEdt 宏为例。您应该扩展该宏,以检查是否在无法替换字符串的环境中找到了该字符串,例如示例中的数组环境。
SetSearchForward(1);
SetSearchCaseSensitive(0);
SetSearchEntire(1);
SetSearchCyclic(1);
SetSearchRelaxed(0);
SetSearchWholeWords(1);
SetSearchInline(1);
SetSearchCurrentDoc;
SetNotFoundNotify(0);
SetReplacePrompt(0);
SetRegEx(0);
SetFindStr("\\");
SearchReset;
BeginGroup;
SetTracking(0);
Loop(!|Find;IfOK(!"Call('Format');",!"JMP('Done');");|);
:Format::
Backspace(2);
GoToEndOfLine;
NewLine;
InsText("\end{align}");
NewLine;
InsText("\begin{align}");
Return;
:Done::
EndGroup;
SetTracking(1);
RestoreFind;
End;
答案2
您可以对方程式做很多改进。我假设它们是来自文档各个部分的块。
这些
^{\prime}
位使得公式的可读性较差;请使用'
其代替。A
\widehat{\rho}
与指数冲突:\widehat{\rho}_{a}^{\,j}
更好。不应使用连续
align
环境,通常也不应使用连续的一般对齐环境。用于equation
单个编号方程,equation*
用于非编号方程;用于gather
居中方程序列。\left(...\right)
只应在真正需要时使用;绝对不是和全部括号对。如果是 WinEdt 添加\left
和\right
,则告诉它不要这样做。\;
等号周围的间距是错误的。对于多个对齐点,请使用
alignat
或alignedat
; 甚至align
。使用alignat
可以控制列之间的间距。您可以使用常用的可选参数来控制行间距
\\
。
这是您输入的修改版本
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\begin{gather}
\rho (v_{a}) = \rho_{a}^{i}(x)\ e_{i}, \label{anch}
\\[4pt]
\lbrack v_{a},v_{b}] = C_{ab}^{c}(\mathrm{x})\ v_{c} \label{liea}
\end{gather}
\begin{equation*}
\widehat{\rho}_{a}^{\,j}e_{j}({}\widehat{\rho}_{b}^{\,i})-\widehat{\rho}_{b}^{j}e_{j}
(\widehat{\rho}_{a}^{\,i}) = \widehat{\rho}_{e}^{\,j}\mathbf{C}_{ab}^{e},
\end{equation*}
\begin{equation}
\sum_{\text{cyclic}(a,b,e)}
\bigl(\widehat{\rho}_{a}^{\,j}e_{j}
(\mathbf{C}_{be}^{f})+\mathbf{C}_{ag}^{f}\mathbf{C}_{be}^{g}-\mathbf{C}_{b'e'}^{f'} \widehat{\rho}_{a}^{\,j}
\mathbf{Q}_{f'bej}^{fb'e'}\bigr) = 0, \label{lased}
\end{equation}
\begin{alignat}{2}
L_{b'e'}^{a'} &= (\mathcal{D}_{e'}\mathbf{z}_{b'}) \rfloor \mathbf{z}^{a'},
\quad &
L_{be'}^{a} &=(\mathcal{D}_{e'}\mathbf{v}_{b}) \rfloor \mathbf{v}^{a} \label{hcov}
\\
K_{b'c}^{a'} &= (\mathcal{D}_{c}\mathbf{z}_{b'}) \rfloor \mathbf{z}^{a'},
\quad &
K_{bc}^{a} &= (\mathcal{D}_{c}\mathbf{v}_{b}) \rfloor\mathbf{v}^{a}. \label{vcov}
\end{alignat}
\begin{align}
A_{A}^{\underline{A}} &=
\mathbf{e}_{A}^{\underline{A}}=
\begin{bmatrix}
e_{a}^{\underline{a}} & N_{a}^{b}e_{b}^{\underline{a}} \\
0 & e_{a}^{\underline{a}}
\end{bmatrix}, \label{vt1}
\\
A_{\underline{B}}^{B} &=
\mathbf{e}_{\underline{B}}^{B}=
\begin{bmatrix}
e_{\underline{a}}^{a} & -N_{a}^{b} e_{\underline{a}}^{a} \\
0 & e_{\underline{a}}^{a}
\end{bmatrix}, \label{vt2}
\end{align}
\begin{equation}
\label{curvaturehv}
\begin{alignedat}{2}
R_{e'b'c'}^{a'} &= \mathbf{z}^{a'}\rfloor \mathcal{R}(\mathbf{z}_{c'},\mathbf{z}_{b'}) \mathbf{z}_{e'},
\quad &
R_{bb'e'}^{a}&=v^{a}\rfloor \mathcal{R}(\mathbf{z}_{e'},\mathbf{z}_{b'}) \mathbf{v}_{b},
\\
P_{b'c'c}^{a'} &= \mathbf{z}^{a'}\rfloor \mathcal{R}(\mathbf{v}_{c},\mathbf{z}_{c'}) \mathbf{z}_{b'},
\quad &
P_{bc^{\prime}c}^{a} &= \mathbf{v}^{a}\rfloor \mathcal{R}(\mathbf{v}_{c},\mathbf{z}_{c'})\mathbf{v}_{b},
\\
S_{b'bc}^{a'} &= \mathbf{z}^{a'}\rfloor \mathcal{R}(\mathbf{v}_{c},\mathbf{v}_{b}) \mathbf{z}_{b'},
\quad &
S_{bcd}^{a} &= \mathbf{v}^{a}\rfloor \mathcal{R}( \mathbf{v}_{d}, \mathbf{v}_{c}) \mathbf{v}_{b}.
\end{alignedat}
\end{equation}
\begin{equation}
\begin{aligned}
R_{e'b'c'}^{a'} &= \mathbf{z}_{c'}(L_{.e'b'}^{a'})-\mathbf{z}_{b'}(L_{.e'c'}^{a'})
+L_{.e'b'}^{d'}L_{d'c'}^{a'}-L_{.e'c'}^{d'}L_{d'b'}^{a'}-K_{.e'a}^{a'}\Omega_{.b'c'}^{a}, \label{dcurv}
\\
R_{bb'e'}^{a} &= \mathbf{z}_{e'}(L_{.bb'}^{a})-\mathbf{z}_{b'}(L_{.be'}^{a})
+L_{.bb'}^{c}L_{.ce'}^{a}-L_{.be'}^{c}L_{.cb'}^{a}-K_{.bc}^{a} \Omega_{.b'e'}^{c},
\\
P_{e'b'a}^{a'} &= \mathbf{v}_{a}(L_{.e'b'}^{a'})-(\mathbf{z}_{b'}(K_{.e'a}^{a'})
+L_{.d'b'}^{a'}K_{.e'a}^{d'}-L_{.e'b'}^{d'}K_{.d'a}^{a'}-L_{.ab'}^{c}K_{.e'c}^{a'})
\\&\qquad{}+K_{.e'b}^{a'}T_{.b'a}^{b},
\\
P_{ba'a}^{c} &= \mathbf{v}_{a}(L_{.ba'}^{c})
-(\mathbf{z}_{a'}(K_{.ba}^{c})+L_{.da'}^{c\,}K_{.ba}^{d}-L_{.ba'}^{d}K_{.da}^{c}-L_{.aa'}^{d}K_{.bd}^{c})
\\&\qquad{}+K_{.bd}^{c}T_{.a'a}^{d},
\\
S_{b'bc}^{a'} &= S_{jbc}^{i}=\mathbf{v}_{c}(K_{.b'b}^{a'})-\mathbf{v}_{b}(K_{.b'c}^{a'})
+K_{.b'b}^{e'}K_{.e'c}^{a'}-K_{.b'c}^{e'}K_{e'b}^{a'},
\\
S_{bcd}^{a} &= \mathbf{v}_{d}(K_{.bc}^{a})-\mathbf{v}_{c}(K_{.bd}^{a})
+K_{.bc}^{e}K_{.ed}^{a}-K_{.bd}^{e}K_{.ec}^{a}.
\end{aligned}
\end{equation}
\end{document}