0

I tried using the solution provided here (https://tex.stackexchange.com/a/102122/69378) to fix the lstings look ahead problem with tabular to fix the same problem using longtable, but to know avail.

What do I need to change to make lstings work with longtable, and just for my own information, what is different about how longtable and tabular implement their curly brace searches? I thought this would have been common because it would have been done at base level of TeX internals as alluded to in the linked answer.

\documentclass{article}

\usepackage{longtable}
\usepackage{listings}

\begin{document}

    Test \lstinline{Test}

    And the table:

    \begin{longtable}{l l}
        Test & Test \\
%       Test & \lstinline{Test} \\ % doesn't work
%       Test & {\lstinline{Test}} \\ % doesn't work - solution provided https://tex.stackexchange.com/a/102122/69378
    \end{longtable}

\end{document}
6
  • 1
    there is no difference between longtable and tabular \lstinline makes a multi-line display so needs to be in a p column not a one-line l column. Jun 5, 2017 at 12:43
  • @DavidCarlisle Thanks for such a rapid reply, I didn't think there was anything substantially different between longtable and tabular. When I change my second column to p or p{2cm} I still get a screen full of errors about braces and \cr
    – EngBIRD
    Jun 5, 2017 at 12:46
  • If you look carefully, the code is of the type \lstinline!test!, not with braces.
    – egreg
    Jun 5, 2017 at 12:58
  • @egreg I was hoping that wasn't actually the problem, the code I'm trying to escape has ! points in it.
    – EngBIRD
    Jun 5, 2017 at 13:02
  • @DavidCarlisle I did know that you can't use \verb{XYZ} but I figured because \lstinline{} (the function I want to use in the table) does use curly braces that relative to the verbatim environment they were being treated differently, or as a special case.
    – EngBIRD
    Jun 5, 2017 at 13:13

0

You must log in to answer this question.

Browse other questions tagged .