Hi, Aaron Ecay <aarone...@gmail.com> writes:
> AFAICS you sent the original message only to me. I’m replying also to > the org mode list. You may want to resend the patch attachment though, > since the quoting in this reply will probably mangle it. http://permalink.gmane.org/gmane.emacs.orgmode/98791 ?? > 2015ko uztailak 1an, Rasmus-ek idatzi zuen: >> >> Hi, >> >> Attached is a patch that works reasonably well to allow :float nil >> "floats" to have captions in ox-latex. >> >> The hard part is src-blocks. >> >> At the moment we sometimes allow captions to register as figures (at least >> when when using verbatim). Instead we could go with "listing". Of course >> listing is not a known environment to LaTeX. We can add register it with >> newfloat in default-packages, or we can mention in the manual the lines >> that needs to be added to org-latex-packages if desired: >> >> \usepackage{newfloat} >> \DeclareFloatingEnvironment{listing} >> > > I think this should depend on the value of org-latex-listings: > nil -> use \captionof{float} You mean figure. But a source block in not a float. > t -> use \captionof{listing} > minted -> use \captionof{listing} (see below for why) >> We could also unconditionally use captionof in case of verbatim output for >> src blocks, even if float is required, which would allow us to kill >> float.sty from default package alist. >> >> BTW: In the current code we uses \captionof{listing}{caption} with minted. >> This seems incompatible. > > Minted uses listing as itsf floating environment; see sec. 5 of the > minted manual. So this seems correct in fact. Consider this minimal example \documentclass{article} \usepackage{minted} \usepackage{capt-of} \begin{document} \begin{minted}{lisp} (+ 1 1 ) \end{minted} \captionof{listing}{test} \end{document} This is the error I get when compiling: ERROR: Undefined control sequence. --- TeX said --- \@tempf ... \@parboxrestore \normalsize \@fs@capt {\@nameuse {fnum@#1}}{\ign... l.8 \captionof{listing}{test} It works fine when I use another counter than listing. >> But I have not really used minted so I don't know if I did the >> test correctly. minted has a [H] placement through it's listings >> environment, it seems, so I don't think we need captionof there. > > I’m not sure that minted provides this separately from the float > package. So it’s probably better to use \captionof in the minted case > as well. Certainly it will make things more consistent from org’s POV. > I guess it doesn't. In any, minted.sty has \RequirePackage{float} So we can be sure [H] is available. Thus, we should just rely on float. Rasmus -- Lasciate ogni speranza, voi che leggete questo.