11

I'd like to use the minted package and the scrhack package in the same LaTeX document, that is:

\usepackage{scrhack}
\usepackage{minted}

However, I get the following error:

/usr/local/texlive/2013/texmf-dist/tex/latex/minted/minted.sty:215: Package scrhack Error: extension `lol' already in use. [...t{listing}{h}{lol}[\minted@float@within]}]

Edit: The problem was that I used the package classicthesis and included both, listing and minted. I cannot completely replicate the error, but this MWE has a very similar error message:

\documentclass{scrreprt}

\usepackage{scrhack}
\usepackage{minted}
\usepackage{listings}



\begin{document}

    Hello, World!

\end{document}

The error message is:

There were errors in your LaTeX source

/usr/local/texlive/2013/texmf-dist/tex/latex/koma-script/listings.hak:136: Package tocbasic Error: file extension `lol' cannot be used twice . [}]

Now, I removed listings (and all related parts) in the classicthesis-config.tex file and everything works fine. I don't think, that I'll need both packages, so my problem is solved.

3
  • 3
    Welcome to TeX.sx! Could you post a minimal working example (MWE), please? It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – cgnieder
    Commented Jan 27, 2014 at 19:37
  • Thank you! I didn't realize that the error seems to be caused by another part, so I'm trying to create a MWE now. Additionally, I should mention, that the error occurred by using the 'classicthesis' package.
    – Pold
    Commented Jan 27, 2014 at 20:11
  • 1
    The original error reappears if you put the \usepackage{listings} above the others.
    – bodo
    Commented Jan 27, 2014 at 21:01

1 Answer 1

12

The package scrhack redefines macros of other packages. It should be loaded at the very end. Luckily the following then already compiles without errors:

\documentclass{scrreprt}

\usepackage{listings}
\usepackage{minted}
\usepackage{scrhack}

\begin{document}
    Hello, World!
\end{document}

If you really need to include scrhack somewhere else, you could use the \AtEndPreamble hook provided by the etoolbox package.

3
  • according to the docs the package should not be loaded at the very end. "It is recommended to load the scrhack package as early as possible. In particular, loading should be done before the affected packages." (introduction of chapter 16 in scrguien.pdf, currently page 414) Commented Jul 15, 2021 at 11:37
  • @uvularer_frikativ: Please note that this Q&A is from 2014! The situation today might indeed be quite different. Your comment however does not contain enough information to really understand this in the context of the given situation. Imho as it stands, it is rather confusing. Could you please expand upon it (or delete is also fine with me)?
    – bodo
    Commented Jul 16, 2021 at 5:58
  • sorry for the confusion. actually i just wanted to say that you answer contradicts the (present) komascript docs. i guess the correct order (according to the docs) is: minted, scrhack, listings. it would be great if you could update your answer. Commented Jul 17, 2021 at 15:40

You must log in to answer this question.

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