commit 1e9aa6860ad5014d01fd0005cf230528a77da413
parent 2647917923f80037e71826bfe78c9fe71acd8694
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Mon, 10 Aug 2009 22:01:32 +0000
Scribble latex output and 'never-indents
svn: r15695
original commit: bdeaa475b3fb97d0ffc1795e656b2df6164ec1e1
Diffstat:
3 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/collects/scribble/base.ss b/collects/scribble/base.ss
@@ -514,7 +514,7 @@
(define (margin-note . c)
(make-nested-flow
- (make-style "refpara" '(command))
+ (make-style "refpara" '(command never-indents))
(list
(make-nested-flow
(make-style "refcolumn" null)
diff --git a/collects/scribble/latex-render.ss b/collects/scribble/latex-render.ss
@@ -158,9 +158,31 @@
(when use-style? (printf "}")))))
null)
+ (define/private (no-noindent? p ri)
+ (if (delayed-block? p)
+ (no-noindent? (delayed-block-blocks p ri) ri)
+ (or
+ (memq 'never-indents
+ (style-properties
+ (cond
+ [(paragraph? p) (paragraph-style p)]
+ [(compound-paragraph? p) (compound-paragraph-style p)]
+ [(nested-flow? p) (nested-flow-style p)]
+ [(table? p) (table-style p)]
+ [(itemization? p) (itemization-style p)]
+ [else plain])))
+ (and (nested-flow? p)
+ (pair? (nested-flow-blocks p))
+ (no-noindent? (car (nested-flow-blocks p)) ri))
+ (and (compound-paragraph? p)
+ (pair? (compound-paragraph-blocks p))
+ (no-noindent? (car (compound-paragraph-blocks p)) ri)))))
+
(define/override (render-intrapara-block p part ri first? last? starting-item?)
(unless first?
- (printf "\n\n\\noindent "))
+ (printf "\n\n")
+ (unless (no-noindent? p ri)
+ (printf "\\noindent ")))
(begin0
(super render-intrapara-block p part ri first? last? starting-item?)))
diff --git a/collects/scribblings/scribble/core.scrbl b/collects/scribblings/scribble/core.scrbl
@@ -386,6 +386,9 @@ The currently recognized @tech{style properties} are as follows:
@item{@scheme[body-id] structure --- For HTML, uses the given string
as an @tt{id} attribute of the @tt{<p>} or @tt{<div>} tag.}
+ @item{@scheme['never-indents] --- For Latex and @tech{compound
+ paragraphs}; see @scheme[compound-paragraph].}
+
]}
@@ -430,6 +433,9 @@ The following @tech{style properties} are currently recognized:
@item{@scheme['aux] --- For HTML, include the table in the
table-of-contents display for the enclosing part.}
+ @item{@scheme['never-indents] --- For Latex and @tech{compound
+ paragraphs}; see @scheme[compound-paragraph].}
+
]
For Latex output, a paragraph as a cell value is not automatically
@@ -473,6 +479,9 @@ The following @tech{style properties} are currently recognized:
@item{@scheme[body-id] structure --- For HTML, uses the given string
as an @tt{id} attribute of the @tt{<ul>} or @tt{<ol>} tag.}
+ @item{@scheme['never-indents] --- For Latex and @tech{compound
+ paragraphs}; see @scheme[compound-paragraph].}
+
]}
@@ -507,6 +516,9 @@ The following @tech{style properties} are currently recognized:
@item{@scheme[body-id] structure --- For HTML, uses the given string
as an @tt{id} attribute of the @tt{<blockquote>} tag.}
+ @item{@scheme['never-indents] --- For Latex and @tech{compound
+ paragraphs}; see @scheme[compound-paragraph].}
+
]}
@@ -518,7 +530,12 @@ A @techlink{compound paragraph} has a @tech{style} and a list of
For HTML, a @scheme[paragraph] block in @scheme[blocks] is rendered
without a @tt{<p>} tag, unless the paragraph has a style with a
-non-@scheme[#f] @tech{style name}.
+non-@scheme[#f] @tech{style name}. For Latex, each @tech{block} in
+@scheme[blocks] is rendered with a preceding @tt{\noindent}, unless
+the block has the @scheme['never-indents] property (checking
+recursively in a @scheme[nested-flow] or @scheme[compound-paragraph]
+if the @scheme[nested-flow] or @scheme[compound-paragraph] itself has
+no @scheme['never-indents] property).
The @scheme[style] field of a compound paragraph is normally a string
that corresponds to a CSS class for HTML output or Latex environment
@@ -537,6 +554,9 @@ for Latex output (see @secref["extra-style"]). The following
@item{@scheme[body-id] structure --- For HTML, uses the given string
as an @tt{id} attribute of the @tt{<p>} tag.}
+ @item{@scheme['never-indents] --- For Latex within another
+ @tech{compound paragraph}; see above.}
+
]}