0

In this example tabular environment works fine, but tabularx produces an error.

\documentclass{book}
\usepackage{tabularx}

\begin{document}

\begin{tabular}{l l} \verb@{@ & cell2 \ \end{tabular}

\begin{tabularx}{\textwidth}{lX lX} \verb@{@ & cell2 \ \end{tabularx}

\end{document}

The error is

File ended while scanning use of \TX@get@body.
Yola
  • 481
  • 1
    this is documented in the tabularx documentation, the body of tabularx is the argument of a macro, and verb does not work in macro arguments, use \texttt{\{} – David Carlisle Jan 10 '21 at 01:19
  • @DavidCarlisle could you please turn your comment into an answer? – Yola Jan 10 '21 at 01:21
  • @DavidCarlisle but this one works all right \begin{tabularx}{\textwidth}{lX}\verb@\0@\end{tabularx}? – Yola Jan 10 '21 at 01:24
  • 1
    see the tabularx manual there is a simple version of verb, for tabularx that can cope with simple strings, but can not do hard things like a mis-matched brace – David Carlisle Jan 10 '21 at 01:43

1 Answers1

1

this is documented in the tabularx documentation, the body of tabularx is the argument of a macro, and verb does not work in macro arguments, use \texttt{\{} (a simple version of verb is implemented for tabularx but can not take a mis-matched brace.

David Carlisle
  • 757,742