AnswerBun.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|[email protected]{,}}
        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!

Related Questions

Minutes command in TeX

4  Asked on April 2, 2021 by user186178

   

Custom Header for a motivation letter

2  Asked on April 2, 2021 by ilya_curie

       

Midpoint arrows and shortening with the sep option

1  Asked on April 2, 2021 by hpekristiansen

   

resize table to fit landscape page

2  Asked on April 2, 2021 by brmbu

       

How to send edges to back in tikz trees

2  Asked on April 2, 2021 by luiz-fernando-puttow-southier

 

Why are my TikZ intersections not exact?

1  Asked on April 1, 2021 by peater-de-xel

   

ConTeXt and document class

0  Asked on April 1, 2021

     

Simple grid drawing in TikZ

1  Asked on April 1, 2021 by nikola-zubic

         

Splitting a long equation please help

1  Asked on April 1, 2021 by j-nyaboe

   

Xelatex not rendering selected IPA fonts

1  Asked on April 1, 2021 by mercurial

     

Make simple multiline Glossary

2  Asked on April 1, 2021 by user2741831

   

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir