This is roughly what HtDP/2e looks like as source: 

-------------------------------------------------------------------------------------------
#lang scribble/manual

@(require scribble/core scribble/latex-properties scribble/html-properties)

@(define book-style
   (make-style "htdp2e-book"
               (list
                'toc
                (make-css-addition "Shared/shared.css")
                (make-tex-addition "Shared/shared.tex"))))

@; 
------------------------------------------------------------------------------
@title[#:tag "htdp2e" #:style book-style ]{How to Design Programs, Second 
Edition}

Every idiot can learn to program in 24 hours.
-------------------------------------------------------------------------------------------

It comes with two files, which I have in a subdirectory called Shared: 
shared.css and shared.tex. 
It is there that I store the latex and css properties. 

Put this in DrRacket, save it in a Tmp directory, and run the PDF and HTML 
generation. 

You can put a lot of things into these CSS and TEX files. -- Matthias






On Oct 9, 2014, at 7:23 PM, Stephen De Gabrielle <[email protected]> 
wrote:

> Hi, 
> 
> Is is possible to use "(part (style #f (list (make-latex-defaults ..." to set 
> the LaTeX prefix (and style and extra files) from within a scribble file. 
> 
> My example below gets a contract violation because I've not specified a style 
> or any extra files.
> 
> I can see the examples of it being done as a language for JFP and Book, but I 
> can't work out how to just do it in the preamble if my scribble file. (I 
> don't really want to create a new #lang)
> 
> kind regards, 
> Stephen
> 
> ----
> 
> #lang scribble/base
> @(require scribble/core
>    scribble/latex-properties
>           scribble/latex-prefix)
> 
>          
> @(define setup-tma
>    (part 
>     (style #f (list (make-latex-defaults
>   (string->bytes/utf-8 (string-append 
> "\\documentclass[a4paper,12pt]{article}\n\\usepackage{cancel}\n\\usepackage{tma}\n"
>                                       unicode-encoding-packages))
>   ""
>   null)
>                     ))
>     '()))
> 
> @(require "pr-slides.rkt" scribble/latex-properties)
> @setup-math
> @setup-tma
> @title{Math Assignment 1}
> @author{Prabhakar Ragde}
> @section{First Test}
> This @emph{should} be a formula: @math-in{x^2 + y^2}.
> @section{Second Test}
> 
> struct
> (struct               latex-defaults (prefix style extra-files)
>     #:extra-constructor-name make-latex-defaults)
>       prefix          :               
> (or/c bytes? path-string?
>       (cons/c 'collects (listof bytes?)))
>       style           :               
> (or/c bytes? path-string?
>       (cons/c 'collects (listof bytes?)))
>       extra-files             :               
> (listof (or/c path-string?
>               (cons/c 'collects (listof bytes?))))
> Used as a style property on the main part of a document to set a default 
> prefix file, style file, and extra files (see Configuring Output). The 
> defaults are used by the scribblecommand-line tool for and --latex or --pdf 
> mode if none are supplied via --prefix and --style (where extra-files are 
> used only when prefix is used). A byte-string value is used directly like 
> file content, and a path can be a result of path->main-collects-relative.
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users


____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to