commit 43a96277b5f30d5218806b3bbbde884ac717880d Author: Georges Dupéron Date: Tue Jun 2 18:04:45 2015 +0200 Initial commit. diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..3bf6e8d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "bracket"] + path = bracket + url = https://github.com/soegaard/bracket diff --git a/README b/README new file mode 100644 index 0000000..f957f6b --- /dev/null +++ b/README @@ -0,0 +1,9 @@ +Scribble (racket) example with LaTeX math both in PDF and HTML +============================================================== + + git submodule init + git submodule update + scribble --dest output/ --pdf example.scrbl + scribble --dest output/ --html example.scrbl + +Then open `output/example.pdf` and `output/example.html` diff --git a/bracket b/bracket new file mode 160000 index 0000000..bcf8a50 --- /dev/null +++ b/bracket @@ -0,0 +1 @@ +Subproject commit bcf8a50895c19d9cd4850184a973deadc6fa6a09 diff --git a/example.scrbl b/example.scrbl new file mode 100644 index 0000000..f2c37bb --- /dev/null +++ b/example.scrbl @@ -0,0 +1,16 @@ +#lang scribble/base +@(require slideshow/pict) +@(require "math.rkt") +@setup-math + +@section{A section} + +In section @secref{sec:foo} we present, blah blah. + +@subsection[#:tag "sec:foo"]{My subsection} + +@$${\frac{2x}{x^2}} + +@(colorize (filled-ellipse 30 15) "blue") + +@; Line comment diff --git a/math-scribble b/math-scribble new file mode 120000 index 0000000..453f281 --- /dev/null +++ b/math-scribble @@ -0,0 +1 @@ +bracket/math-scribble \ No newline at end of file diff --git a/math.rkt b/math.rkt new file mode 100644 index 0000000..01a4b13 --- /dev/null +++ b/math.rkt @@ -0,0 +1,28 @@ +#lang racket + +;; This file is derived from the one which can be found at: +;; https://github.com/soegaard/bracket/blob/master/docs/pr-math.rkt + +(require "math-scribble/math-scribble.rkt") + +(provide mathjax-source setup-math + (all-from-out "math-scribble/math-scribble.rkt")) + +(require scribble/html-properties + scribble/base + scribble/core) + +(define mathjax-source + "MathJax/MathJax.js" + ;"http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" + ; "http://c328740.r40.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=default" + ;"http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-HTML" + ) + +(define setup-math + (paragraph + (style + #f (list (alt-tag "script") + (attributes `((type . "text/javascript") + (src . ,mathjax-source ))))) + '())) diff --git a/output/MathJax b/output/MathJax new file mode 120000 index 0000000..fe8f178 --- /dev/null +++ b/output/MathJax @@ -0,0 +1 @@ +../bracket/math-scribble/MathJax/ \ No newline at end of file diff --git a/output/example.html b/output/example.html new file mode 100644 index 0000000..19dc513 --- /dev/null +++ b/output/example.html @@ -0,0 +1,2 @@ + +

1 A section

In section My subsection we present, blah blah.

1.1 My subsection

\[\frac{2x}{x^2}\]

