Michael Weylandt <michael.weyla...@gmail.com> writes: > - The minted style isn't passed as a package option so I'm not sure > how org-latex-packages-alist helps.
You can add a string at the end of `org-latex-packages-alist' that will be inserted in the header. > - Yes, I have been putting it in the headers of my custom classes, but > it has to follow \usepackage{minted} or I get a LaTeX error, so I wind > up loading minted even when not using it. Having it as a variable also > makes it easier to change the style. I don't think it matters much to load minted even if you don't use it. Even if it did, you could always define classes with and without minted. It's a bit troublesome, though, so I suggest to use #+LATEX_HEADER_EXTRA: instead. > -Yes, #+LATEX_HEADER_EXTRA works but there's still the problem of > failing if you don't use minted for that particular export. If you don't use minted for a particular export, you don't write #+LATEX_HEADER_EXTRA: \usemintedstyle{name} in the first place. > I think the right analogy if with hyperref/hypersetup, which does have > support of this style in Org. Unlike to minted, hyperref is not really optional, as it belongs to `org-latex-default-packages-alist'. OTOH, minted may not even be available on the machine. So there's no reason to show the same level of support. Anyway, since there is no reliable way to detect if a package will be required at Org level, this patch cannot work properly. Note that you can also write a filter that will insert "\usemintedstyle..." when "\usepackage{minted}" is detected in the output. Regards, -- Nicolas Goaziou