# Box diagram (with text in and around it)

How can the attached box diagram be drawn in latex? I have tried using the table environment, but it does not seem to work well. Is there a quicker and easier code for it?

• Welcome to TeX.SX! Your question leaves all the effort to our community, even typing the essentials of a TeX document such as \documentclass{}...\begin{document} etc. As it is, most of our users will be very reluctant to touch your question, and you are left to the mercy of our procrastination team who are very few in number and very picky about selecting questions. Consider adding a minimal working example (MWE) so that users can copy/paste it onto their systems to work on. If no hero takes the challenge we might have to close your question. Jul 27 '15 at 18:47

You can do this with a simple array:

The code:

\documentclass{article}
\usepackage{mathdots}
\usepackage{amsmath}

\begin{document}

$\renewcommand\arraystretch{1.6} \begin{array}{c|ccccccc|} \cline{2-8} y_{q+1} & z_{0} & & \raisebox{-30pt}[0pt][0pt]{\makebox[0pt]{\Huge0}} & & & & 0 \\ y_{q} & z_{q} & & & & & z_{0} & \\ y_{q-1} & z_{q-1} & & & & z_{0} & & \\ \vdots & \vdots & & & \iddots & & & \\ \vdots & \vdots & & z_{0} & & & & \\ y_{1} & z_{1} & z_ {0} & & & & \raisebox{20pt}[0pt][0pt]{\makebox[0pt]{\Huge0}} & \\ y_{0} & z_{q+1} & z_ {1} & z_{2} & \ldots & z_{q-1} & z_{q} & z_{0} \\ \cline{2-8} \multicolumn{1}{c}{} & x_{0} & x_ {1} & x_{2} & \ldots & x_{q-1} & x_{q} & \multicolumn{1}{c}{x_{q+1}} \end{array}$

\end{document}

• May I suggest the horizontal spacing would look better with \clap{\Huge$0$}? Jul 27 '15 at 18:39
• @Bernard Yes, thanks. I used some 0pt wide \makeboxs which are basically \clap's. Jul 27 '15 at 18:45
• But \clap is shorter to type, and forces loading mathtoolsif not already done, which isn't a bad thing, from my point of view. Jul 27 '15 at 18:49
• @Bernard I's rather stick to amsmath. I don't remember having to use mathtools ever (except for answer here), although I know it offers a lot of features. Jul 27 '15 at 18:57
• \DeclarePairedDelimiters or the different mathlaps commands are quite useful for fine-tuning math formulae, but that's a matter of personal habits. Jul 27 '15 at 19:01