I want to include some Matlab scripts in my thesis. Unfortunately, I can't get listings to work properly. If I try to compile the following code,

Bla bla bla.

I get the following error:

Package Listings Error: Couldn't load requested

Why is that happening and what can I do to remedy the problem?

  • Welcome to TeX.SX! Your example compiles without any problem. Please add a small example of your listings code too, perhaps you made an error/typo so far?
    – user31729
    Jun 3, 2014 at 13:22
  • If you get that exact error from this particular MWE, please also post the log file.
    – daleif
    Jun 3, 2014 at 13:38
  • 5
    I can reproduce the error by emulating a bad installation, where only listings.sty is present, but not all its accompanying files. How did you install listings?
    – egreg
    Jun 3, 2014 at 14:05
  • 6
    The complete distribution of listings requires the files listings.cfg, lstdoc.sty, lstlang2.sty, lstmisc.sty listings.sty, lstlang1.sty and lstlang3.sty
    – egreg
    Jun 3, 2014 at 15:05
  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers.
    – jub0bs
    Jun 4, 2014 at 13:49

1 Answer 1


The error is caused by listings not finding some required subpackages.

The complete distribution has the following files:


Of these, lstdoc.sty is only needed for typesetting the package documentation. My conjecture is that you only downloaded listings.sty, but not the other ones.

You can download them at http://www.ctan.org/tex-archive/macros/latex/contrib/listings and extract the files with the Makefile. However, since listings is included in all standard distributions, you shouldn't install it manually, but with the facilities provided by your TeX distribution.

Note: something more can be said if you specify what TeX distribution you're using.

  • I have the same problem, and when I look at my installation, which is texlive from homebrew, all of the above files are installed: ``` $ ls /opt/homebrew/Cellar/texlive/20220321/share/texmf-dist/tex/latex/listings/ listings-acm.prf listings-lua.prf lstdoc.sty lstmisc.sty listings-bash.prf listings-python.prf lstlang1.sty listings-fortran.prf listings.cfg lstlang2.sty listings-hansl.prf listings.sty lstlang3.sty ``` the error comes when pdflatex is trying to load listmisc.sty from this directory. Aug 18, 2022 at 14:43
  • @RobertP.Goldman On macOS, install MacTeX
    – egreg
    Aug 18, 2022 at 15:28
  • Actually, it turned out that I had auto-generated latex from org-mode, and that gave me a defective form that looked like this: \usepackage[""]{listings}. I took out the optional argument altogether and everything was fine. Kind of a terrible error message, though. Aug 18, 2022 at 23:28

You must log in to answer this question.

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