For Programmers: Free Programming Magazines  


Home > Archive > Scheme > October 2006 > latex with scheme is fun









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author latex with scheme is fun
Szabolcs Szucs

2006-10-04, 7:02 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi,

If one make the files below:

====8<====
login09% cat trafo.scm

(define (trafo fn)
(with-input-from-file
fn
(lambda ()
(let loop ((c (p-char)))
(if (eof-object? c)
'()
(begin
(if (char=? #\( c)
(eval (read))
(write-char (read-char)))
(loop (p-char))))))))

login09% cat trafo.sh
#!/usr/bin/zsh
guile -l trafo.scm -c "(trafo \"$1\")" > $1.tex
login09%
====8<====

then he can mix the scheme code with the latex
(with some limitations). Like this:

====8<====
login09% cat prob.scm
\documentclass{article}
\usepackage{pstricks}
(define (L) (display "("))
(define (R) (display ")"))

\begin{document}
\begin{pspicture}(L)10,10(R)
(define pts
'((1 1)
(2 3)
(4 5)
(4 3)))%
(define (dotgen c)
(begin
(display (string-append "\\psdots("
(number->string (car c))
","
(number->string (cadr c))
")%"))
(newline)))%
(map dotgen pts)%
\end{pspicture}

\end{document}
login09% ./trafo.sh prob.scm
login09% cat prob.scm.tex
\documentclass{article}
\usepackage{pstricks}



\begin{document}
\begin{pspicture}(10,10)
%
%
\psdots(1,1)%
\psdots(2,3)%
\psdots(4,5)%
\psdots(4,3)%
%
\end{pspicture}

\end{document}
login09%
====8<====

The only problem is the usage of the parens in tex code.
Any idea about the easy usage of'em?





=--=
Szucs Szabolcs Laszlo
(36 30) 228 42 40




9BF6 00E9 0CA9 B3A8 5234 03DB 3FB3 F85B 0033 74D7
http://keyserver.noreply.org/pks/lo...&fingerprint=on
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFFI9VCP7P4WwAzdNcRAkhxAJwKFOLJYy9O
6vNzRtgID9Zi6T/43gCgxW9p
SKNB02GFZb7D0EhxSqnvXjI=
=dQZc
-----END PGP SIGNATURE-----
Ray Blaak

2006-10-04, 7:02 pm

