diff --git a/collects/scribble/latex-render.rkt b/collects/scribble/latex-render.rkt index dd3f8ecb..9516cd26 100644 --- a/collects/scribble/latex-render.rkt +++ b/collects/scribble/latex-render.rkt @@ -130,7 +130,10 @@ (printf "\n\n\\postDoc\n\\end{document}\n")))) (define/override (render-part-content d ri) - (let ([number (collected-info-number (part-collected-info d ri))]) + (let ([number (collected-info-number (part-collected-info d ri))] + [completely-hidden? + (and (part-style? d 'hidden) + (equal? "" (content->string (part-title-content d))))]) (when (and (part-title-content d) (or (pair? number) (let ([d (render-part-depth)]) @@ -141,30 +144,35 @@ (for ([pre (in-list pres)]) (printf "\n\n") (do-render-paragraph pre d ri #t #f))) - (let ([no-number? (and (pair? number) - (or (not (car number)) - ((length number) . > . 3)))]) - (printf "\n\n\\~a~a~a" - (case (+ (length number) (or (render-part-depth) 0)) - [(0 1) "sectionNewpage\n\n\\section"] - [(2) "subsection"] - [(3) "subsubsection"] - [else "subsubsection"]) - (if (and (part-style? d 'hidden) (not no-number?)) - "hidden" "") - (if no-number? "*" "")) - (when (not (or (part-style? d 'hidden) no-number?)) - (printf "[") - (parameterize ([disable-images #t] - [escape-brackets #t]) - (render-content (part-title-content d) d ri)) - (printf "]"))) - (printf "{") - (render-content (part-title-content d) d ri) - (printf "}") - (when (eq? (style-name (part-style d)) 'index) (printf "\n\n"))) + (cond + [completely-hidden? + (printf "\n\n\\notitlesection")] + [else + (let ([no-number? (and (pair? number) + (or (not (car number)) + ((length number) . > . 3)))]) + (printf "\n\n\\~a~a~a" + (case (+ (length number) (or (render-part-depth) 0)) + [(0 1) "sectionNewpage\n\n\\section"] + [(2) "subsection"] + [(3) "subsubsection"] + [else "subsubsection"]) + (if (and (part-style? d 'hidden) (not no-number?)) + "hidden" "") + (if no-number? "*" "")) + (when (not (or (part-style? d 'hidden) no-number?)) + (printf "[") + (parameterize ([disable-images #t] + [escape-brackets #t]) + (render-content (part-title-content d) d ri)) + (printf "]"))) + (printf "{") + (render-content (part-title-content d) d ri) + (printf "}") + (when (eq? (style-name (part-style d)) 'index) (printf "\n\n"))])) (for ([t (part-tags d)]) - (printf "\\label{t:~a}\n\n" (t-encode (add-current-tag-prefix (tag-key t ri))))) + (printf "\\label{t:~a}~a" (t-encode (add-current-tag-prefix (tag-key t ri))) + (if completely-hidden? "" "\n\n"))) (render-flow (part-blocks d) d ri #f) (for ([sec (part-parts d)]) (render-part sec ri)) (when (eq? (style-name (part-style d)) 'index) (printf "\\onecolumn\n\n")) diff --git a/collects/scribble/scribble.tex b/collects/scribble/scribble.tex index 93731738..f6fe8ab8 100644 --- a/collects/scribble/scribble.tex +++ b/collects/scribble/scribble.tex @@ -145,6 +145,9 @@ \newcommand{\subsectionhidden}[1]{\subsection{#1}} \newcommand{\subsubsectionhidden}[1]{\subsubsection{#1}} +% For hidden parts with an empty title: +\newcommand{\notitlesection}{\vspace{2ex}\phantomsection\noindent} + % When brackets appear in section titles: \newcommand{\SOpenSq}{[} \newcommand{\SCloseSq}{]} diff --git a/collects/scribblings/scribble/core.scrbl b/collects/scribblings/scribble/core.scrbl index 1286cf12..4430724a 100644 --- a/collects/scribblings/scribble/core.scrbl +++ b/collects/scribblings/scribble/core.scrbl @@ -342,7 +342,8 @@ The recognized @tech{style properties} are as follows: normally shows only the top-level sections).} @item{@racket['hidden] --- The part title is not shown in rendered - HTML output. The @racket['toc-hidden] style usually should be + HTML output, and the part title is not shown in Latex output if it + is empty. The @racket['toc-hidden] style usually should be included with @racket['hidden].} @item{@racket['toc-hidden] --- The part title is not shown in tables