将一个用方括号括起来的列向量放在三列表格中?

将一个用方括号括起来的列向量放在三列表格中?

我有一张 3 列表,第三列表示一个 $20\times 1$ 向量。我想在这个向量的两边加上方括号。

\documentclass[a4paper,12pt,times,numbered,print,index]{Classes/PhDThesisPSnPDF}

\RequirePackage[left=37mm,right=30mm,top=35mm,bottom=30mm]{geometry}
\RequirePackage{libertine} 
\RequirePackage[small,bf]{caption}
\RequirePackage[labelsep=space,tableposition=top]{caption} 
\usepackage{subfig}  
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{braket}
\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx

\begin{document}

\begin{table}[ph]
  \centering
  \begin{tabular}{| >{$}c<{$} | >{$}c<{$} | >{$}c<{$} |}
    \hline
    \text{Position} & \text{State} & \text{P} \\
    \hline
    \multirow{4}{*}{-2} 
    & \ket{\leftarrow, 0}   & 0 \\
    & \ket{\leftarrow, 1}   & 0 \\
    & \ket{\rightarrow, 0}  & 0 \\
    & \ket{\rightarrow, 1}  & 0 \\
    \hhline{--~}
    \multirow{4}{*}{-1} 
    & \ket{\leftarrow, 0}   & 0 \\
    & \ket{\leftarrow, 1}   & 0 \\
    & \ket{\rightarrow, 0}  & 0 \\
    & \ket{\rightarrow, 1}  & 0 \\
    \hhline{--~}
    \multirow{4}{*}{0} 
    & \ket{\leftarrow, 0}   & 1 \\
    & \ket{\leftarrow, 1}   & 0 \\
    & \ket{\rightarrow, 0}  & 0 \\
    & \ket{\rightarrow, 1}  & 0 \\
    \hhline{--~}
    \multirow{4}{*}{1} 
    & \ket{\leftarrow, 0}   & 0 \\
    & \ket{\leftarrow, 1}   & 0 \\
    & \ket{\rightarrow, 0}  & 0 \\
    & \ket{\rightarrow, 1}  & 0 \\
    \hhline{--~}
    \multirow{4}{*}{2} 
    & \ket{\leftarrow, 0}   & 0 \\
    & \ket{\leftarrow, 1}   & 0 \\
    & \ket{\rightarrow, 0}  & 0 \\
    & \ket{\rightarrow, 1}  & 0 \\
    \hline    
  \end{tabular}
  \caption{Interpretation of the particle matrix for a $1$-step memory walk. Observe that for each position we are able
  to represent the p}
  \label{T:peak}
\end{table}
\end{document}

有人知道如何在向量 P 的两边放置方括号吗?

答案1

您可以通过以下方式实现您的目标:(a) 将环境拆分tabular为两个array并排放置的独立环境,(b) 将方括号括起来的列向量放在第二个 中array,该 仅包含一列。(为什么array不用tabular?因为除标题行外,排版的材料都与数学有关;使用array似乎更自然。)第二个array环境包含 (i) 标题行和 (ii) 嵌套array环境,其中包含 20 个元素的向量,用方括号括起来。请注意[0.4pt]在列向量的每四行后使用额外的间距:这允许 的宽度\hline,等于(您猜对了)0.4pt

我故意将列向量周围的方括号间距设置得比较紧。如果您想要更多空间,可以将该指令替换\begin{array}{@{}c@{}}为,例如\begin{array}{@{\hspace{1pt}}c@{\hspace{1pt}}}

最后,由于我无法访问PhDThesisPSnPDF文档类,因此我用该类进行了替换article

在此处输入图片描述

\documentclass[a4paper,12pt,times,numbered,print,index]{article}   
\RequirePackage[left=37mm,right=30mm,top=35mm,bottom=30mm]{geometry}
\RequirePackage{libertine} 
\RequirePackage[small,bf,labelsep=space,
    tableposition=top]{caption} 
\usepackage{multirow}  
\usepackage{subfig,amsfonts,amsmath,amssymb,braket}
\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx

\begin{document}
\begin{table}
  \centering
  $  % start math mode
  \begin{array}{| c | c |}
  \hline
    \text{Position} & \text{State}  \\
    \hline
    \multirow{4}{*}{$-$2} 
    & \ket{\leftarrow, 0}   \\
    & \ket{\leftarrow, 1}   \\
    & \ket{\rightarrow, 0}  \\
    & \ket{\rightarrow, 1}  \\
    \hline
    \multirow{4}{*}{$-$1} 
    & \ket{\leftarrow, 0}   \\
    & \ket{\leftarrow, 1}   \\
    & \ket{\rightarrow, 0}  \\
    & \ket{\rightarrow, 1}  \\
    \hline
    \multirow{4}{*}{0} 
    & \ket{\leftarrow, 0}   \\
    & \ket{\leftarrow, 1}   \\
    & \ket{\rightarrow, 0}  \\
    & \ket{\rightarrow, 1}  \\
    \hline
    \multirow{4}{*}{1} 
    & \ket{\leftarrow, 0}   \\
    & \ket{\leftarrow, 1}   \\
    & \ket{\rightarrow, 0}  \\
    & \ket{\rightarrow, 1}  \\
    \hline
    \multirow{4}{*}{2} 
    & \ket{\leftarrow, 0}   \\
    & \ket{\leftarrow, 1}   \\
    & \ket{\rightarrow, 0}  \\
    & \ket{\rightarrow, 1}  \\
  \hline    
  \end{array}% no separation between the two arrays
  \begin{array}{c|}
  \hline
  \text{P}\\ 
  \hline
    \left[ \begin{array}{@{}c@{}}
    0 \\ 0 \\ 0 \\ 0 \\[0.4pt]  
    0 \\ 0 \\ 0 \\ 0 \\[0.4pt] 
    1 \\ 0 \\ 0 \\ 0 \\[0.4pt]   
    0 \\ 0 \\ 0 \\ 0 \\[0.4pt]   
    0 \\ 0 \\ 0 \\ 0 \\  
    \end{array}\right] \\ 
  \hline
  \end{array} 
  $  % end of math mode
  \caption{Interpretation of the particle matrix for a $1$-step memory walk. 
      Observe that for each position we are able to represent the p}
  \label{T:peak}
\end{table}
\end{document}

相关内容