guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string parsing/preparation for latex


From: Jose Roberto B. de A. Monteiro
Subject: Re: string parsing/preparation for latex
Date: Mon, 07 Nov 2005 13:49:01 -0200

Em Seg, 2005-11-07 às 14:53 +0100, David Pirotte escreveu:
> does anyone understands why this does not return the expected result
> 
>       (define *texu/reserved-characters*
>         ;; % \ { } ~ $ & # ^ _
>         '(
>           #\%         ;; comments
>           #\\         ;; command(follows by a space)
>           #\{         ;; definition of treatment block(main_arg)
>           #\}         
>           #\~         ;; indivisible space
>           #\$         ;; mathematical mode 
>           #\&         ;; tabulation ...
>           #\#         ;; symbol of parameter zone
>           #\^         ;; exponent
>           #\_         ;; index
>           )
>         )
> 
>       (define (texu/prep-str-for-tex str)
>         (let ((str-lst (string->list str))
>               (result (list)))
>           (for-each (lambda (chr)
>                       (if (member chr *texu/reserved-characters*)
>                           (set! result (cons chr (cons #\\ result)))
>                           (set! result (cons chr result))))
>                     str-lst)
>           (reverse-list->string result)
>           ))

Because you should have this string: ";; % \\ { } ~ $ & # ^ _", with two
backslashes instead of one... the same for "

>       (texu/prep-str-for-tex ";; % \ { } ~ $ & # ^ _")
>       ";; \\%  \\{ \\} \\~ \\$ \\& \\# \\^ \\_"
> 
> [the \ disapeared rather then being escaped]
> 
>               
> 
> 
> _______________________________________________
> Guile-user mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/guile-user




reply via email to

[Prev in Thread] Current Thread [Next in Thread]