[racket] Integrating scribble and LaTeX
Nicely summarized, Matthias.
To follow-up on Robby's suggestion and my own petty needs, is there a way to get scribble to generate a "minimal pdf", instead of a whole page?
For instance, from the following code:
#lang scribble/manual
@(require scribble/eval)
@def+int[
(define add
(λ (n)
(λ (m)
(+ m n))))
(define add2 (add 2))
(add2 5)
]
can I get a correct-size pdf to include (as a figure) in a latex document?
I guess I'm asking for the --pdf equivalent of --latex-section.
That would then address my need directly (including nice looking scheme code in papers), without going into the (indeed) hairy issues with latex.
-- Éric
On Jun 23, 2011, at 6:28 PM, Matthias Felleisen wrote:
>
> Don, you're right. Latex is the assembly language here,
> and you should be able to patch in the results of an
> open compiler wherever you want. I did this kind of thing
> all the time in my innocent youth (Pascal -> 6809 asm) and
> 'it worked.' The reason it worked is because I (or perhaps
> the mentor who showed me) lacked the imagination of doing
> more than pretty straightforward things. Matthew has provided
> you with just enough for these scenarios.
>
> Eli, you're wrong. When people initially request such things
> they don't think of all possible bad scenarios. Let them play
> with it. Most of the time, it may just work and it's what they
> need.
>
> Eli, you're also correct. In principle, the latex linker is
> so impoverished that things will break sooner or later. And
> someone has already sent in a minor correction concerning the
> ordering of files. BUT, the person could figure out the fix
> and he was happy, so let it be.
>
>
>
>
> On Jun 23, 2011, at 6:17 PM, Eli Barzilay wrote:
>
>> Yesterday, Don Blaheta wrote:
>>> It seems likely that at some point I might have wanted to shift over
>>> to writing Scribble from scratch. I may yet do that. But it's
>>> going to be a lot harder to make that decision if I can't first dip
>>> in my toe and make it work with my existing installed base. It's
>>> especially hard if I'm not yet sure Scribble can do everything I
>>> want it to and thus might be required to abandon the effort
>>> half-done. And it's not such a strange request (like "why can't
>>> Scribble work with MS Word" would be), since LaTeX is *precisely
>>> what Scribble generates*.
>>
>> But the problem is exactly that it is latex -- a language where you
>> can't include a whole document in some sane encapsulated way like:
>>
>> \newscope{\include{somefile}}
>>
>> Instead, you need to merge the prefix and suffix requirements of both,
>> which is never easy. So while Matthew made it possible to get the
>> parts separately from scribble, my guess is that if you have some
>> non-trivial setup for your own latex, then it will be difficult to use
>> it, or maybe even impossible. (Given that some latex packages just
>> don't work with others, leading to annoying breakages.)
>>
>> It could probably generate more generic latex output, to the point
>> where it could be embedded more conveniently in random latex files.
>> It's probably even possible to just start from
>> scribble/latex-render.rkt and slowly water it down. But that would
>> require a heavy cost in terms of lost typesetting features.
>>
>> So I think that while Robby's suggestion to concatenate PDFs could
>> sound like he was trying to avoid the question, it was really a good
>> advice since PDFs are essentially these nice encapsulated chunks of
>> text that you can easily glue together.
>>
>> --
>> ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
>> http://barzilay.org/ Maze is Life!
>> _________________________________________________
>> For list-related administrative tasks:
>> http://lists.racket-lang.org/listinfo/users
>
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users
>