0

I would like to construct following table:enter image description here

Kindly suggest me some way to do the same.

This is my try:

\begin{table}
\centering
$B_{int}$= \begin{tabular}{|l|l|l|}
\hline
$B_{CVP}$ &            & $t$ \\ \hline
          & $B_{BCH}$ & $s$ \\ \hline
\end{tabular}
\end{table}

Basically, I don't know how to assign variable width and height.

4
  • Please add what you've got so far and which part of the shown tables troubles you. The pictures just show two figures which should be achievable using ordinary tabular and its width-dependent column types in combination with some tikz.
    – TeXnician
    Feb 8, 2017 at 7:52
  • 2
    Welcome to TeX.SX!. What have you done so far? Please add a minimal working example (MWE).
    – CarLaTeX
    Feb 8, 2017 at 7:53
  • 1
    You could also use a tikz \matrix. Feb 8, 2017 at 7:55
  • For variable width and height you can use p{width} as column type for the width and a \vspace*{height-contentheight} as filler for the height.
    – TeXnician
    Feb 8, 2017 at 8:00

1 Answer 1

2

I think the general question here is to create a tabular cell with a specified width and height with the content centralised both horizontally and vertically. There are some other parts needed also to recreate the picture but I will concentrate on the cell. There are some different settings to get a cell with a certain width, the most obvious is p{2cm} which is a paragraph of width 2cm.

In the array packet there are some more, where m{2cm} is useful here. The contents is vertically centered and left align in a cell of width 2cm. To get the horizontal center, specify a column type like

\newcolumntype{T}[1]{>{\centering\arraybackslash}m{#1}}

where T{2cm} gives the desired cell. Then to give the height of the cell I specify a new column type

\newcolumntype{E}[1]{@{}m{0pt}@{}}

which is a cell of no horizontal space. Then I set a zero width rule (black box) of the height I want. This will span the row in the desired height.

\documentclass{article}
\usepackage{array}
\newcolumntype{E}[1]{@{}m{0pt}@{}}
\newcolumntype{T}[1]{>{\centering\arraybackslash}m{#1}}
\begin{document}
A
\begin{tabular}[c]{| E | T{3cm} |}
  \hline
  \rule{0pt}{2cm} & B \\\hline
\end{tabular}
\end{document}

enter image description here

In the picture the horizontal spacing is not really needed to set, it can follow the content in other cells in the row. But the centering as above can be used, but since it is math formulas I alter it to array instead of tabular. So parts of the picture can be done as follows.

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\newcolumntype{E}[1]{@{}m{0pt}@{}}
\newcolumntype{M}[1]{>{\centering\arraybackslash$}m{#1}<{$}}
\begin{document}
\begin{displaymath}
  B_{\mathrm{BCH}}=
  \begin{array}[c]{|E|M{2.7cm}|M{2.5cm}|M{1cm}|M{0.8cm}|}
    \cline{1-3}\cline{5-5}
    & QP_{\mathrm{BCH}}
    &
      \setlength\arraycolsep{3pt}
      \begin{matrix}
        2Q & & & \\
        & 2Q & & \\
        & & \ddots & \\
        & & & 2Q
      \end{matrix}
      & &
          Qs'
    \\\cline{1-3}\cline{5-5}
    & \setlength\arraycolsep{4pt}
      \ \begin{matrix}
        1 & & & & & \\
        & 1 & & & & \\
        & & 1 & & & \\
        & & & 1 & & \\
        & & & & \ddots & \\
        & & & & & 1
      \end{matrix}
        & & &
    \\\cline{1-3}\cline{5-5}
    \multicolumn{2}{c}{%
    \begin{matrix}
      z_1 & z_2 & \cdots & z_N
    \end{matrix}}
    &     
    \multicolumn{1}{c}{%
    \begin{matrix}
      y_1 & y_2 & \cdots & y_h
    \end{matrix}}
  \end{array}
  =s
\end{displaymath}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .