[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: string parsing/preparation for latex
From: |
Stephen Compall |
Subject: |
Re: string parsing/preparation for latex |
Date: |
Tue, 8 Nov 2005 10:56:08 -0600 |
David Pirotte writes:
> but that is not possible, because the string (here simulated)
> is a user typed in string (through a gtk interface
> programmed in guile-gnome) upon which I have no control.
> I precisly wish to parse it to create a .tex file later
> processed by latex ...
If you expect users to type in strings as Scheme expressions, I would
think you'd have no problem expecting them to know that backslashes have
to be escaped.
In other words, I think you're confusing reading strings, in the sense
of the `read' function for Scheme expressions, and reading raw character
data *into* strings, which is the usual practice when grabbing GUI form
fields, unless of course the form field is supposed to contain a Scheme
expression.
guile> (use-modules (ice-9 rdelim))
guile> (texu/prep-str-for-tex (read-line))
;; % \ { } ~ $ & # ^ _
=> ";; \\% \\\\ \\{ \\} \\~ \\$ \\& \\# \\^ \\_"
guile> (begin (display (texu/prep-str-for-tex (read-line))) (newline))
;; % \ { } ~ $ & # ^ _
-| ;; \% \\ \{ \} \~ \$ \& \# \^ \_
Where guile> is a prompt, => means a return value, -| means printed
line, all else is typed.
--
Stephen Compall
http://scompall.nocandysoftware.com/blog
- string parsing/preparation for latex, David Pirotte, 2005/11/07
- Re: string parsing/preparation for latex, Jose Roberto B. de A. Monteiro, 2005/11/07
- Re: string parsing/preparation for latex, Jon Wilson, 2005/11/07
- Re: string parsing/preparation for latex, David Pirotte, 2005/11/08
- Re: string parsing/preparation for latex, Jon Wilson, 2005/11/08
- Re: string parsing/preparation for latex, klaus schilling, 2005/11/09
- Re: string parsing/preparation for latex, Jon Wilson, 2005/11/09
- Re: string parsing/preparation for latex, Stephen Compall, 2005/11/13
- Re: string parsing/preparation for latex, Jon Wilson, 2005/11/14
- Re: string parsing/preparation for latex, Stephen Compall, 2005/11/15