Преглед на файлове

frames around figs in ch 1 and 2

Jeremy Siek преди 3 години
родител
ревизия
4f90caf861
променени са 1 файла, в които са добавени 33 реда и са изтрити 21 реда
  1. 33 21
      book.tex

+ 33 - 21
book.tex

@@ -302,7 +302,9 @@ Lowell, and the University of Vermont.
 
 
 \begin{figure}[tp]
-{\if\edition\racketEd
+\fbox{
+\begin{minipage}{0.96\textwidth}
+  {\if\edition\racketEd
 \begin{tikzpicture}[baseline=(current  bounding  box.center)]
   \node (C1) at (0,1.5) {\small Ch.~\ref{ch:trees-recur} Preliminaries};
   \node (C2) at (4,1.5) {\small Ch.~\ref{ch:Lvar} Variables};
@@ -360,8 +362,10 @@ Lowell, and the University of Vermont.
   \path[->] (C10) edge [above] node {} (C11);
 \end{tikzpicture}
 \fi}
-  \caption{Diagram of chapter dependencies.}
-  \label{fig:chapter-dependences}
+\end{minipage}
+}
+\caption{Diagram of chapter dependencies.}
+\label{fig:chapter-dependences}
 \end{figure}
 
 \racket{
@@ -1194,7 +1198,7 @@ two examples at the bottom of the figure, the first is in
 
 \begin{figure}[tp]
 {\if\edition\racketEd
-\begin{lstlisting}
+\begin{lstlisting}[frame=single]
 (define (is_exp ast)
   (match ast
     [(Int n) #t]
@@ -1218,7 +1222,7 @@ two examples at the bottom of the figure, the first is in
 \end{lstlisting}
 \fi}
 {\if\edition\pythonEd
-\begin{lstlisting}
+\begin{lstlisting}[frame=single]
 def is_exp(e):
   match e:
     case Constant(n):
@@ -1326,7 +1330,7 @@ Figure~\ref{fig:interp_Lint}.
 
 \begin{figure}[tp]
 {\if\edition\racketEd
-\begin{lstlisting}
+\begin{lstlisting}[frame=single]
 (define (interp_exp e)
   (match e
     [(Int n) n]
@@ -1352,7 +1356,7 @@ Figure~\ref{fig:interp_Lint}.
 \end{lstlisting}
 \fi}
 {\if\edition\pythonEd
-\begin{lstlisting}
+\begin{lstlisting}[frame=single]
 def interp_exp(e):
     match e:
         case BinOp(left, Add(), right):
@@ -1561,7 +1565,7 @@ operation.
 
 \begin{figure}[tp]
 {\if\edition\racketEd
-\begin{lstlisting}
+\begin{lstlisting}[frame=single]
 (define (pe_neg r)
   (match r
     [(Int n) (Int (fx- 0 n))]
@@ -1591,7 +1595,7 @@ operation.
 \end{lstlisting}
 \fi}
 {\if\edition\pythonEd
-\begin{lstlisting}
+\begin{lstlisting}[frame=single]
 def pe_neg(r):
   match r:
     case Constant(n):
@@ -2156,7 +2160,7 @@ variable, it looks up the corresponding value in the dictionary.
 
 \begin{figure}[tp]
 {\if\edition\racketEd
-\begin{lstlisting}
+\begin{lstlisting}[frame=single]
 (define interp-Lint-class
   (class object%
     (super-new)
@@ -2181,7 +2185,7 @@ variable, it looks up the corresponding value in the dictionary.
 \end{lstlisting}
 \fi}
 {\if\edition\pythonEd
-\begin{lstlisting}
+\begin{lstlisting}[frame=single]
 class InterpLint:
   def interp_exp(self, e, env):
     match e:
@@ -2222,7 +2226,7 @@ def interp_Lint(p):
 
 \begin{figure}[tp]
 {\if\edition\racketEd
-\begin{lstlisting}
+\begin{lstlisting}[frame=single]
 (define interp-Lvar-class
   (class interp-Lint-class
     (super-new)
@@ -2241,7 +2245,7 @@ def interp_Lint(p):
 \end{lstlisting}
 \fi}
 {\if\edition\pythonEd
-\begin{lstlisting}
+\begin{lstlisting}[frame=single]
 class InterpLvar(InterpLint):
   def interp_exp(self, e, env):
     match e:
@@ -2426,6 +2430,7 @@ errors.
   as the exit code.}
 
 \begin{figure}[tbp]
+\begin{minipage}{0.45\textwidth}
 \begin{lstlisting}[frame=single]
 	.globl main
 main:
@@ -2433,6 +2438,7 @@ main:
 	addq	$32, %rax
 	retq
 \end{lstlisting}
+\end{minipage}
 
 \caption{An x86 program that computes
   \racket{\code{(+ 10 32)}}\python{10 + 32}.}
@@ -2466,8 +2472,9 @@ $n$. Variable $1$ is stored at address $-8\key{(\%rbp)}$, variable $2$
 at $-16\key{(\%rbp)}$, etc.
 
 \begin{figure}[tbp]
+  \begin{minipage}{0.66\textwidth}
 {\if\edition\racketEd
-\begin{lstlisting}
+\begin{lstlisting}[frame=single]
 start:
 	movq	$10, -8(%rbp)
 	negq	-8(%rbp)
@@ -2488,7 +2495,7 @@ conclusion:
 \end{lstlisting}
 \fi}
 {\if\edition\pythonEd
-\begin{lstlisting}
+\begin{lstlisting}[frame=single]
 	.globl main
 main:
 	pushq	%rbp
@@ -2503,7 +2510,8 @@ main:
 	retq
 \end{lstlisting}
 \fi}
-\caption{An x86 program that computes
+\end{minipage}
+  \caption{An x86 program that computes
   \racket{\code{(+ 52 (- 10))}}\python{52 + -10}.}
 \label{fig:p1-x86}
 \end{figure}
@@ -2810,8 +2818,10 @@ placing \key{select\_instructions} first, followed by the
 that uses a reserved register to fix outstanding problems.
 
 \begin{figure}[tbp]
+\fbox{
+\begin{minipage}{0.96\textwidth}    
 {\if\edition\racketEd  
-\begin{tikzpicture}[baseline=(current  bounding  box.center)]
+\begin{tikzpicture}[baseline=(current  bounding  box.center),scale=0.95]
 \node (Lvar) at (0,2)  {\large \LangVar{}};
 \node (Lvar-2) at (3,2)  {\large \LangVar{}};
 \node (Lvar-3) at (6,2)  {\large \LangVarANF{}};
@@ -2849,6 +2859,8 @@ that uses a reserved register to fix outstanding problems.
 \path[->,bend right=15] (x86-3) edge [below] node {\ttfamily\footnotesize prelude\_and\_concl.} (x86-4);
 \end{tikzpicture}
 \fi}  
+\end{minipage}
+}
 \caption{Diagram of the passes for compiling \LangVar{}. }
 \label{fig:Lvar-passes}
 \end{figure}
@@ -3043,7 +3055,7 @@ form of Racket is useful for transforming the element of a list to
 produce a new list.\index{subject}{for/list}
 
 \begin{figure}[tbp]
-\begin{lstlisting}
+\begin{lstlisting}[frame=single]
 (define (uniquify_exp env)
   (lambda (e)
     (match e
@@ -3455,7 +3467,7 @@ start:
 \end{transformation}
 
 \begin{figure}[tbp]
-\begin{lstlisting}
+\begin{lstlisting}[frame=single]
 (define (explicate_tail e)
   (match e
     [(Var x) ___]
@@ -4068,7 +4080,7 @@ print(z + (- y))
 \begin{minipage}{0.45\textwidth}
 After instruction selection:
 {\if\edition\racketEd
-\begin{lstlisting}
+\begin{lstlisting}[frame=single]
 locals-types:
     x : Integer, y : Integer,
     z : Integer, t : Integer,
@@ -4089,7 +4101,7 @@ start:
 \end{lstlisting}
 \fi}
 {\if\edition\pythonEd
-\begin{lstlisting}
+\begin{lstlisting}[frame=single]
 movq $1, v
 movq $42, w
 movq v, x