Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've got simple task - draw block of matrices, when one of the matrices contains diagonal and vertical lines. I am able to make diagonal dotted lines but so far i have not succeeded with solid line. Example of my matrix follows:

enter image description here

 \begin{pmatrix}
 \hat{B} &         & & & \\
         & ddots & & & \\
         &         & ddots & & \\
         &         & &  ddots \\\hline
         \\
          \\
       & & \text{{\huge{0}}}  & &  \\
         \\
 \end{pmatrix} 
share|improve this question
1  
Look at Creating straight line in matrix –  Ignasi Oct 22 '12 at 15:38
    
You mean that you want a solid line instead of the diagonal dots? –  egreg Oct 22 '12 at 15:43
    
I would like to have one solid diagonal line across the whole matrix, or better to say across the upper part –  jiri jansa Oct 22 '12 at 15:59
    
Highly related: Diagonal dots spanning multiple lines/columns of a matrix. You can use some of those answers as well and just change the line style. –  Werner Oct 22 '12 at 19:03
add comment

1 Answer

up vote 3 down vote accepted

One possibility is to use \tikzmark to place marks at the beginning and end of the lines and then draw them:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}

\newcommand\tikzmark[1]{%
  \tikz[overlay,remember picture,baseline] \node [anchor=base] (#1) {};}

\newcommand\MyLine[3][]{%
  \begin{tikzpicture}[overlay,remember picture]
    \draw[#1] (#2.north west) -- (#3.south east);
  \end{tikzpicture}}

\begin{document}

\[
\begin{pmatrix}
\phantom{0}\tikzmark{a} & & & &  \\
& & & & \\
& & & & \\
& & & & \tikzmark{b}\phantom{0}\\\hline
\\
\\
\multicolumn{5}{c}{\text{\huge 0}} \\
\\
\end{pmatrix}\qquad
\begin{pmatrix}
\phantom{0}\tikzmark{c} & \phantom{0}\tikzmark{e} & & &  \\
& & & & \\
& & & & \tikzmark{f}\phantom{0} \\
& & & & \tikzmark{d}\phantom{0}\\\hline
\\
\\
\multicolumn{5}{c}{\text{\huge 0}} \\
\\
\end{pmatrix}
\] 
\MyLine[ultra thick]{a}{b}
\MyLine[blue,thick]{c}{d}
\MyLine[blue,thick]{e}{f}

\end{document}

enter image description here

share|improve this answer
    
works perfect ! –  jiri jansa Oct 23 '12 at 7:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.