diff --git a/collects/scribblings/scribble/utils.ss b/collects/scribblings/scribble/utils.ss index b51fe4d09e..abf1581aeb 100644 --- a/collects/scribblings/scribble/utils.ss +++ b/collects/scribblings/scribble/utils.ss @@ -110,15 +110,17 @@ (define strs2 (split out-text)) (define strsm (map (compose split cdr) more)) (define (str->elts str) + (let ([spaces (regexp-match-positions #rx"(?:^| ) +" str)]) + (if spaces + (list* (substring str 0 (caar spaces)) + (hspace (- (cdar spaces) (caar spaces))) + (str->elts (substring str (cdar spaces)))) + (list (make-element 'tt (list str)))))) + (define (make-line str) (if (equal? str "") - (list (make-element 'newline (list ""))) - (let ([spaces (regexp-match-positions #rx"(?:^| ) +" str)]) - (if spaces - (list* (substring str 0 (caar spaces)) - (hspace (- (cdar spaces) (caar spaces))) - (str->elts (substring str (cdar spaces)))) - (list (make-element 'tt (list str))))))) - (define (make-line str) (list (as-flow (make-element 'tt (str->elts str))))) + ;;FIXME: this works in html, but in latex it creates a redundant newline + (list (as-flow (make-element 'newline '()))) + (list (as-flow (make-element 'tt (str->elts str)))))) (define (small-attr attr) (make-with-attributes attr '([style . "font-size: 82%;"]))) (define (make-box strs)