# easybmat matrices dotted lines

I use the easybmat package to typeset some block matrices as follows, where the rows are separated by dotted lines. For some reason, the dotted lines don't always come out right. For example the following MWE:

\documentclass{standalone}
\usepackage{easybmat}
\begin{document}
$\left[ \begin{BMAT}(@){c}{c.c} A \\ B \end{BMAT}\right]$
\end{document}


renders as:

Notice the extra long right-most dot? The unequal-sized dots are pdf viewer artifacts that may be ignored, but the right-most "dot" really looks ugly in print. Does anyone here know how to fix this?

-

if you look closely at the output, you will see that the "dots" aren't individual glyphs, but small drawn line segments, usually square. i haven't examined the code that generates them, but i have determined that the size of the last line segment seems to depend on the width of the widest element in the matrix. for example, if you replace B with M, the last "dot" is the same size as all the rest. (more experimentation or investigation is needed to see if there's a lower or upper boundary on the effective width.)

with the knowledge that the effect is width-dependent, it's possible to adjust the effective width to get a nice result. adding some tiny spaces or decreasing the space by a tiny bit around the elements yields a more pleasing result:

\documentclass[12pt]{article}
\usepackage{easybmat}
\begin{document}
\Large
$\left[ \begin{BMAT}(@){c}{c.c} A \\ B \end{BMAT}\right]$
%
$\left[ \begin{BMAT}(@){c}{c.c} A \\ \mkern1mu B\mkern1mu \end{BMAT}\right]$
%
$\left[ \begin{BMAT}(@){c}{c.c} A \\ \mkern-1mu B\mkern-1mu \end{BMAT}\right]$

\end{document}


note that the adjustments are size-dependent (hence the use here of the article class with [12pt] and \Large to get a clear image), so some experimentation may be needed.

i will try to figure out where the non-square line segments are being drawn in the package, but this won't happen immediately. the code is definitely flawed in this respect. (and the package is quite old, so an update may not be likely. there may also be a better/newer approach that i don't know about.)

-
Thank you! But I have a lot of these matrices (stupid me thinking that it would be fixed in a later TeXlive release), so fixing them by hand is going to be a lot of work. And what if I have to change the font? :) –  Yori Jun 11 '13 at 20:26
@Yori -- amsmath has a bmatrix which has \hdotsfor{<cols>}, but (1) the vertical spacing is really excessive for simple matrices like yours, and (2) the dots are a lot farther apart. but i may be able to come up with an alternate definition for \hdotsfor to alleviate those two disfunctions. would you like me to try that instead? –  barbara beeton Jun 11 '13 at 20:35
@barbara_beeton: please don't spend too much time on this. I was hoping that there would be a simple fix to get the easybmat matrices to render properly. But if I have to edit my matrix code anyway, I will probably implement my own block matrices using tikz. –  Yori Jun 11 '13 at 21:34