amsmath 括号内的一对图片环境

amsmath 括号内的一对图片环境

为了节省空间,我使用图片环境绘制了一些位数组。绘制过程很简单,但是当将一对数组放在 amsmath 括号内时,会出现一些间距问题:括号的高度太大。

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\setlength{\unitlength}{1.25ex}
\linethickness{0.25pt}
\begin{equation*}
\left(%
\begin{picture}(17,8)(0,2.5)%
\multiput(0,0)(1,0){18}{\line(0,1){8}}%
\multiput(0,0)(0,1){9}{\line(1,0){17}}%
\end{picture}
,\
\begin{picture}(8,17)(0,5.5)%
\multiput(0,0)(1,0){9}{\line(0,1){17}}%
\multiput(0,0)(0,1){18}{\line(1,0){8}}%
\end{picture}
\right)
\end{equation*}
\end{document}

有没有办法控制高度?

答案1

您不需要自己移动图片的基线,只需将其交给 TeX 即可。

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation*}
\setlength{\unitlength}{1.25ex}
\linethickness{0.25pt}
\left(
  \begin{gathered}
  \begin{picture}(17,8)
  \multiput(0,0)(1,0){18}{\line(0,1){8}}
  \multiput(0,0)(0,1){9}{\line(1,0){17}}
  \end{picture}
  \end{gathered}
\, , \quad
  \begin{gathered}
  \begin{picture}(8,17)
  \multiput(0,0)(1,0){9}{\line(0,1){17}}
  \multiput(0,0)(0,1){18}{\line(1,0){8}}
  \end{picture}
  \end{gathered}
\,
\right)
\end{equation*}

\begin{equation*}
\setlength{\unitlength}{1.25ex}
\linethickness{0.25pt}
\left(
\raisebox{\dimexpr -0.5\height + 0.5\unitlength}{%
  \begin{picture}(17,8)
  \multiput(0,0)(1,0){18}{\line(0,1){8}}
  \multiput(0,0)(0,1){9}{\line(1,0){17}}
  \end{picture}%
}
\, , \quad
\raisebox{\dimexpr -0.5\height + 0.5\unitlength}{%
  \begin{picture}(8,17)
  \multiput(0,0)(1,0){9}{\line(0,1){17}}
  \multiput(0,0)(0,1){18}{\line(1,0){8}}
  \end{picture}%
}
\,
\right)
\end{equation*}

\end{document}

我会对环境\unitlength进行设置,或者在序言中设置。\linethicknessequation

在第二种情况下,居中更准确;由于 TeX 的决定大小的机制,括号不能完全覆盖图片。

在此处输入图片描述

相关内容