以下是 latex 中的代码
\documentclass{article}
\begin{document}
\begin{equation}
\label{eq:Ontology}
\begin{split}
R = \sum_{a_1,b_1=1}^{n_1} ((isSimpleCapabilityOf(SC_a_1, D_b_1) \cup \sum_{a_2,b_2=1}^{n_2} hasSimpleCapability(D_b_1, SC_a_1) \cup \sum_{a_3,b_3=1}^{n_3} ConsisitOfSimpleCapability(CC_a_3, SC_b_3) \cup \sum_{a_4,b_4=1}^{n_4} requiredComCapability(Process_a_4, CC_b_4) ) \cup \sum_{a_5,b_5=1}^{n_5} IsProcessOf(Pr_a_5, P_b_5) \cup \sum_{a_6,b_6=1}^{n_6} requiredProcess(P_a_6, Pr_b_6) \sum_{a_7,b_7=1}^{n_7} IsProcessOf(Pr_a_7, P_b_7) \cup requiredProduct(T_a_7, P_b_7))
\end{split}
\end{equation}
\end{document}
如何自动对齐方程式?我的意思是自动换行。
答案1
手动选择换行通常会产生更好的结果,但如果要求自动换行,则可以使用显示样式中的内联数学。
\documentclass{article}
\begin{document}
\begin{equation}
\label{eq:Ontology}
\parbox{.9\textwidth}{\centering$\displaystyle
R = \sum_{{a1},{b1}=1}^{n_1} ((\mathrm{isSimpleCapabilityOf}(SC_{a1}, D_{b1}) \cup
\sum_{a_2,b_2=1}^{n_2} \mathrm{hasSimpleCapability}(D_{b1}, SC_{a1}) \cup
\sum_{a_3,b_3=1}^{n_3} \mathrm{ConsisitOfSimpleCapability}(CC_{a3}, SC_{b3}) \cup
\sum_{a_4,b_4=1}^{n_4} \mathrm{requiredComCapability}(\mathrm[Process]_{a4}, CC_{b4}) ) \cup
\sum_{a_5,b_5=1}^{n_5} \mathrm{IsProcessOf}(Pr_{a5}, P_{b5}) \cup
\sum_{a_6,b_6=1}^{n_6} \mathrm{requiredProcess}(P_{a6}, Pr_{b6}) \sum_{a_7,b_7=1}^{n_7} \mathrm{IsProcessOf}(Pr_{a7}, P_{b7}) \cup
\mathrm{requiredProduct}(T_{a7}, P_{b7}))
$}
\end{equation}
\end{document}
答案2
我认为最好在每个\cup
指令前插入明确的换行符。
我还会将所有实例更改为\cup
,{\textstyle\bigcup}
修复双下标错误,将变量名称包装在指令中,并使用指令来\textnormal
整理术语。 (是\sum
\smashoperator
\smashoperator
数学工具包裹。)
最后,我不禁怀疑ConsisitOfSimpleCapability
应该拼写为ConsistsOfSimpleCapability
;然而,这不是我能够决定的。
\documentclass{article}
\usepackage{mathtools} % for \smashoperator macro
\newcommand\tbc{{\textstyle\bigcup}} % handy shortcut macro
\begin{document}
\begin{equation} \label{eq:Ontology}
\begin{split}
R = &\smashoperator[l]{\sum_{a_1,b_1=1}^{n_1}}
\biggl\{\Bigl[
\textnormal{isSimpleCapabilityOf}(SC_{a_1}, D_{b_1}) \\
&\tbc\smashoperator[r]{\sum_{a_2,b_2=1}^{n_2}}
\textnormal{hasSimpleCapability}(D_{b_1}, SC_{a_1}) \\
&\tbc\smashoperator[r]{\sum_{a_3,b_3=1}^{n_3}}
\textnormal{ConsisitOfSimpleCapability}(CC_{a_3}, SC_{b_3}) \\
&\tbc\smashoperator[r]{\sum_{a_4,b_4=1}^{n_4}}
\textnormal{requiredComCapability}(\mathit{Process}_{a_4}, CC_{b_4})
\Bigr] \\
&\tbc\smashoperator[r]{\sum_{a_5,b_5=1}^{n_5}}
\textnormal{IsProcessOf}(Pr_{a_5}, P_{b_5}) \\
&\tbc\smashoperator[r]{\sum_{a_6,b_6=1}^{n_6}}
\textnormal{requiredProcess}(P_{a_6}, Pr_{b_6}) \times
\smashoperator[r]{\sum_{a_7,b_7=1}^{n_7}}
\textnormal{IsProcessOf}(Pr_{a_7}, P_{b_7}) \\
&\tbc\
\textnormal{requiredProduct}(T_{a_7}, P_{b_7})
\smash[t]{\biggr\}}
\smash[b]{\vphantom{\sum_{a_6,b_6=1}^{n_6}}} % assure consistent vertical spacing
\end{split}
\end{equation}
\end{document}