TransWikia.com

Horizontal line in matrix not well balanced

TeX - LaTeX Asked by Cham on August 3, 2020

I’m having troubles in drawing an horizontal line inside a matrix. As from this MWE code, the line isn’t well balanced relative to the equal sign (it should be aligned, vertically), and there’s a pesky white hole below the middle:

documentclass[11pt,letterpaper,twoside]{book}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
usepackage{microtype}
usepackage{amsmath}
usepackage{amsfonts}
usepackage{mathtools}
usepackage{tensor}

begin{document}

%setlength{abovedisplayskip}{1em}
setlength{abovedisplayshortskip}{0pt}
setlength{belowdisplayskip}{abovedisplayskip}
setlength{belowdisplayshortskip}{belowdisplayskip}
setlength{jot}{3ex}

    begin{equation}
        R = left[ begin{array}{ccc|ccc}
        tensor{R}{_{0101}} & tensor{R}{_{0102}} & tensor{R}{_{0103}} & tensor{R}{_{0123}} & tensor{R}{_{0131}} & tensor{R}{_{0112}} \[2ex]
        tensor{R}{_{0102}} & tensor{R}{_{0202}} & tensor{R}{_{0203}} & tensor{R}{_{0223}} & tensor{R}{_{0231}} & tensor{R}{_{0212}} \[2ex]
        tensor{R}{_{0103}} & tensor{R}{_{0203}} & tensor{R}{_{0303}} & tensor{R}{_{0323}} & tensor{R}{_{0331}} & tensor{R}{_{0312}}
        \[dimexpr 1ex+2arrayrulewidth] hline \[dimexpr 1ex-2arrayrulewidth-jot]
        tensor{R}{_{0123}} & tensor{R}{_{0223}} & tensor{R}{_{0323}} & tensor{R}{_{2323}} & tensor{R}{_{2331}} & tensor{R}{_{2312}} \[2ex]
        tensor{R}{_{0131}} & tensor{R}{_{0231}} & tensor{R}{_{0331}} & tensor{R}{_{2331}} & tensor{R}{_{3131}} & tensor{R}{_{3112}} \[2ex]
        tensor{R}{_{0112}} & tensor{R}{_{0212}} & tensor{R}{_{0312}} & tensor{R}{_{2312}} & tensor{R}{_{3112}} & tensor{R}{_{1212}}
    end{array} right]!.
    end{equation}

end{document}

Preview:

enter image description here

So how can I modify that code so the horizontal line is well balanced vertically in the matrix, without that whiloe hole under it?

One Answer

from --https://tex.stackexchange.com/questions/240859/dividing-line-in-a-matrix

enter image description here

documentclass{article}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
usepackage{microtype}
usepackage{amsmath}
usepackage{amsfonts}
usepackage{mathtools}
usepackage{booktabs}
usepackage{tensor}
begin{document}
    [
    M = 
    left( begin{array}{c|c}
    A & B \
    midrule
    C & D \
    end{array}right)
    ]
    [
     R = left[ begin{array}{ccc|ccc}
        tensor{R}{_{0101}} & tensor{R}{_{0102}} & tensor{R}{_{0103}} & tensor{R}{_{0123}} & tensor{R}{_{0131}} & tensor{R}{_{0112}} \[2ex]
        tensor{R}{_{0102}} & tensor{R}{_{0202}} & tensor{R}{_{0203}} & tensor{R}{_{0223}} & tensor{R}{_{0231}} & tensor{R}{_{0212}} \[2ex]
        tensor{R}{_{0103}} & tensor{R}{_{0203}} & tensor{R}{_{0303}} & tensor{R}{_{0323}} & tensor{R}{_{0331}} & tensor{R}{_{0312}}
        \ midrule
        tensor{R}{_{0123}} & tensor{R}{_{0223}} & tensor{R}{_{0323}} & tensor{R}{_{2323}} & tensor{R}{_{2331}} & tensor{R}{_{2312}} \[2ex]
        tensor{R}{_{0131}} & tensor{R}{_{0231}} & tensor{R}{_{0331}} & tensor{R}{_{2331}} & tensor{R}{_{3131}} & tensor{R}{_{3112}} \[2ex]
        tensor{R}{_{0112}} & tensor{R}{_{0212}} & tensor{R}{_{0312}} & tensor{R}{_{2312}} & tensor{R}{_{3112}} & tensor{R}{_{1212}}
    end{array} right]!.
    ]
end{document}

edit -- with intersection no hole aligned to = sign

 R = left[ begin{array}{@{,}ccc|ccc@{,}}
        tensor{R}{_{0101}} & tensor{R}{_{0102}} & tensor{R}{_{0103}} & tensor{R}{_{0123}} & tensor{R}{_{0131}} & tensor{R}{_{0112}} \
        tensor{R}{_{0102}} & tensor{R}{_{0202}} & tensor{R}{_{0203}} & tensor{R}{_{0223}} & tensor{R}{_{0231}} & tensor{R}{_{0212}} \
        tensor{R}{_{0103}} & tensor{R}{_{0203}} & tensor{R}{_{0303}} & tensor{R}{_{0323}} & tensor{R}{_{0331}} & tensor{R}{_{0312}}
        \ hline
        tensor{R}{_{0123}} & tensor{R}{_{0223}} & tensor{R}{_{0323}} & tensor{R}{_{2323}} & tensor{R}{_{2331}} & tensor{R}{_{2312}} \
        tensor{R}{_{0131}} & tensor{R}{_{0231}} & tensor{R}{_{0331}} & tensor{R}{_{2331}} & tensor{R}{_{3131}} & tensor{R}{_{3112}} \
        tensor{R}{_{0112}} & tensor{R}{_{0212}} & tensor{R}{_{0312}} & tensor{R}{_{2312}} & tensor{R}{_{3112}} & tensor{R}{_{1212}}
    end{array} right]!.

enter image description here

Answered by js bibra on August 3, 2020

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