0

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

enter image description here

Why doesn't the blkarray align with c?

1

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}

enter image description here

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

\documentclass{article}
\usepackage{blkarray}

\newenvironment{adjblockarray}
 {\begin{lrbox}{\adjblockarraybox}$\begin{blockarray}}
 {\end{blockarray}$\end{lrbox}%
  \raisebox{-1ex}[\dimexpr\height-1ex][\dimexpr\depth-1ex]{\usebox{\adjblockarraybox}}}
\newsavebox{\adjblockarraybox}

\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}

enter image description here

| improve this answer | |
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.