[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] PATCH -- allow user to set minted style
From: |
Michael Weylandt |
Subject: |
Re: [O] PATCH -- allow user to set minted style |
Date: |
Fri, 4 Apr 2014 17:15:54 -0400 |
On Apr 4, 2014, at 16:24, Nicolas Goaziou <address@hidden> wrote:
> Michael Weylandt <address@hidden> 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.
>
Didn't know that -- thanks! Perhaps the docstring could include that.
> Anyway, since there is no reliable way to detect if a package will be
> required at Org level, this patch cannot work properly.
Not sure I follow: I'm piggy-backing on the same condition Org uses to
determine whether to insert \minted blocks for source code.
>
> Note that you can also write a filter that will insert
> "\usemintedstyle..." when "\usepackage{minted}" is detected in the
> output.
>
Indeed; I've done that just now.
For anyone who wants it:
(defun org-latex-minted-style-filter (contents backend info)
(if (string-match "\\usepackage{minted}" contents)
(replace-regexp-in-string "usepackage{minted}"
(format "usepackage{minted}\\\\usemintedstyle{%s}"
org-latex-minted-default-style) contents)))
(add-to-list 'org-export-filter-final-output-functions
'org-latex-minted-style-filter)
Anyways, even if the idea is rejected thanks for taking a look and for all your
work on Org Mode.
>
> Regards,
>
> --
> Nicolas Goaziou