Le jeudi 18 août 2016 22:21:37 UTC+2, jos.koot a écrit :
> #lang scribble/manual
> bla blah blah@(linebreak)
> blah blah bla @superscript{blah blah bah}@(linebreak)
> bla blah blah
> 
> the linespacing between the first 2 lines is larger
> than between the last 2 lines.

I suppose you are talking about the HTML output, as LaTeX (used for the PDF 
output) handles this correctly, unless you start stacking many superscripts, as 
you noted.

I used a quick hack to collapse the element's vertical height in HTML, with 
`margin-top` and `margin-bottom` set to an arbitrary, large, negative value, 
and `display: inline-block;` so that the margin is taken into account.

Unfortunately, scribble doesn't apply a CSS class to superscript elements, and 
instead it uses some hard-coded `style="…"` attribute on the element. I 
therefore suggest overriding the `superscript` function with your own 
definition. The code below renders as the attached screenshot, and allows you 
to use the `@original-superscript{…}` if you need.

#lang scribble/manual

@(require scribble/core
          scribble/html-properties
          scribble/latex-properties
          (only-in scribble/manual
                   [superscript original-superscript]))
@(define thin-superscript-css
   (string->bytes/utf-8 #<<EOCSS
.thinSuperscript {
  vertical-align: super;
  font-size: 80%;
  margin: -10em 0;
  display: inline-block;
}
EOCSS
                        ))

@(define thin-superscript-tex
   (string->bytes/utf-8 #<<EOTEX
\def\thinSuperscript#1{#1}
EOTEX
                        ))

@(define (superscript . pre-content)
   (apply elem pre-content
          #:style (style "thinSuperscript"
                         (list (css-addition thin-superscript-css)
                               (tex-addition thin-superscript-tex)))))

bla blah blah@(linebreak) 
blah blah bla @superscript{blah blah bah}.
Text after correctly laid out@(linebreak)
bla blah blah

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to