1

I'm trying to use the probsoln and listings packages for computer science exercises, but it seems that these packages are incompatible when the problems are put in a separate file. Any help would be much appreciated.

Defining the problem in-file:

\documentclass{report}
\usepackage{probsoln,listings}

\begin{document}
\begin{onlyproblem}[fragile]
\lstset{language=Pascal}
\begin{lstlisting}
for i:=maxint to 0 do
begin
{ do nothing }
end;
Write('Case insensitive');
WritE('Pascal keywords.');
\end{lstlisting}
\end{onlyproblem}
\end{document}

works well, but when I separate the problem and the main document, then the code does not compile.

E.g., compiling testPsLstLoad.tex

\documentclass{report}
\usepackage{probsoln,listings}

\begin{document}
\loadallproblems{testProblem}
\useproblem{program}
\end{document}

with testProblem.tex

\begin{defproblem}{program}
  \begin{onlyproblem}[fragile]
\lstset{language=Pascal}
\begin{lstlisting}
for i:=maxint to 0 do
begin
{ do nothing }
end;
Write('Case insensitive');
WritE('Pascal keywords.');
\end{lstlisting}
  \end{onlyproblem}
\end{defproblem}

gives:

pdflatex testPsLstLoad.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./testPsLstLoad.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-08-07>
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/report.cls
Document Class: report 2019/12/20 v1.4l Standard LaTeX document class
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2020/texmf-dist/tex/latex/probsoln/probsoln.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/ifthen.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/local/texlive/2020/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/local/texlive/2020/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/local/texlive/2020/texmf-dist/tex/generic/xkeyval/keyval.tex)))))
(/usr/local/texlive/2020/texmf-dist/tex/latex/listings/listings.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/listings/lstmisc.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/listings/listings.cfg))
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def)
(./testPsLstLoad.aux) (./testProblem.tex) (./testPsLstLoad.vrb
(/usr/local/texlive/2020/texmf-dist/tex/latex/listings/lstlang1.sty)

Package Listings Warning: Text dropped after begin of listing on input line 1.

)

! LaTeX Error: \begin{lstlisting} on input line 1 ended by \end{onlyproblem}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.6 \useproblem{program}
                        
? 

Thanks, Jon

1 Answer 1

0

I'm knew , so I beg your pardon ... :)

I found , I think , another incompatibility between listings and probsoln

I use the template "Orange Book" With listings I have "TeX capacity exceeded, sorry [parameter stack size=10000]".

without my doc compile perfectly ...

\usepackage{bbding} \usepackage{amsmath} \usepackage{probsoln} \usepackage{enumitem}%,hyperref} \usepackage{nccmath} % for ceqn center equation within align tags \usepackage{pdfpages} \usepackage{caption} \usepackage{multicol} % multicolonnes textes \usepackage{wrapfig} % pour tableau et figu dans multicol \usepackage{multirow} % pour les tableaux \usepackage{epigraph} \usepackage{longtable} %\usepackage{listings}

Best regards

1

You must log in to answer this question.

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