Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 8 down vote accepted

With the starrred version of tabu (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.

share|improve this answer

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

share|improve this answer
    
And how can I use multiple listings within a table? –  konze Apr 15 '13 at 14:49
    
can you be more explicit? –  cacamailg Apr 15 '13 at 15:21
    
@StevenB.Segletes I was just asking to konze to reformulate his comment about multiple listings. –  cacamailg Apr 15 '13 at 15:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.