Gary Gong

1 minute read

By Wallpoper [Public domain or Public domain], via Wikimedia Commons

一般來說

打 TeX 相關指令的時候,基本上要對齊會使用上\begin{aligned}\end{aligned},中間對齊的基準點用&,換行用\\。如下所示範例 TeX Command 為:

\begin{aligned}
& x^2+4x+4 \\
=& (x+2)(x+2) \\
=& (x+2)^2 
\end{aligned}

顯示結果應該要像這樣:

應該長這樣

結果長這樣: $$ \begin{aligned} & x^2+4x+4 =&(x+2)(x+2) =&(x+2)^2 \end{aligned} $$

原來是 Hugo Markdown Parser 會把 \\吃掉一些,變成單反斜(\),這個會造成好大一個空白;所以有人說要用 4 個雙反斜線(但是沒明講是 Hugo 僅說是 Markdown Parsing 問題),有人說用 6 個雙反斜線,在這邊我 6 個雙反斜線(看起來是 Hugo 要用 6 雙反斜)才有用。

方案?

那上面的 Tex Command 就變成

\begin{aligned}
& x^2+4x+4 \\\\\\
=& (x+2)(x+2) \\\\\\
=& (x+2)^2 
\end{aligned}

再看一次 Render 的情形:

$$ \begin{aligned} & x^2+4x+4 \\
=&(x+2)(x+2) \\
=&(x+2)^2 \end{aligned} $$

真棒

或者是說,如果嫌\\\\\\太難看,或許可以這樣:

\begin{aligned}
& x^2+4x+4 \newline
=& (x+2)(x+2) \newline
=& (x+2)^2 
\end{aligned}

Render 看看: $$ \begin{aligned} & x^2+4x+4 \newline =&(x+2)(x+2) \newline =&(x+2)^2 \end{aligned} $$ 也好棒


也看看

Weather Research and Forecasting Model (WRF) Installation Guide on Ubuntu 16.04

Compiling TensorFlow-GPU on Ubuntu 16.04 with CUDA 9.1(9.2) and Python3

Julia Triple-Quoted String Literals Alignment

NGINX, MYSQL, PHP INSTALLATION (UBUNTU 16.04)

ZZZ我終於把 MATHJAX 弄進去了

Cannot Use pip3 in macOS (zlib Dependency Problem)

Hexo Syntax Highlighting (Tested Under Tranquilpeak)

Julia isequal() 和 ==

comments powered by Disqus