格式化矩阵下的箭头和文本

格式化矩阵下的箭头和文本

我希望能够写这个: https://i.stack.imgur.com/M9bMe.jpg

但我对箭头以及矩阵下方箭头的问题有点困惑。到目前为止,我得到了以下信息:

 \begin{pmatrix}
    1 & 2 & 3 & 4 \\
    \square & \square & \square & \square 
    \\   $\uparrow$
    \end{pmatrix}

谢谢您的帮助。

答案1

\documentclass{article}
\usepackage{amsmath,amssymb,tikz}
\newcommand{\Poss}[1]{\ifnum#1=1
\tikz[remember picture]{\node(node-#1){$\scriptscriptstyle
\begin{array}{c}#1~\text{possi-}\\
\text{bility}\end{array}$}}
\else
\tikz[remember picture]{\node(node-#1){$\scriptscriptstyle
\begin{array}{c}#1~\text{possi-}\\
\text{bilities}\end{array}$}}
\fi}
\begin{document}
\[\begin{pmatrix}
    1 & 2 & 3 & 4 \\
    \square & \square & \square & \square 
    \\   \uparrow & \uparrow &\uparrow &\uparrow \\
    \Poss{4} & \Poss{3} & \Poss{2} & \Poss{1} \\[-1.6cm]
    \end{pmatrix}\]
\tikz[overlay,remember picture]{\foreach \X [count=\Y] in {2,3,4}
{\path (node-\Y) -- (node-\X) node[midway]{$\scriptstyle\times$};}} 
\end{document}

在此处输入图片描述

答案2

您可以使用表格环境而不是矩阵。这是我的解决方案:

\documentclass{article} 


\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{multirow}
\usepackage{array}

\begin{document}

\begin{tabular}{ccccccc}

  \multirow{2}{*}{$\biggl($}

  & 1 & 2 & 3 & 4 &

  \multirow{2}{*}{$\biggr)$} \\
  & $\square$  & $\square$  & $\square$  & $\square$  & &\\
  & $\uparrow$ & $\uparrow$ & $\uparrow$ & $\uparrow$ & &\\
  & \multicolumn{1}{c!{\makebox[0pt]{$\times$}}}{\parbox{7ex}{\small 4 possibilities}}
  & \multicolumn{1}{c!{\makebox[0pt]{$\times$}}}{\parbox{7ex}{\small 3 possibilities}}
  & \multicolumn{1}{c!{\makebox[0pt]{$\times$}}}{\parbox{7ex}{\small 2 possibilities}}
  & {\parbox{7ex}{\small 1 possibilities}}
  & =
  & $4!$ possibilities \\
\end{tabular}


\end{document}

这是我得到的: 在此处输入图片描述

相关内容