10

I would like to use the \verb command inside of a tabu enviroment. Here is my example

\documentclass{article}

\usepackage{tabu}

\begin{document}

\begin{tabu}{lll}
a & \verb+\wedge+ & b\\
c & d & e
\end{tabu}

\end{document}

I get the following compiler error:

! Missing $ inserted.

Is it possible to use inline listings within a tabu enviroment?

2 Answers 2

12

With the starrred version of the tabu environment (from the tabu package), the document compiles without warnings or errors.

\documentclass{article}

\usepackage{tabu}

\begin{document}

\begin{tabu*}{lll}
a & \verb|\wedge| & b\\
c & d             & e
\end{tabu*}

\end{document}

output

See the top of page 7 of the documentation.

5

The verbatimbox package puts verbatim in a box so that it can be used in, for example, tables later on. [EDITED to show multiple instances of verbatim text in table.]

RE-EDITED 31-JUL-13 to show space-saving use of myverbbox environment. I leave the blank optional arguments there only to show that myverbbox can take optional arguments.

\documentclass{article}
\usepackage{verbatimbox}
\usepackage{tabu}
\begin{document}
\begin{myverbbox}[]{\wedgebox}
\wedge
\end{myverbbox}
\begin{myverbbox}[]{\simbox}
\sim
\end{myverbbox}
\begin{tabu}{lll}
a & \wedgebox & b\\
c & \simbox & e\\
\end{tabu}
\end{document}

enter image description here

3
  • And how can I use multiple listings within a table?
    – konze
    Apr 15, 2013 at 14:49
  • can you be more explicit?
    – cacamailg
    Apr 15, 2013 at 15:21
  • @StevenB.Segletes I was just asking to konze to reformulate his comment about multiple listings.
    – cacamailg
    Apr 15, 2013 at 15:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .