テーブル内の >{} はどういう意味ですか

テーブル内の >{} はどういう意味ですか

これは何をするものか誰か教えてもらえますか?私は大部分を理解したと思います

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

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

答え1

>{<stuff>}<col spec>tabularまたはarray列指定内の は の<stuff>先頭に挿入されます<col spec>。これは、arrayパッケージ例えば、

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

tabular3 つの項目を含むリストのようなものを作成します。

あなたの状況では、<stuff>は空なので、何も実行されません (削除できます)。

答え2

>{<content>}表のパラメータ内のコマンドは、<content>次の列の各セルに対して が実行されるか (コマンドの場合)、表示される (テキストの場合) ことを意味します (そのタイプは次の文字 (ここではとl)から定義されますp)。たとえば、\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}

関連情報