4

The following code:

\documentclass[a4paper]{report}
\usepackage{amsmath,amsfonts,amssymb,multirow}
\usepackage{mathtools}
\newcommand{\sq}[1]{\left[#1\right]}
\DeclareSymbolFont{bbold}{U}{bbold}{m}{n}
\DeclareSymbolFontAlphabet{\mathbbold}{bbold}
\newcommand{\blocks}[9][-10]{\!\!\begin{array}{cccc}%
    #2&#3\hspace{-0.2cm}&%
    \multicolumn{2}{r}{\multirow{2}{*}{\raisebox{-14pt}{\scalebox{1}[1.3]{\Huge{$\vert$}}}%
    \hspace{0.2cm}\raisebox{#1pt}{\Huge{$#6$}}}}\\%
    #4&#5\hspace{-0.2cm}\\[0.2em]%
    \hline\multicolumn{2}{r}{\multirow{2}{*}{\raisebox{#9pt}{\Huge{$#7$}\hspace{-0.2cm}}}}&%
    \multicolumn{2}{r}{\multirow{2}{*}{\raisebox{-5pt}{\scalebox{1}[1]{\Huge{$\vert$}}}%
    \hspace{0.2cm}\raisebox{#9pt}{\Huge{$#8$}}}}\\\\%
    \end{array}\!\!}

\begin{document}
$$\sq{\blocks[-13]{\cosh\theta_v}{-\sinh\theta_v}{\sinh\theta_v}{\cosh\theta_v}
    {\mathbbold{0}}{\mathbbold{0}\quad\,\,\,}{\mathbbold{1}}{-7}}.$$
$$\sq{\blocks[-13]{\cosh\theta_v}{-\sinh\theta_v}{\sinh\theta_v}{\cosh\theta_v}
    {\mathbbold{0}}{\mathbbold{0}\quad\,\,\,}{\mathbbold{1}}{1}}.$$
\end{document}

typesets to:

enter image description here

Why does that vertical bar on the "second" row move down as the multicolumn-multirows of that row move up? And why does this macro, with cc|cc in the array definition, create a vertical line that stops at the \hline and doesn't go below it?

  • It's quite hard to follow what those macros are supposed to do. They seem to be ad hoc for that problem; do you mind if I show a completely different realization? – egreg Jan 18 '14 at 11:40
  • OK go ahead, try it. – MickG Jan 18 '14 at 12:05
3

I'd never use a macro with nine arguments.

\documentclass[a4paper]{report}
\usepackage{mathtools}

% Let's go all the way and define \mathbbold at every size
\DeclareFontFamily{U}{bbold}{}
\DeclareFontShape{U}{bbold}{m}{n}
   {  <-5.5> bbold5 <5.5-6.5> bbold6 <6.5-7.5> bbold7
      <7.5-8.5> bbold8 <8.5-9.5> bbold9 <9.5-11> bbold10
      <11-15> bbold12 <15-> bbold17 }{}
\DeclareSymbolFont{bbold}{U}{bbold}{m}{n}
\DeclareSymbolFontAlphabet{\mathbbold}{bbold}

\makeatletter
\newcommand{\bigblock}[2][\Huge]{%
  \mkern9mu
  \vcenter{\kern.3ex\hbox{#1$\m@th\mathstrut\mathbbold{#2}$}}%
  \mkern9mu
}
\makeatother
\newenvironment{arblock}[1]
  {\begin{array}{@{}#1@{}}}
  {\end{array}}


\begin{document}

\[
\left[\begin{array}{@{}c|c@{}}
\begin{arblock}{cc}
\cosh\theta_v & -\sinh\theta_v \\
\sinh\theta_v & \cosh\theta_v
\end{arblock}
  & \bigblock{0} \\
\hline
  \bigblock{0} & \bigblock{1}
\end{array}\right]
\]

\end{document}

enter image description here

The command \bigblock has an optional argument, default value \Huge; you can use \bigblock[\Large]{0} or even \bigblock[\fontsize{54}{0}\selectfont]{0} if you want an extralarge symbol.

|improve this answer|||||
  • Seems fine. What do \mkern9mu, \kern.3ex, \m@th, \mathstrut and @{} do? – MickG Jan 18 '14 at 15:21
  • @MickG \mkern9mu is to give a bit more room to the big numbers; \kern.3ex to lower them a bit; \m@th for avoiding possible interaction with mathsurround, \mathstrut inserts an invisible character as high and deep as a parenthesis; @{} removes the padding space before or after a column in array or tabular. – egreg Jan 18 '14 at 15:41
  • And what is mathsurround? – MickG Jan 18 '14 at 16:34
  • @MickG See tex.stackexchange.com/questions/149694/… – egreg Jan 18 '14 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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