From e96941407c3348abb3af7e00561e17f38424cd5b Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 4 Jun 2009 03:20:39 +0000 Subject: [PATCH] Scrible latex output: fix (mostly) interaction of tables and itemization; DrScheme doc improvements svn: r15072 --- collects/scribble/latex-render.ss | 179 +++++++++++++++--- collects/scribble/scribble-prefix.tex | 1 + collects/scribble/scribble.tex | 21 +- .../drscheme/interface-essentials.scrbl | 6 +- .../scribblings/drscheme/keybindings.scrbl | 4 +- 5 files changed, 178 insertions(+), 33 deletions(-) diff --git a/collects/scribble/latex-render.ss b/collects/scribble/latex-render.ss index 24ef4628b4..c77925e760 100644 --- a/collects/scribble/latex-render.ss +++ b/collects/scribble/latex-render.ss @@ -252,10 +252,9 @@ [index? (eq? 'index (table-style t))] [tableform (cond [index? "list"] - [(and (not (current-table-mode)) (not inline-table?)) - "bigtabular"] + [(not (current-table-mode)) "bigtabular"] [else "tabular"])] - [opt (cond [(equal? tableform "bigtabular") "[l]"] + [opt (cond [(equal? tableform "bigtabular") ""] [(equal? tableform "tabular") "[t]"] [else ""])] [flowss (if index? (cddr (table-flowss t)) (table-flowss t))] @@ -285,12 +284,18 @@ [index? (printf "\\begin{list}{}{\\parsep=0pt \\itemsep=1pt \\leftmargin=2ex \\itemindent=-2ex}\n")] [inline? (void)] [else - (printf "~a\\begin{~a}~a{@{}~a}\n~a" + (printf "~a~a\\begin{~a}~a{@{~a}~a}\n~a" + (if (and inline-table? (equal? tableform "bigtabular")) + "\\bigtableinlinecorrect" + "") (if (string? (table-style t)) (format "\\begin{~a}" (table-style t)) "") tableform opt + (if (equal? tableform "bigtabular") + "\\bigtableleftpad" + "") (string-append* (map (lambda (i align) (format "~a@{}" @@ -397,7 +402,7 @@ (eq? (styled-itemization-style t) 'ordered)) "enumerate" "itemize"))]) - (printf "\\begin{~a}" mode) + (printf "\\begin{~a}\\atItemizeStart" mode) (for ([flow (itemization-flows t)]) (printf "\n\n\\~a" (if style-str (format "~aItem{" style-str) @@ -469,24 +474,152 @@ [(#\# #\% #\& #\$) (format "\\~a" c)] [(#\uA0) "~"] [(#\uDF) "{\\ss}"] - [(#\u039A) "K"] ; kappa - [(#\u0391) "A"] ; alpha - [(#\u039F) "O"] ; omicron - [(#\u03A3) "$\\Sigma$"] - [(#\u03BA) "$\\kappa$"] - [(#\u03B1) "$\\alpha$"] - [(#\u03B2) "$\\beta$"] - [(#\u03B3) "$\\gamma$"] - [(#\u03BF) "o"] ; omicron - [(#\u03C3) "$\\sigma$"] - [(#\u03C2) "$\\varsigma$"] - [(#\u03BB) "$\\lambda$"] - [(#\u039B) "$\\Lambda$"] - [(#\u03BC) "$\\mu$"] - [(#\u03C0) "$\\pi$"] - [(#\∞) "$\\infty$"] - [(#\à) "\\`{a}"] - [else c]))) + [else + (if ((char->integer c) . > . 127) + (case c + [(#\u039A) "K"] ; kappa + [(#\u0391) "A"] ; alpha + [(#\u039F) "O"] ; omicron + [(#\u03A3) "$\\Sigma$"] + [(#\u03BA) "$\\kappa$"] + [(#\u03B1) "$\\alpha$"] + [(#\u03B2) "$\\beta$"] + [(#\u03B3) "$\\gamma$"] + [(#\u03BF) "o"] ; omicron + [(#\u03C3) "$\\sigma$"] + [(#\u03C2) "$\\varsigma$"] + [(#\u03BB) "$\\lambda$"] + [(#\u039B) "$\\Lambda$"] + [(#\u03BC) "$\\mu$"] + [(#\u03C0) "$\\pi$"] + [(#\∞) "$\\infty$"] + [(#\⇓) "$\\Downarrow$"] + [(#\↖) "$\\nwarrow$"] + [(#\↓) "$\\downarrow$"] + [(#\⇒) "$\\Rightarrow$"] + [(#\→) "$\\rightarrow$"] + [(#\↘) "$\\searrow$"] + [(#\↙) "$\\swarrow$"] + [(#\←) "$\\leftarrow$"] + [(#\↑) "$\\uparrow$"] + [(#\⇐) "$\\Leftarrow$"] + [(#\−) "$\\longrightarrow$"] + [(#\⇑) "$\\Uparrow$"] + [(#\⇔) "$\\Leftrightarrow$"] + [(#\↕) "$\\updownarrow$"] + [(#\↔) "$\\leftrightarrow$"] + [(#\↗) "$\\nearrow$"] + [(#\⇕) "$\\Updownarrow$"] + [(#\א) "$\\aleph$"] + [(#\′) "$\\prime$"] + [(#\∅) "$\\emptyset$"] + [(#\∇) "$\\nabla$"] + [(#\♦) "$\\diamondsuit$"] + [(#\♠) "$\\spadesuit$"] + [(#\♣) "$\\clubsuit$"] + [(#\♥) "$\\heartsuit$"] + [(#\♯) "$\\sharp$"] + [(#\♭) "$\\flat$"] + [(#\♮) "$\\natural$"] + [(#\√) "$\\surd$"] + [(#\¬) "$\\neg$"] + [(#\△) "$\\triangle$"] + [(#\∀) "$\\forall$"] + [(#\∃) "$\\exists$"] + [(#\∘) "$\\circ$"] + [(#\θ) "$\\theta$"] + [(#\τ) "$\\tau$"] + [(#\υ) "$\\upsilon$"] + [(#\φ) "$\\phi$"] + [(#\δ) "$\\delta$"] + [(#\ρ) "$\\rho$"] + [(#\ε) "$\\epsilon$"] + [(#\χ) "$\\chi$"] + [(#\ψ) "$\\psi$"] + [(#\ζ) "$\\zeta$"] + [(#\ν) "$\\nu$"] + [(#\ω) "$\\omega$"] + [(#\η) "$\\eta$"] + [(#\ξ) "$\\xi$"] + [(#\Γ) "$\\Gamma$"] + [(#\Ψ) "$\\Psi$"] + [(#\∆) "$\\Delta$"] + [(#\Ξ) "$\\Xi$"] + [(#\Υ) "$\\Upsilon$"] + [(#\Ω) "$\\Omega$"] + [(#\Θ) "$\\Theta$"] + [(#\Π) "$\\Pi$"] + [(#\Φ) "$\\Phi$"] + [(#\±) "$\\pm$"] + [(#\∩) "$\\cap$"] + [(#\◇) "$\\diamond$"] + [(#\⊕) "$\\oplus$"] + [(#\∓) "$\\mp$"] + [(#\∪) "$\\cup$"] + [(#\△) "$\\bigtriangleup$"] + [(#\⊖) "$\\ominus$"] + [(#\×) "$\\times$"] + [(#\⊎) "$\\uplus$"] + [(#\▽) "$\\bigtriangledown$"] + [(#\⊗) "$\\otimes$"] + [(#\÷) "$\\div$"] + [(#\⊓) "$\\sqcap$"] + [(#\▹) "$\\triangleleft$"] + [(#\⊘) "$\\oslash$"] + [(#\∗) "$\\ast$"] + [(#\⊔) "$\\sqcup$"] + [(#\∨) "$\\vee$"] + [(#\∧) "$\\wedge$"] + [(#\◃) "$\\triangleright$"] + [(#\⊙) "$\\odot$"] + [(#\★) "$\\star$"] + [(#\†) "$\\dagger$"] + [(#\•) "$\\bullet$"] + [(#\‡) "$\\ddagger$"] + [(#\≀) "$\\wr$"] + [(#\⨿) "$\\amalg$"] + [(#\≤) "$\\leq$"] + [(#\≥) "$\\geq$"] + [(#\≡) "$\\equiv$"] + [(#\⊨) "$\\models$"] + [(#\≺) "$\\prec$"] + [(#\≻) "$\\succ$"] + [(#\∼) "$\\sim$"] + [(#\⊥) "$\\perp$"] + [(#\≼) "$\\preceq$"] + [(#\≽) "$\\succeq$"] + [(#\≃) "$\\simeq$"] + [(#\≪) "$\\ll$"] + [(#\≫) "$\\gg$"] + [(#\≍) "$\\asymp$"] + [(#\∥) "$\\parallel$"] + [(#\⊂) "$\\subset$"] + [(#\⊃) "$\\supset$"] + [(#\≈) "$\\approx$"] + [(#\⋈) "$\\bowtie$"] + [(#\⊆) "$\\subseteq$"] + [(#\⊇) "$\\supseteq$"] + [(#\≌) "$\\cong$"] + [(#\⊏) "$\\sqsubset$"] + [(#\⊐) "$\\sqsupset$"] + [(#\≠) "$\\neq$"] + [(#\⌣) "$\\smile$"] + [(#\⊑) "$\\sqsubseteq$"] + [(#\⊒) "$\\sqsupseteq$"] + [(#\≐) "$\\doteq$"] + [(#\⌢) "$\\frown$"] + [(#\∈) "$\\in$"] + [(#\∋) "$\\ni$"] + [(#\∝) "$\\propto$"] + [(#\⊢) "$\\vdash$"] + [(#\⊣) "$\\dashv$"] + [(#\☠) "$\\skull$"] + [(#\☺) "$\\smiley$"] + [(#\☻) "$\\blacksmiley$"] + [(#\☹) "$\\frownie$"] + [(#\à) "\\`{a}"] + [else c]) + c)]))) (loop (add1 i))))))) ;; ---------------------------------------- diff --git a/collects/scribble/scribble-prefix.tex b/collects/scribble/scribble-prefix.tex index 9cfd09828e..daa2013971 100644 --- a/collects/scribble/scribble-prefix.tex +++ b/collects/scribble/scribble-prefix.tex @@ -3,6 +3,7 @@ \parskip=10pt \parindent=0pt +\partopsep=0pt % Adjust margins to match HTML width for % fixed-width font diff --git a/collects/scribble/scribble.tex b/collects/scribble/scribble.tex index 305df9e168..43cba6848e 100644 --- a/collects/scribble/scribble.tex +++ b/collects/scribble/scribble.tex @@ -5,6 +5,8 @@ \renewcommand{\rmdefault}{ptm} \usepackage{stabular} \usepackage{relsize} +\usepackage{wasysym} +\usepackage{skull} \usepackage[htt]{hyphenat} \usepackage[usenames,dvipsnames]{color} \hypersetup{bookmarks=true,bookmarksopen=true,bookmarksnumbered=true} @@ -77,12 +79,21 @@ \newcommand{\bibentry}[1]{\parbox[t]{0.8\linewidth}{#1}} -\newenvironment{bigtabular}{\vspace{0ex} - -\begin{stabular}}{\end{stabular} - -\vspace{0ex}} +% stabular seems to be the lesser of all page-breaking table evironments +\newenvironment{bigtabular}{\begin{stabular}}{\end{stabular}} +% used to keep the horizontal line for a definition on the same page: \newcommand{\SEndFirstHead}[0]{ \nopagebreak \\ } +% attempts to correct weirdness when a table is the first thing in +% an itemization: +\newcommand{\bigtableinlinecorrect}[0]{~ + +\vspace{-\baselineskip}\vspace{\parskip}} +% used to indent the table correctly in an itemization, since that's +% one of the things stabular gets wrong +\newlength{\stabLeft} +\newcommand{\bigtableleftpad}{\hspace{\stabLeft}} +\newcommand{\atItemizeStart}[0]{\addtolength{\stabLeft}{\labelsep} + \addtolength{\stabLeft}{\labelwidth}} \newenvironment{schemeblock}{}{} \newenvironment{defmodule}{}{} diff --git a/collects/scribblings/drscheme/interface-essentials.scrbl b/collects/scribblings/drscheme/interface-essentials.scrbl index 80cb3e7d19..0be196b9cb 100644 --- a/collects/scribblings/drscheme/interface-essentials.scrbl +++ b/collects/scribblings/drscheme/interface-essentials.scrbl @@ -16,7 +16,7 @@ The DrScheme window has three parts: a row of buttons at the top, two editing panels in the middle, and a status line at the bottom. -@image["example.png"] +@centerline{@image[#:scale 0.7 "example.png"]} The top editing panel, called the @deftech{definitions window}, is for defining programs. The above figure shows a program that defines the @@ -404,7 +404,7 @@ expressions and results. For example, evaluating in the interactions window produces a special box for entering input: -@image["io.png"] +@centerline{@image[#:scale 0.6 "io.png"]} Type a number into the box and hit Enter, and that number becomes the result of the @scheme[(read)] expression. Once text is submitted for @@ -686,7 +686,7 @@ execution is currently paused. The expression's return value is displayed at the left of the button bar, and the value of @scheme[n] is displayed in the stack view pane. -@image["debugger1.png"] +@centerline{@image[#:scale 0.5 "debugger1.png"]} @subsection{Debugging Multiple Files} diff --git a/collects/scribblings/drscheme/keybindings.scrbl b/collects/scribblings/drscheme/keybindings.scrbl index 42b6238335..40c64dd8d4 100644 --- a/collects/scribblings/drscheme/keybindings.scrbl +++ b/collects/scribblings/drscheme/keybindings.scrbl @@ -184,8 +184,8 @@ These are the currently supported macro names and the keys they map into: (let ([macro (list-ref line 0)] [char (list-ref line 1)]) (list (make-flow (list (make-paragraph (list (index (format "\\~a keyboard shortcut" macro)) - (tt (format "\\~a" macro)))))) - (make-flow (list (make-paragraph (list char))))))) + (tt (format " \\~a" macro)))))) + (make-flow (list (make-paragraph (list (hspace 1) char))))))) tex-shortcut-table)) } ]