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 am currently writing a document in which I need to create a matrix that looks like the picture below. What is the shortest and easiest way to do so?

enter image description here

share|improve this question

1 Answer 1

Here I created the base image called \basefig. It is a box that has been manually centered with a \raisebox so that it will work smoothly in math mode. Then I inset two images relative to the left-top corner. The insets were scaled down versions of the original. Finally the third inset was the LL in the upper left corner.

EDITED to insert upper left element

\documentclass{article}
\usepackage{scalerel}
\usepackage[usestackEOL]{stackengine}
\setstackgap{S}{0pt}
\def\sqs{5ex}
\newsavebox\basebox
\def\bsfig{%
  \sffamily%
  \Shortstack{%
    \makebox[\sqs]{}\rule[-1.7ex]{.2pt}{\sqs}\makebox[\sqs]{HL}\\%
    \rule{9ex}{.2pt}\\%
    \makebox[\sqs]{LH}\rule[-1.7ex]{.2pt}{\sqs}\makebox[\sqs]{HH}\\%
  }%
}
\sbox\basebox{\bsfig}
\def\basefig{\raisebox{-.45\ht\basebox}{\usebox{\basebox}}}
\begin{document}
$\left[
\stackinset{l}{3pt}{t}{3.25pt}{\scalerel*{$\sffamily LL$}{\rule{.2pt}{0.3ex}}}{%
\stackinset{l}{2pt}{t}{2pt}{\scalerel*{$\basefig$}{\rule[-.7ex]{.2pt}{1.8ex}}}{%
\stackinset{l}{1pt}{t}{1pt}{\scalerel*{$\basefig$}{\rule[-1.75ex]{.2pt}{4.5ex}}}{%
\basefig%
}}}%
\right]$
\end{document}

enter image description here

share|improve this answer
    
+1 I like the simplicity of this approach using your packages! –  Gonzalo Medina Jan 30 at 15:32

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.