# Can I use \lstinline for table column?

I want to apply \lstinline to one of the columns. I don't like idea to put it in every cell manually.

I am trying to do

\begin{table}
\begin{center}
\begin{tabular}{| >{\lstinline}l | l |}
\hline
Имя класса & Назначение\\ \hline
Base & Базовый класс с функциями-утилитами \\ \hline
\end{tabular}
\end{center}
\end{table}


But pdflatex just hangs on these lines.

-
What is it that you want to do, since there might be other ways of accomplishing what you're after. –  Werner Jun 14 '12 at 3:09
@Werner I want words in one column to be styled as listing. I can write \lstinline$class_name$ in every column (at least I can use regular expressions to do that automatically) but I hope there are easier ways to do this. –  efpies Jun 14 '12 at 3:13
Is there a reason why this needs to be inside a tabular environment? –  Werner Jun 14 '12 at 3:41
@Werner Yes. This should be a placed in a table. –  efpies Jun 14 '12 at 4:11

You may try the collcell package, which allows you to define a column type that applies a macro to the content of each cell of columns of that type. Its applicability might depend on what exactly you want to achieve with \lstinline -- refer to the manual e.g. for the verb option.

\documentclass{article}

\usepackage{array}
\usepackage{collcell}
\usepackage{listings}

\newcommand{\mymacroA}[1]{\textbf{#1}}
\newcommand{\mymacroB}[1]{\lstinline{#1}}

\newcolumntype{E}{>{\collectcell\mymacroA}l<{\endcollectcell}}
\newcolumntype{F}{>{\collectcell\mymacroB}l<{\endcollectcell}}

\begin{document}
\begin{table}
\begin{center}
\begin{tabular}{| E | F |}
\hline
Text & Text \\\hline
Text & Text \\\hline
\end{tabular}
\end{center}
\end{table}

\end{document}

-