以下代码:
\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\hspace{-0.2cm}&%
\multicolumn{2}{r}{\multirow{2}{*}{\raisebox{-14pt}{\scalebox{1}[1.3]{\Huge{$\vert$}}}%
\hspace{0.2cm}\raisebox{#1pt}{\Huge{$#6$}}}}\\%
#4\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}
排版为:
为什么“第二”行上的垂直线会随着该行的多列多行向上移动而向下移动?为什么这个宏在cc|cc
数组定义中会创建一条垂直线,该垂直线会停止在 处\hline
,而不会低于 ?
答案1
我永远不会使用带有九个参数的宏。
\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}
该命令\bigblock
有一个可选参数,默认值;如果您想要一个超大符号,您也\Huge
可以使用。\bigblock[\Large]{0}
\bigblock[\fontsize{54}{0}\selectfont]{0}