scribble: change Latex rendering of empty hidden part titles
original commit: fc1089c84220582e627e0931438c275965228550
This commit is contained in:
parent
c971d20757
commit
a9cb0003ec
|
@ -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"))
|
||||
|
|
|
@ -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}{]}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user