Live Editor: How to Align Equal Signs in LaTeX Equations

38 ビュー (過去 30 日間)
jackxujh
jackxujh 2017 年 12 月 5 日
回答済み: jackxujh 2017 年 12 月 6 日
I am writing a simple group of equations (General form of weighted graphs) in Live Editor using LaTeX, and I really wish to align the equation signs. (In default LaTeX font, character `X` and `W` have different widths)
X = (x_1, x_2, \dots, x_n) \ (n \ge 3) \cr
E = \{e_{ij} | x_i, x_j \in X\} \cr
W = \{w_{ij} | w_{ij} \ge 0 \
\text{and} \ w_{ii}=0, \
\forall i, j \in \{ 1, 2, \dots, n\} \}
But I found the Live Editor does not support the `\begin{align}` `\end{align}` keywords.
I've tried to wrap the equation set above into a 3X3 matrix using `\matrix`, but that resulted in matrix alignment layout: the part of the equation to the right of the equal sign are not aligned to the left, but to the center (weird for equations).
Since we may not have align available until some future release or updates, is there any workarounds I can try? Thanks!!
  2 件のコメント
Ralf Hillebrand
Ralf Hillebrand 2017 年 12 月 5 日
You could use an array environment instead and align at the =. Please note, that the 1st column is right-aligned and the 3rd one left-aligned:
\begin{array}{rcl}
X &=& (x_1, x_2, \dots, x_n) \ (n \ge 3) \\
E &=& \{e_{ij} | x_i, x_j \in X\} \\
W &=& \{w_{ij} | w_{ij} \ge 0 \
\text{and} \ w_{ii}=0, \
\forall i, j \in \{ 1, 2, \dots, n\} \}
\end{array}
jackxujh
jackxujh 2017 年 12 月 5 日
Thanks, Ralf! The text you suggested works! And it is rather elegant! Can I mark your comment as the correct answer?

サインインしてコメントする。

採用された回答

jackxujh
jackxujh 2017 年 12 月 6 日
Thanks to Ralf's comment , I was able to get this brilliant answer, by using an array:
\begin{array}{rcl}
X &=& (x_1, x_2, \dots, x_n) \ (n \ge 3) \\
E &=& \{e_{ij} | x_i, x_j \in X\} \\
W &=& \{w_{ij} | w_{ij} \ge 0 \
\text{and} \ w_{ii}=0, \
\forall i, j \in \{ 1, 2, \dots, n\} \}
\end{array}

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange实时脚本和函数 についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!