- Bob
--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
It'll be pretty easy to do. That's why I defined the stancode environment in https://github.com/stan-dev/stan/commit/2a5ba0bfa7f14f89af704ab0a7718a05b2846953. You can just redefine it to listings or a minted environment.
For minted, this branch has an implementation https://github.com/stan-dev/stan/tree/feature/issue-1132-pygmentize. It takes a while to compile the manual. But we could define two make targets: a manual with and without listings.
On Fri, Apr 3, 2015 at 4:59 PM, Bob Carpenter <ca...@alias-i.com> wrote:[moved to stan-dev]
> On Apr 4, 2015, at 4:46 AM, Daniel Lee <bea...@alum.mit.edu> wrote:
>
> have you seen this?
> http://en.m.wikibooks.org/wiki/LaTeX/Source_Code_Listings
>
> It looks like it's what we would want to include compilable examples in the manual.
I've seen various versions of this kind of thing.
If we wanted to use "listings" with Stan code, we'd need to
write a style to render it.
And what we really want is something that also pulls
out fragments of code files, unless we want to move to some
kind of all-or-nothing policy. It's much more verbose, but
can be less confusing.
They also mention the package minted. It uses Pygments
and I believe Jeffrey Arnold already wrote a Pygments style
for Stan.
I pushed some updates to issue-1132-pygmentize. It creates two manuals - with and without highlighting. Now stan-manuals.sty takes an option highlight which will determine whether any code in stancode or stancodefile environments is highlighted.
You can use the listings package; I don't think the highlighting looks particularly good as it can only do keywords and comments. However, now minted is much faster. In the months since I last looked at it there's been a lot of work on it. Now it caches the code chunks and works much faster.
Also putting code in external files is a separate problem from highlighting it. You could keep using the fancyvrb package and use VerbatimInput.