表內 >{} 是什麼意思

表內 >{} 是什麼意思

誰能告訴我這是做什麼的?我想我已經明白了大部分

\newenvironment{keywords}{%
  \renewcommand{\arraystretch}{1.1}

  \begin{tabular}{>{}l>{}p{13cm}} 
}{%
  \end{tabular}
}

答案1

>{<stuff>}<col spec>在 atabulararray列規範中將插入到<stuff>的開頭<col spec>。它是由array包裹。舉個例子,

\begin{tabular}{>{\textbullet\space}l}
  First \\ Second \\ Third
\end{tabular}

tabular將建立一個包含三個項目的類似清單。

在您的情況下,<stuff>是空的,因此不執行任何操作(並且可以刪除)。

答案2

>{<content>}表格參數中的命令意味著將為<content>以下列的每個單元格執行(如果是命令)或顯示(如果是文字)(其類型由接下來的字母 - 這裡的 thelp- 定義)。如果您\Large在第一個欄位中新增例如命令>{}(並使其成為>{\Large}),那麼關鍵字的第一列(它們的名稱)將在表格中顯示為 Large 。

試試一下:

\documentclass[]{article}
\usepackage{array}
\newenvironment{keywords}{%
  \renewcommand{\arraystretch}{1.1}

  \begin{tabular}{>{\Large}l>{}p{13cm}} 
}{%
  \end{tabular}
}
\begin{document}

\begin{keywords}
 test & Here is a long keyword that will exceed one line and break to the second one\\
Another test & Here is a long keyword that will exceed one line and break to the second one\\
\end{keywords}
\end{document}

由於是空的,它們根本沒有添加任何內容,因此不會顯示或執行任何內容。

相反,如果他們@{}刪除列之間的額外空間,則會出現:

嘗試:

\documentclass[]{article}
\usepackage{array}
\newenvironment{keywords}{%
  \renewcommand{\arraystretch}{1.1}

  \begin{tabular}{>{}l@{}p{13cm}} 
}{%
  \end{tabular}
}
\begin{document}

\begin{keywords}
 test & Here is a long keyword that will exceed one line and break to the second one\\
Another test & Here is a long keyword that will exceed one line and break to the second one\\
\end{keywords}
\end{document}

相關內容