Scribble can't be changed to match LaTeX without changing @-expression
reader at a fairly fundamental way, and I'm skeptical of the change.

Scribble's input is handled in three steps: @-expression parsing to
produce a syntax object (i.e., enriched S-expression), Racket expansion
and evaluation of the resulting syntax objects to produce values, and
(interleaved with the second step) a `scribble/decode` layer that is
used by some contexts (including the module body for `scribble/manual`)
to find paragraph based on the values produces by the second step. A
paragraph is determined at that last step as a pair of newlines
separated only by whitespace content.

LaTeX handles input in one big character-oriented sweep. In the default
mode, it effectively sees a source line that contains only white space
(before comment or other handling) and converts it into a `\par`. So,
it's detecting paragraphs at a much earlier point than Scribble ----
unless you're in something like a `verbatim` environment, where that
character-level handling is changed and blank lines are handled in a
different way. Of course, the character-level nature of macros is one
of the things that makes TeX macros so powerful, but also one of the
things that make them non-composable.

For Scribble to define paragraph breaks in terms of blank source lines
(i.e., blank before handling comments or other expansions), the notion
of paragraph breaks would have to be built into @-expression layer.
Since the notion of paragraph breaks doesn't apply to some uses of
@-expression notation, paragraph breaks would have to reflected in some
different way than, say, inserting `(par)` into the stream as in LaTeX.
A syntax property could be attached to a newline to indicate that its
source line is blank, but those are fragile (e.g., not preserved in
bytecode), and they only work on syntax-object representations of
S-expressions. Whatever a better solution might be, I think an even
better "solution" is to not to try to solve this problem and keep the
@-expression model simpler.

At Wed, 16 Sep 2015 18:42:22 -0400, Benjamin Greenman wrote:
> Scribble and LaTeX disagree on these documents. Should Scribble be changed
> to match LaTeX?
> 
> Scribble:
> #lang scribble/manual
> 
> Hello @; John
> 
> World
> 
> Output is:
> "Hello World"
> 
> ;; ---
> 
> LaTeX
> \documentclass{article}
> \begin{document}
> Hello % John
> 
> World
> \end{document}
> 
> Output is:
> "Hello
> World"
> 
> -- 
> 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.

-- 
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