
我現在正在寫有關張量的文章,並且必須描述將兩個狀態合併為一個張量。現在我有一些看起來像這樣的東西:
使用以下程式碼:
\begin{align}
& r \begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0 \end{bmatrix} + & s \begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 0 \\ 1 \end{bmatrix} + & t \begin{bmatrix} 0 \\ 1 \end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0 \end{bmatrix} + & u \begin{bmatrix} 0 \\ 1 \end{bmatrix} \otimes \begin{bmatrix} 0 \\ 1 \end{bmatrix} \\
\text{with the basis} & \biggr(\begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0 \end{bmatrix}, & \begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 0 \\ 1 \end{bmatrix}, & \begin{bmatrix} 0 \\ 1 \end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0 \end{bmatrix}, & \begin{bmatrix} 0 \\ 1 \end{bmatrix} \otimes \begin{bmatrix} 0 \\ 1 \end{bmatrix}\biggr) \\
\text{can be written as} & \Biggr(\begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix}, & \begin{bmatrix} 0 \\ 1 \\ 0 \\ 0 \end{bmatrix}, & \begin{bmatrix} 0 \\ 0 \\ 1 \\ 0 \end{bmatrix}, & \begin{bmatrix} 0 \\ 0 \\ 0 \\ 1 \end{bmatrix}\Biggr)
\end{align}
有幾件事讓我煩惱。
- 大括號不適合矩陣。 (我嘗試
\left(
過\right)
,但這不起作用...... - 最糟糕的是我無法讓列垂直對齊(最好居中)
我已經嘗試了我能想到的一切,但我只是無法到達那裡......如果有人有建議,請發表評論!
答案1
你可以使用array
:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\setlength{\arraycolsep}{0pt}
\begin{array}{ r c c c c c c c l }
r &
\begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0 \end{bmatrix} &
{} + s &
\begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 0 \\ 1 \end{bmatrix} &
{} + t &
\begin{bmatrix} 0 \\ 1 \end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0 \end{bmatrix} &
{} + u &
\begin{bmatrix} 0 \\ 1 \end{bmatrix} \otimes \begin{bmatrix} 0 \\ 1 \end{bmatrix} &
\\[10pt]
\text{with the basis}\:\biggr( &
\begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0 \end{bmatrix} &
, &
\begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 0 \\ 1 \end{bmatrix} &
, &
\begin{bmatrix} 0 \\ 1 \end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0 \end{bmatrix} &
, &
\begin{bmatrix} 0 \\ 1 \end{bmatrix} \otimes \begin{bmatrix} 0 \\ 1 \end{bmatrix} &
\biggr) \\[10pt]
\text{can be written as}\:\Biggr( &
\begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix} &
, &
\begin{bmatrix} 0 \\ 1 \\ 0 \\ 0 \end{bmatrix} &
, &
\begin{bmatrix} 0 \\ 0 \\ 1 \\ 0 \end{bmatrix} &
, &
\begin{bmatrix} 0 \\ 0 \\ 0 \\ 1 \end{bmatrix} &
\Biggr)
\end{array}
\]
\end{document}
答案2
我建議將文本從不屬於它們的等式中提取出來。
可以透過一些基於的技巧來獲得對齊IEEEeqnarray
。
\documentclass{article}
\usepackage{mathtools}
\usepackage{IEEEtrantools}
\newcommand{\colv}[1]{\begin{bmatrix}#1\end{bmatrix}}
\begin{document}
The tensor
\begin{IEEEeqnarray}{rcCrcCrcCrcl}
r & \colv{1 \\ 0} \otimes \colv{1 \\ 0} & + &
s & \colv{1 \\ 0} \otimes \colv{0 \\ 1} & + &
t & \colv{0 \\ 1} \otimes \colv{1 \\ 0} & + &
u & \colv{0 \\ 1} \otimes \colv{0 \\ 1}
\\
\noalign{\vspace{2\jot}}
\noalign{\noindent with the basis}
\noalign{\vspace{4\jot}}
\biggr( &
\colv{1 \\ 0} \otimes \colv{1 \\ 0}\mathrlap{,} &&&
\colv{1 \\ 0} \otimes \colv{0 \\ 1}\mathrlap{,} &&&
\colv{0 \\ 1} \otimes \colv{1 \\ 0}\mathrlap{,} &&&
\colv{0 \\ 1} \otimes \colv{0 \\ 1} &
\biggr)
\\
\noalign{\vspace{2\jot}}
\noalign{\noindent can be written as}
\noalign{\vspace{4\jot}}
\left(\vphantom{\colv{0\\0\\0\\0}}\right.\kern-\nulldelimiterspace &
\mathllap{r}
\colv{1 \\ 0 \\ 0 \\ 0}\mathrlap{,} &&&
\mathllap{s}
\colv{0 \\ 1 \\ 0 \\ 0}\mathrlap{,} &&&
\mathllap{t}
\colv{0 \\ 0 \\ 1 \\ 0}\mathrlap{,} &&&
\mathllap{u}
\colv{0 \\ 0 \\ 0 \\ 1} &
\left)\vphantom{\colv{0\\0\\0\\0}}\right.\kern-\nulldelimiterspace
\end{IEEEeqnarray}
\end{document}
我在最後一行添加了標量,如果您認為更好,請將其刪除。
列類型有
r
對於右對齊的列c
對於居中的列l
對於左對齊的列C
對於具有二元運算子或關係的居中列
我可以使用(製作一個內容向右突出的零寬度框)和(與左側類似),\mathrlap
但這很拗口。\mathllap
\IEEEeqnarraymulticol