Add TeX styles for custom Scribble tags

Removes many (not all) pdflatex errors when generating PDF docs. Some
styles had to be renamed because they get reused as LaTeX
environments/commands which can only contain letters.
pull/232/head
Joel Dueck 4 years ago
parent f8cd82a8d0
commit 4060a2df55

@ -1,9 +1,20 @@
#lang at-exp racket/base #lang at-exp racket/base
(require (for-syntax racket/base racket/syntax) scribble/core scribble/manual scribble/private/manual-sprop scribble/decode scribble/html-properties racket/runtime-path racket/format) (require (for-syntax racket/base
racket/syntax)
racket/format
racket/runtime-path
scribble/core
scribble/decode
scribble/html-properties
scribble/latex-properties
scribble/manual
scribble/private/manual-sprop)
(provide (all-defined-out) (all-from-out racket/runtime-path)) (provide (all-defined-out) (all-from-out racket/runtime-path))
(define-runtime-path mb-css "mb.css") (define-runtime-path mb-css "mb.css")
(define-runtime-path mb-tex "mb.tex")
(define (link-tt url) (link url (tt url))) (define (link-tt url) (link url (tt url)))
@ -14,16 +25,17 @@
(compound-paragraph (compound-paragraph
(style "fileblock" (list* (alt-tag "div") 'multicommand (style "fileblock" (list* (alt-tag "div") 'multicommand
(box-mode "RfileboxBoxT" "RfileboxBoxC" "RfileboxBoxB") (box-mode "RfileboxBoxT" "RfileboxBoxC" "RfileboxBoxB")
(tex-addition mb-tex)
scheme-properties)) scheme-properties))
(list (list
(paragraph (style "fileblock_filetitle" (list* (alt-tag "div") (box-mode* "RfiletitleBox") scheme-properties)) (paragraph (style "fileblockFiletitle" (list* (alt-tag "div") (box-mode* "RfiletitleBox") (tex-addition mb-tex) scheme-properties))
(list (make-element (list (make-element
(style "fileblock_filename" (list (css-style-addition mb-css))) (style "fileblockFilename" (list (css-style-addition mb-css) (tex-addition mb-tex)))
(if (string? filename) (if (string? filename)
(filepath filename) (filepath filename)
filename)))) filename))))
(compound-paragraph (compound-paragraph
(style "fileblock_filecontent" (list* (alt-tag "div") (box-mode* "RfilecontentBox") scheme-properties)) (style "fileblockFilecontent" (list* (alt-tag "div") (box-mode* "RfilecontentBox") (tex-addition mb-tex) scheme-properties))
(decode-flow inside))))) (decode-flow inside)))))
(define (convert-newlines args) (define (convert-newlines args)
@ -36,17 +48,28 @@
(nested (racketerror (racketfont* (convert-newlines args))))) (nested (racketerror (racketfont* (convert-newlines args)))))
(define (foreign-code . args) (define (foreign-code . args)
(compound-paragraph (style "foreign-code" (list (css-style-addition mb-css) (alt-tag "div"))) (list (apply verbatim args)))) (compound-paragraph (style "foreignCode" (list (css-style-addition mb-css)
(alt-tag "div")
(tex-addition mb-tex)))
(list (apply verbatim args))))
(define (terminal . args) (define (terminal . args)
(compound-paragraph (style "terminal" (list (css-style-addition mb-css) (alt-tag "div"))) (list (apply verbatim args)))) (compound-paragraph (style "terminal" (list (css-style-addition mb-css)
(alt-tag "div")
(tex-addition mb-tex)))
(list (apply verbatim args))))
(define (browser . args) (define (browser . args)
(compound-paragraph (style "browser" (list (css-style-addition mb-css) (alt-tag "div"))) (list (paragraph (style #f null) (convert-newlines args))))) (compound-paragraph (style "browser" (list (css-style-addition mb-css)
(alt-tag "div")
(tex-addition mb-tex)))
(list (paragraph (style #f null) (convert-newlines args)))))
(define (noskip-note) (define (noskip-note)
(nested #:style (style "noskip" (list (css-style-addition mb-css) (alt-tag "div"))) (nested #:style (style "noskip" (list (css-style-addition mb-css)
(alt-tag "div")
(tex-addition mb-tex)))
(margin-note "Dont skip this section! It explains an essential Pollen concept."))) (margin-note "Dont skip this section! It explains an essential Pollen concept.")))

@ -26,7 +26,7 @@
width: 90%; width: 90%;
} }
.fileblock_filetitle{ .fileblockFiletitle{
background: #eee; background: #eee;
text-align:right; text-align:right;
padding: 0.15em; padding: 0.15em;
@ -42,13 +42,13 @@
color: #666; color: #666;
} }
.foreign-code { .foreignCode {
margin-bottom: 1em; margin-bottom: 1em;
padding: 0.5em; padding: 0.5em;
background: #fcfcfc; background: #fcfcfc;
color: #666; color: #666;
} }
.terminal .SIntrapara, .browser .SIntrapara, .foreign-code .SIntrapara { .terminal .SIntrapara, .browser .SIntrapara, .foreignCode .SIntrapara {
margin: 0 0 0 0; margin: 0 0 0 0;
} }

@ -0,0 +1,28 @@
\newcommand{\terminal}[1]{#1}
\newcommand{\browser}[1]{#1}
\newcommand{\foreignCode}[1]{#1}
\newenvironment{fileblock}{}{}
\definecolor{fileboxborder}{gray}{0.5}
\definecolor{fileboxbackground}{gray}{0.9}
\definecolor{noskipbackground}{gray}{0.5}
\definecolor{noskipforeground}{gray}{1}
\newcommand{\fileblockFiletitle}[1]{\fcolorbox{fileboxborder}{fileboxbackground}{\makebox[\textwidth][r]{#1}}}
\newcommand{\fileblockFilename}[1]{#1}
\newenvironment{fileblockFilecontent}{}{}
\newsavebox{\noskipbox}
\newenvironment{noskip}
{
\begin{lrbox}{\noskipbox}%
\begin{minipage}{\dimexpr\columnwidth-2\fboxsep\relax}
\bfseries
\begingroup\color{noskipforeground}}
{\endgroup\upshape\end{minipage}\end{lrbox}%
\medskip
\begin{center}
\colorbox{noskipbackground}{\usebox{\noskipbox}}
\end{center}\medskip}
Loading…
Cancel
Save