image

 
\ No newline at end of file diff --git a/output/example.pdf b/output/example.pdf new file mode 100644 index 0000000..ef3d23a Binary files /dev/null and b/output/example.pdf differ diff --git a/output/math-display.css b/output/math-display.css new file mode 100644 index 0000000..e4a96eb --- /dev/null +++ b/output/math-display.css @@ -0,0 +1,2 @@ +.MathDisplay { +} \ No newline at end of file diff --git a/output/pict.png b/output/pict.png new file mode 100644 index 0000000..1af8cdc Binary files /dev/null and b/output/pict.png differ diff --git a/output/scribble-common.js b/output/scribble-common.js new file mode 100644 index 0000000..1ec7da5 --- /dev/null +++ b/output/scribble-common.js @@ -0,0 +1,170 @@ +// Common functionality for PLT documentation pages + +// Page Parameters ------------------------------------------------------------ + +var page_query_string = location.search.substring(1); + +var page_args = + ((function(){ + if (!page_query_string) return []; + var args = page_query_string.split(/[&;]/); + for (var i=0; i= 0) args[i] = [a.substring(0,p), a.substring(p+1)]; + else args[i] = [a, false]; + } + return args; + })()); + +function GetPageArg(key, def) { + for (var i=0; i= 0 && cur.substring(0,eql) == key) + return unescape(cur.substring(eql+1)); + } + return def; + } +} + +function SetCookie(key, val) { + try { + localStorage[key] = val; + } catch(e) { + var d = new Date(); + d.setTime(d.getTime()+(365*24*60*60*1000)); + try { + document.cookie = + key + "=" + escape(val) + "; expires="+ d.toGMTString() + "; path=/"; + } catch (e) {} + } +} + +// note that this always stores a directory name, ending with a "/" +function SetPLTRoot(ver, relative) { + var root = location.protocol + "//" + location.host + + NormalizePath(location.pathname.replace(/[^\/]*$/, relative)); + SetCookie("PLT_Root."+ver, root); +} + +// adding index.html works because of the above +function GotoPLTRoot(ver, relative) { + var u = GetCookie("PLT_Root."+ver, null); + if (u == null) return true; // no cookie: use plain up link + // the relative path is optional, default goes to the toplevel start page + if (!relative) relative = "index.html"; + location = u + relative; + return false; +} + +// Utilities ------------------------------------------------------------------ + +var normalize_rxs = [/\/\/+/g, /\/\.(\/|$)/, /\/[^\/]*\/\.\.(\/|$)/]; +function NormalizePath(path) { + var tmp, i; + for (i = 0; i < normalize_rxs.length; i++) + while ((tmp = path.replace(normalize_rxs[i], "/")) != path) path = tmp; + return path; +} + +// `noscript' is problematic in some browsers (always renders as a +// block), use this hack instead (does not always work!) +// document.write(""); + +// Interactions --------------------------------------------------------------- + +function DoSearchKey(event, field, ver, top_path) { + var val = field.value; + if (event && event.keyCode == 13) { + var u = GetCookie("PLT_Root."+ver, null); + if (u == null) u = top_path; // default: go to the top path + u += "search/index.html?q=" + encodeURIComponent(val); + u = MergePageArgsIntoUrl(u); + location = u; + return false; + } + return true; +} + +function TocviewToggle(glyph, id) { + var s = document.getElementById(id).style; + var expand = s.display == "none"; + s.display = expand ? "block" : "none"; + glyph.innerHTML = expand ? "▼" : "►"; +} + +// Page Init ------------------------------------------------------------------ + +// Note: could make a function that inspects and uses window.onload to chain to +// a previous one, but this file needs to be required first anyway, since it +// contains utilities for all other files. +var on_load_funcs = []; +function AddOnLoad(fun) { on_load_funcs.push(fun); } +window.onload = function() { + for (var i=0; i + .techinside doesn't work with IE, so use both (and IE doesn't + work with inherit in the second one, so use blue directly) */ +.techinside { color: black; } +.techinside:hover { color: blue; } +.techoutside:hover>.techinside { color: inherit; } + +.SCentered { + text-align: center; +} + +.imageleft { + float: left; + margin-right: 0.3em; +} + +.Smaller { + font-size: 82%; +} + +.Larger { + font-size: 122%; +} + +/* A hack, inserted to break some Scheme ids: */ +.mywbr { + display: inline-block; + height: 0; + width: 0; + font-size: 1px; +} + +.compact li p { + margin: 0em; + padding: 0em; +} + +.noborder img { + border: 0; +} + +.SAuthorListBox { + position: relative; + float: right; + left: 2em; + top: -2.5em; + height: 0em; + width: 13em; + margin: 0em -13em 0em 0em; +} +.SAuthorList { + font-size: 82%; +} +.SAuthorList:before { + content: "by "; +} +.author { + display: inline; + white-space: nowrap; +} + +/* print styles : hide the navigation elements */ +@media print { + .tocset, + .navsettop, + .navsetbottom { display: none; } + .maincolumn { + width: auto; + margin-right: 13em; + margin-left: 0; + } +}