Math & ScienceHorizontal Line across Matrix

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
vaibhavtewari
Posts: 2
Joined: Sun Jun 03, 2012 1:04 am

Horizontal Line across Matrix

Post by vaibhavtewari »

Hello friends

I am trying to produce a line across a matrix such that it is between rows, but I am not succeeding. Can anyone help, I am attaching my desired output.

thanks
Attachments
image.png
image.png (2.4 KiB) Viewed 27729 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Horizontal Line across Matrix

Post by localghost »

Two possible solutions.
Both are shown in the below code. Choose what's best for you.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{mathtools}   % loads »amsmath«

\begin{document}
  \[
    \left[
    \begin{array}{cccc}
      \lambda_0 & 0 & 0 & \cdot \\
      0 & \lambda_1 & 0 & \cdot \\ \hline
      0 & 0 & \lambda_3 & \cdot \\
      \cdot & \cdot & \cdot & \cdot
    \end{array}
    \right]
  \]

  \[
    \begin{bmatrix}
      \lambda_0 & 0 & 0 & \cdot \\
      0 & \lambda_1 & 0 & \cdot \\ \hline
      0 & 0 & \lambda_3 & \cdot \\
      \cdot & \cdot & \cdot & \cdot
    \end{bmatrix}
  \]
\end{document}

Best regards and welcome to the board
Thorsten
vaibhavtewari
Posts: 2
Joined: Sun Jun 03, 2012 1:04 am

Re: Horizontal Line across Matrix

Post by vaibhavtewari »

Thank You very much, it helped.

-Vaibhav
egpuckett
Posts: 1
Joined: Thu Jan 17, 2013 11:59 pm

Re: Horizontal Line across Matrix

Post by egpuckett »

Does anyone know how to add vertical space on either side of the \hline in this example? The usual approach, namely,

foo \\[3pt] \hline \\ [3pt]
foo \\
that one can use in a table environment does not work in a matrix environment in math mode.
Post Reply