Cool. Consider using \( as your escape sequence for switching into
scheme. That way you can use ( for normal typing, since it is pretty common
when writing prose.

Check out existing scheme/latex packages for how they embed code in tex. I
don't recall their names, but googling "scheme latex" should work.
--
Cheers, The Rhythm is around me,
The Rhythm has control.
Ray Blaak The Rhythm is inside me,
rAYblaaK@STRIPCAPStelus.net The Rhythm has my soul.
CliffMacGillivray

2006-10-04, 7:02 pm

Ray Blaak wrote:
> Cool. Consider using \( as your escape sequence for switching into
> scheme. That way you can use ( for normal typing, since it is pretty common
> when writing prose.
>
> Check out existing scheme/latex packages for how they embed code in tex. I
> don't recall their names, but googling "scheme latex" should work.


ha! more likely you are gonna get some pr0n sites!
Go directly to noweb http://www.eecs.harvard.edu/~nr/noweb/ ;)
Szabolcs Szucs

2006-10-04, 7:02 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ray Blaak <rAYblaaK@STRIPCAPStelus.net> writes:

> Cool. Consider using \( as your escape sequence for switching into
> scheme. That way you can use ( for normal typing, since it is pretty common
> when writing prose.
>
> Check out existing scheme/latex packages for how they embed code in tex. I
> don't recall their names, but googling "scheme latex" should work.


It should. I've got some pages about typesetting scheme code in latex,
about scheme documents downloadable in latex format, some stuff about
SXML documents (it isn't an embedding of scheme). I don't know
anything about embeds like in my previous post, so if there are some
sophisticated systems around, please enumerate them for me please.. :)

> --
> Cheers, The Rhythm is around me,
> The Rhythm has control.
> Ray Blaak The Rhythm is inside me,
> rAYblaaK@STRIPCAPStelus.net The Rhythm has my soul.


=--=
Szucs Szabolcs Laszlo
(36 30) 228 42 40




9BF6 00E9 0CA9 B3A8 5234 03DB 3FB3 F85B 0033 74D7
http://keyserver.noreply.org/pks/lo...&fingerprint=on
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFFI/ YyP7P4WwAzdNcRAhnTAKCNP6fNiDo+LXJvH0K2IK
AmONnL0wCfQmdZ
wMK9tzPQc94DMRKRYsc3v44=
=EEyM
-----END PGP SIGNATURE-----
Peter Ilberg

2006-10-04, 7:02 pm


Szabolcs Szucs <kotee@elte.hu> writes:
> It should. I've got some pages about typesetting scheme code in latex,
> about scheme documents downloadable in latex format, some stuff about
> SXML documents (it isn't an embedding of scheme). I don't know
> anything about embeds like in my previous post, so if there are some
> sophisticated systems around, please enumerate them for me please.. :)


TeX2Page can embed and run scheme code in tex documents.

http://www.ccs.neu.edu/home/dorai/tex2page/

Skribe uses a scheme-based document format to generate tex or html.

http://www-sop.inria.fr/mimosa/fp/Skribe/
Szabolcs Szucs

2006-10-04, 7:02 pm

eval4tex will be my choice.. nice little stuff.

thx for the help :)

=--=
Szucs Szabolcs Laszlo
(36 30) 228 42 40




9BF6 00E9 0CA9 B3A8 5234 03DB 3FB3 F85B 0033 74D7
http://keyserver.noreply.org/pks/lo...&fingerprint=on
Oleg Paraschenko

2006-10-05, 4:06 am

Hello,

Szabolcs Szucs wrote:
> ... I don't know
> anything about embeds like in my previous post, so if there are some
> sophisticated systems around, please enumerate them for me please.. :)


You can look at sTeXme and related links:

http://stexme.sourceforge.net/
http://uucode.com/blog/category/stexme/


--
Oleg Parashchenko olpa@ http://uucode.com/
http://uucode.com/blog/ Generative Programming, XML, TeX, Scheme

bunny351@yoho-gmail.com

2006-10-05, 4:06 am

Szabolcs Szucs schrieb:

> It should. I've got some pages about typesetting scheme code in latex,
> about scheme documents downloadable in latex format, some stuff about
> SXML documents (it isn't an embedding of scheme). I don't know
> anything about embeds like in my previous post, so if there are some
> sophisticated systems around, please enumerate them for me please.. :)


You might want to take a look at "mistie":

http://www.ccs.neu.edu/home/dorai/mistie/mistie.html

or (it's chicken incarnation):

http://www.call-with-current-contin...ggs/mistie.html


cheers,
felix

Peter Claussen

2006-10-05, 7:04 pm

In article <s7mlknwhsjx.fsf@login09.caesar.elte.hu>,
Szabolcs Szucs <kotee@elte.hu> wrote:

>
> Ray Blaak <rAYblaaK@STRIPCAPStelus.net> writes:
>
>
> It should. I've got some pages about typesetting scheme code in latex,
> about scheme documents downloadable in latex format, some stuff about
> SXML documents (it isn't an embedding of scheme). I don't know
> anything about embeds like in my previous post, so if there are some
> sophisticated systems around, please enumerate them for me please.. :)
>


TeXMacs? http://www.texmacs.org/

I've been using it to work develop R scripts embedded in documentation,
have only played with the embedded scheme.

I'm not so happy with the LaTeX export, but the PDF files generated
directly from TeXMacs are just fine by me.

Peter Claussen
Paulo Matos

2006-10-08, 7:04 pm


Szabolcs Szucs escreveu:
>
> The only problem is the usage of the parens in tex code.
> Any idea about the easy usage of'em?
>
>


My guess is that the usual solution goes through escape characters.
Maybe you specify an escape sequence to warn about scheme code. That
would be parsed and removed by scheme and only then it would be sent to
latex. Either way, that's a idea! :-)

Paulo Matos

>
>
>
> =--=
> Szucs Szabolcs Laszlo
> (36 30) 228 42 40
>
>
>
>
> 9BF6 00E9 0CA9 B3A8 5234 03DB 3FB3 F85B 0033 74D7
> http://keyserver.noreply.org/pks/lo...&fingerprint=on
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
> Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
>
> iD8DBQFFI9VCP7P4WwAzdNcRAkhxAJwKFOLJYy9O
6vNzRtgID9Zi6T/43gCgxW9p
> SKNB02GFZb7D0EhxSqnvXjI=
> =dQZc
> -----END PGP SIGNATURE-----


Bruce Lewis

2006-10-08, 10:03 pm

I wouldn't go so far as to say LaTeX with Scheme is fun, but it is the
most efficient way to produce on-demand printable reports. However, if
you can get your company to use Firefox, the THEAD element can eliminate
the most common reason for needing PDFs instead of HTML.

--

http://ourdoings.com/ Easily organize and disseminate news and
photos for your family or group.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com