# Why does not blockarray align when used in array?

In the following example

\documentclass{article}

\usepackage{blkarray}

\begin{document}

\begin{displaymath}
\begin{array}{r@{\;=\;}l}
c & \begin{blockarray}{[c]c}
0 & \scriptstyle m_1
\end{blockarray}
\end{array}
\end{displaymath}

\end{document}


the result is

Why doesn't the blkarray align with c?

Not a surprise, I'm afraid: blkarray uses several tricks that end up using a bounding box that's not necessarily the expected one.

\documentclass{article}
\usepackage{blkarray}

\begin{document}

\setlength{\fboxsep}{0pt}\setlength{\fboxrule}{0.1pt}

X$\begin{blockarray}{[c]c} 0 & \scriptstyle m_1 \end{blockarray}$X

X\fbox{$\begin{blockarray}{[c]c} 0 & \scriptstyle m_1 \end{blockarray}$}X

\end{document}


In this particular case, not tested in different situations, you can do by moving the box.

\documentclass{article}
\usepackage{blkarray}

{\begin{lrbox}{\adjblockarraybox}$\begin{blockarray}} {\end{blockarray}$\end{lrbox}%

\begin{document}

\setlength{\fboxsep}{0pt}\setlength{\fboxrule}{0.1pt}

X$\begin{blockarray}{[c]c} 0 & \scriptstyle m_1 \end{blockarray}$X

X$\begin{adjblockarray}{[c]c} 0 & \scriptstyle m_1 \end{adjblockarray}$X

X\fbox{$\begin{adjblockarray}{[c]c} 0 & \scriptstyle m_1 \end{adjblockarray}$}X

$\begin{array}{r@{\;=\;}l} c & \begin{adjblockarray}{[c]c} 0 & \scriptstyle m_1 \end{adjblockarray} \end{array}$

\end{document}


• I modified your adjblockarray to take an extra argument to represent the offset. This was exactly what I needed. – gablin Aug 3 '17 at 9:19