Text Formatting! Paragraph ended before \lst@next was complete: Using lstli

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Roboticist
Posts: 1
Joined: Tue Oct 18, 2016 8:55 pm

! Paragraph ended before \lst@next was complete: Using lstli

Post by Roboticist »

I want to print a piece of verbatim within an item of an itemize environment, as below:

Code: Select all

\documentclass[letter, 11pt]{article}
\usepackage{enumitem}
\usepackage{pifont}
\usepackage{listings}

\newcommand{\Question}[1]{{\bfseries?: #1\par\vspace{5pt}}}
\newcommand{\Answer}[1]{\noindent\ding{51}: #1}

\begin{document}

\section*{Problem \#1}
\Question{content
}

\Answer{
\begin{itemize}
    \item[1] Some content.\\
    My Verbatim:
    \begin{lstlisting}
        G = VVVVVVVVVVVVVVVVVVVVVVVVVVV

        PROJ = PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
    \end{lstlisting}
\end{itemize}
}
\end{document}
But there is an error:

! Paragraph ended before \lst@next was complete.

I did even try the frame solution, but it does still not work:

Code: Select all

\documentclass[letter, 11pt]{article}
\usepackage{enumitem}
\usepackage{pifont}
\usepackage{listings}

\newcommand{\Question}[1]{{\bfseries?: #1\par\vspace{5pt}}}
\newcommand{\Answer}[1]{\noindent\ding{51}: #1}

\begin{document}

\section*{Problem \#1}
\Question{content
}

\Answer{
\begin{itemize}
    \item[1] Some content.\\
    My Verbatim:
    \begin{frame}[fragile]
        \begin{lstlisting}
            G = VVVVVVVVVVVVVVVVVVVVVVVVVVV

            PROJ = PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
        \end{lstlisting}    
    \end{frame}
\end{itemize}
}
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

! Paragraph ended before \lst@next was complete: Using lstli

Post by Johannes_B »

The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply