垂直间距 - 对齐环境内的 blkarray 环境

垂直间距 - 对齐环境内的 blkarray 环境

我已经创建了自己的命令,使用以下命令创建标记列向量blkarray环境。当命令在align环境内使用时,会出现垂直间距问题。它产生了太多的垂直空间。

我曾经使用过\\[-3em]right after\begin{align}和 just before \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

这是解决方法,使用\useshortskipfromnccmath来处理上面的间距,并使用 simplle\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} 

在此处输入图片描述

相关内容