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"))))
|
(printf "\n\n\\postDoc\n\\end{document}\n"))))
|
||||||
|
|
||||||
(define/override (render-part-content d ri)
|
(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)
|
(when (and (part-title-content d)
|
||||||
(or (pair? number)
|
(or (pair? number)
|
||||||
(let ([d (render-part-depth)])
|
(let ([d (render-part-depth)])
|
||||||
|
@ -141,30 +144,35 @@
|
||||||
(for ([pre (in-list pres)])
|
(for ([pre (in-list pres)])
|
||||||
(printf "\n\n")
|
(printf "\n\n")
|
||||||
(do-render-paragraph pre d ri #t #f)))
|
(do-render-paragraph pre d ri #t #f)))
|
||||||
(let ([no-number? (and (pair? number)
|
(cond
|
||||||
(or (not (car number))
|
[completely-hidden?
|
||||||
((length number) . > . 3)))])
|
(printf "\n\n\\notitlesection")]
|
||||||
(printf "\n\n\\~a~a~a"
|
[else
|
||||||
(case (+ (length number) (or (render-part-depth) 0))
|
(let ([no-number? (and (pair? number)
|
||||||
[(0 1) "sectionNewpage\n\n\\section"]
|
(or (not (car number))
|
||||||
[(2) "subsection"]
|
((length number) . > . 3)))])
|
||||||
[(3) "subsubsection"]
|
(printf "\n\n\\~a~a~a"
|
||||||
[else "subsubsection"])
|
(case (+ (length number) (or (render-part-depth) 0))
|
||||||
(if (and (part-style? d 'hidden) (not no-number?))
|
[(0 1) "sectionNewpage\n\n\\section"]
|
||||||
"hidden" "")
|
[(2) "subsection"]
|
||||||
(if no-number? "*" ""))
|
[(3) "subsubsection"]
|
||||||
(when (not (or (part-style? d 'hidden) no-number?))
|
[else "subsubsection"])
|
||||||
(printf "[")
|
(if (and (part-style? d 'hidden) (not no-number?))
|
||||||
(parameterize ([disable-images #t]
|
"hidden" "")
|
||||||
[escape-brackets #t])
|
(if no-number? "*" ""))
|
||||||
(render-content (part-title-content d) d ri))
|
(when (not (or (part-style? d 'hidden) no-number?))
|
||||||
(printf "]")))
|
(printf "[")
|
||||||
(printf "{")
|
(parameterize ([disable-images #t]
|
||||||
(render-content (part-title-content d) d ri)
|
[escape-brackets #t])
|
||||||
(printf "}")
|
(render-content (part-title-content d) d ri))
|
||||||
(when (eq? (style-name (part-style d)) 'index) (printf "\n\n")))
|
(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)])
|
(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)
|
(render-flow (part-blocks d) d ri #f)
|
||||||
(for ([sec (part-parts d)]) (render-part sec ri))
|
(for ([sec (part-parts d)]) (render-part sec ri))
|
||||||
(when (eq? (style-name (part-style d)) 'index) (printf "\\onecolumn\n\n"))
|
(when (eq? (style-name (part-style d)) 'index) (printf "\\onecolumn\n\n"))
|
||||||
|
|
|
@ -145,6 +145,9 @@
|
||||||
\newcommand{\subsectionhidden}[1]{\subsection{#1}}
|
\newcommand{\subsectionhidden}[1]{\subsection{#1}}
|
||||||
\newcommand{\subsubsectionhidden}[1]{\subsubsection{#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:
|
% When brackets appear in section titles:
|
||||||
\newcommand{\SOpenSq}{[}
|
\newcommand{\SOpenSq}{[}
|
||||||
\newcommand{\SCloseSq}{]}
|
\newcommand{\SCloseSq}{]}
|
||||||
|
|
|
@ -342,7 +342,8 @@ The recognized @tech{style properties} are as follows:
|
||||||
normally shows only the top-level sections).}
|
normally shows only the top-level sections).}
|
||||||
|
|
||||||
@item{@racket['hidden] --- The part title is not shown in rendered
|
@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].}
|
included with @racket['hidden].}
|
||||||
|
|
||||||
@item{@racket['toc-hidden] --- The part title is not shown in tables
|
@item{@racket['toc-hidden] --- The part title is not shown in tables
|
||||||
|
|
Loading…
Reference in New Issue
Block a user