Create a new page in scribble with pdf/latex backend -
in latex, can create new page \newpage
command. there not seem way directly in scribble (at least not pdf/latex end.)
so, how can force scribble make me new page document?
yes, doable. bit clunky, , works when rendering latex file (or pdf file), not make sense webpage. original way had went latex. however, turns out there way staying entirely in scribble. whichever prefer going depend on context, i've put both options here.
option 1: entirely in scribble option
the way works use scribble styles string name. doing turns style latex environment or command (depending on put into.) in our case, want command, use element
. resulting code this:
(define (newpage) (make-element (style "newpage" '()) '()))
now can use newpage
function wherever want , latex insert \newpage
.
option 2: insert raw latex:
the other option insert bit of raw latex code in scribble file. this, first need create file, say: textstyle.tex
, , in file, put:
\newcommand{\identity}[1]{#1}
the name of file doesn't matter, , if has other commands in fine. create latex command evaluates same text given.
next, somewhere in scribble code, can create following 2 functions:
(define (exact . items) (make-element (make-style "identity" '(exact-chars)) items)) (define (newpage) (exact "\\newpage"))
the first function defines exact
, can use insert latex code. works because exact-chars
style passes characters latex verbatim, , not pass through sort of pre-processor. need identity
stile here latex has put text in.
the newpage
function translated directly \newpage
in latex. call want in code (newpage)
(or @newpage[]
/@(newpage)
when using at-expressions).
finally, need tell scribble find texstyle.tex
file. can ++style
flag when running scribble. altogether, command should like:
scribble --pdf ++style texstyle.tex mydocument.scrbl
as extra, if want document compile end , not latex/pdf, can use cond-element
. way can have empty element in other backend:
(define (exact-latex . items) (cond-element [latex (make-element (make-style "identity" '(exact-chars)) items)] [else ....])) (define (newpage) (exact-latex "\\newpage"))
Comments
Post a Comment