Add LaTeX environments for custom Scribble tags (fixes #231) #232

Merged
otherjoel merged 5 commits from scribble-fix-latex into master 4 years ago

@ -1,9 +1,20 @@
#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))
(define-runtime-path mb-css "mb.css")
(define-runtime-path mb-tex "mb.tex")
(define (link-tt url) (link url (tt url)))
@ -14,16 +25,17 @@
(compound-paragraph
(style "fileblock" (list* (alt-tag "div") 'multicommand
(box-mode "RfileboxBoxT" "RfileboxBoxC" "RfileboxBoxB")
(tex-addition mb-tex)
scheme-properties))
(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
(style "fileblock_filename" (list (css-style-addition mb-css)))
(style "fileblockFilename" (list (css-style-addition mb-css) (tex-addition mb-tex)))
(if (string? filename)
(filepath filename)
filename))))
(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)))))
(define (convert-newlines args)
@ -36,17 +48,28 @@
(nested (racketerror (racketfont* (convert-newlines 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)
(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)
(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)
(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.")))

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

@ -0,0 +1,20 @@
\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}{}{}
\newenvironment{noskip}{}{}
% pdflatex chokes on emoji. Use ∇ in place of the guitar in setup.scrbl
\DeclareUnicodeCharacter{1F3B8}{$\nabla$}
Loading…
Cancel
Save