垂直間距 - 對齊環境內的 blkarray 環境

垂直間距 - 對齊環境內的 blkarray 環境

我創建了自己的命令,使用以下命令創建標記的列向量blkarray環境。在環境內部使用該指令時會出現垂直間距問題align。它產生了太多的垂直空間。

\\[-3em]我在之後\begin{align}和之前都使用過\end{align};但我不想每次都手動調整。此外,我還看了一下,但問題仍然存在。

輸出

\documentclass{article}
\usepackage{blkarray}
\usepackage{amsmath}
\setlength{\parindent}{0pt}

\newcommand{\colVectorLabelled}[2]{
  \ensuremath{\mathrm{#1} = 
    \begin{blockarray}{*{1}{c} l}
      \begin{block}{*{1}{>{$\footnotesize}c<{$}} l} & \\\end{block}
      \begin{block}{[c]>{$\footnotesize}l<{$}}#2\end{block}
    \end{blockarray}    
  }    
}
\begin{document}

  \textbf{The} \verb|\blockarray| \textbf{environment alone}: Some filler text
  some filler text some filler text some filler text some filler text some filler text.\\
  \colVectorLabelled{X}{1 & $0_{2}$\\0 & $1_{2}$\\}

  \textbf{The} \verb|\blockarray| \textbf{environment inside} \verb|\align| 
  \textbf{environment}: Some filler text some filler text some filler text some 
  filler text some filler text some filler text.\\
  \begin{align}
    \colVectorLabelled{X}{1 & $0_{2}$\\0 & $1_{2}$\\}
  \end{align}
  More filler text filler text filler text filler text filler text filler text filler text
\end{document}

提前致謝 :)

答案1

這是一個解決方法,上面的間距用\useshortskipfrom表示,下面的空間用一個簡單的方法表示:nccmath\vskip -2ex

\documentclass{article}
\usepackage{blkarray}
\usepackage{amsmath, nccmath}
\setlength{\parindent}{0pt}

\newcommand{\colVectorLabelled}[2]{
  \ensuremath{\mathrm{#1} =
    \begin{blockarray}{*{1}{c} l}
      \begin{block}{*{1}{>{$\footnotesize}c<{$}} l} & \\\end{block}
      \begin{block}{[c]>{$\footnotesize}l<{$}}#2\end{block}
    \end{blockarray}
  }
}

\begin{document}

  \textbf{The} \verb|\blockarray| \textbf{environment alone}: Some filler text
  some filler text some filler text some filler text some filler text some filler text.\\
  \colVectorLabelled{X}{1 & $0_{2}$\\0 & $1_{2}$\\}

 \textbf{The} \verb|\blockarray| \textbf{environment inside} \verb|\align|
 \textbf{environment}: Some filler text some filler text some filler text some
 filler text some filler text some filler text some filler text some filler text some filler text.\useshortskip
 \begin{align}
 \colVectorLabelled{X}{1 & $0_{2}$\\0 & $1_{2}$\\}
 \end{align}\vskip-2ex
 More filler text filler text filler text filler text filler text filler text filler text

\end{document} 

在此輸入影像描述

相關內容