Closed aw-think closed 8 years ago
The best option for customizing captions is probably to load minted
with the newfloat
option (\usepackage[newfloat]{minted}
). This will use the newfloat
package to create the listing
environment. Then you can use the caption
package, which newfloat
is part of, to customize the caption appearance.
I'm using Koma Script scrreprt where I set the option captions=nooneline, so that all captions are not centered under the floating, they are all left aligned.
If I now use the option newfloat it works fine, but a quick look in the log shows me, that I always get a warning if I use the minted package: lineno.sty Command \@parboxrestore has changed. Seems about the linenumbering.
It looks like Koma Script or something else is redefining \@parboxrestore
, and lineno
is then raising a warning. lineno
is only used for line breaking; actual line numbering uses the fancyvrb
package. So if you're using breaklines=true
, and lines seem to be breaking OK, then everything is probably fine (only a small portion of lineno
is actually used). But I'll look into this as a potential package conflict.
I've tested with the following raw document from my preamble until I got the warning message. The package which is making the problem is csquotes, but only if one loads it first. If one loads the package after minted, there is no warning:
\documentclass[DIV=12,BCOR=8mm]{scrreprt}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english, ngerman]{babel}
\usepackage{setspace}
\usepackage{xspace}
\usepackage{microtype}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{booktabs}
\usepackage{enumitem}
\usepackage{calc}
\usepackage{float}
\usepackage[headsepline]{scrlayer-scrpage}
\usepackage{scrhack}
\usepackage[autostyle=true,german=quotes]{csquotes} % before minted, warning: Command \@parboxrestore has changed.
\usepackage[outputdir=./build]{minted} %
%\usepackage[autostyle=true,german=quotes]{csquotes} % after minted, no warning
\usepackage{mwe} % only for minimal working example text
\begin{document}
\blindtext
\end{document}
I'm closing this since it seems to be an issue with package loading order. I've added a note in the FAQ about this for the next release.
How is it possible to change the caption position inside a listing environment? Let's say someone would have all caption left aligned under the floating object (figure, table and listing).