TransWikia.com

easybmat matrices dotted lines

TeX - LaTeX Asked by yori on July 28, 2021

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:

enter image description here

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?

2 Answers

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:

output of example code

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 Bmkern1mu
end{BMAT}right]$
%
$left[
begin{BMAT}(@){c}{c.c}
A  mkern-1mu Bmkern-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.)

Correct answer by barbara beeton on July 28, 2021

For information, nicematrix provides, in its environments ({pNiceMatrix}, {bNiceMatrix}, etc.) a command hdottedline to draw horizontal dotted lines (and also a specifier : in the preamble of {NiceArray} for vertical dotted lines).

documentclass{article}
usepackage{nicematrix}

begin{document}
$begin{bNiceMatrix}
a & b & c & d 
a & b & c & d 
hdottedline
a & b & c & d 
end{bNiceMatrix}$
end{document}

Output of the above code

Answered by F. Pantigny on July 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP