scribble: change Latex rendering of empty hidden part titles

original commit: fc1089c84220582e627e0931438c275965228550
This commit is contained in:
Matthew Flatt 2012-04-29 09:38:06 -06:00
parent c971d20757
commit a9cb0003ec
3 changed files with 37 additions and 25 deletions

View File

@ -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,6 +144,10 @@
(for ([pre (in-list pres)])
(printf "\n\n")
(do-render-paragraph pre d ri #t #f)))
(cond
[completely-hidden?
(printf "\n\n\\notitlesection")]
[else
(let ([no-number? (and (pair? number)
(or (not (car number))
((length number) . > . 3)))])
@ -162,9 +169,10 @@
(printf "{")
(render-content (part-title-content d) d ri)
(printf "}")
(when (eq? (style-name (part-style d)) 'index) (printf "\n\n")))
(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"))

View File

@ -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}{]}

View File

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