summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/lpic/instructions.tex
blob: 4aec0167729399adadd6c6be3ba1f3e2c15077fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
%% Copyright 2010 R. Matveyev
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this work is R. Matveyev.
%
% This work consists of the files: 
%       lpic.sty  instructions.tex
%       instructions.pdf instructions-differential.eps 
%       instructions-differential.pdf README 


\documentclass[10pt]{amsart} 
\usepackage{lpic}
\setlength{\topmargin}{0mm}
\setlength{\textheight}{210mm}
\def\cmd#1{\texttt{$\backslash$#1}}
\let\tex=\TeX
\let\latex=\LaTeX
\def\pdflatex{pdf\LaTeX}
\title{Package \texttt{lpic.sty}. \latex{} over included graphics.}
\author{R. Matveyev}



\begin{document}
\maketitle

The package \textbf{\texttt{lpic}} defines convenient interface to put any
\latex{} material on top of included graphics. 
\latex{} material could also be rotated and typeset on top of a white
box overshadowing graphics. Since coordinates of \latex{} boxes are
given relative to the original, unscaled graphics, when graphics is
rescaled, \latex{} annotations stay at their right places (unless you
do something extreme). In a draft mode it allows to draw a coordinate
grid over the picture for easy adjustment of positions of the annotations.

\section{Usage}

Package  defines an environment \texttt{lpic} and \cmd{lbl}.
The environment \vspace{2mm}\par\noindent
\cmd{begin}\{\texttt{lpic}\}[{\sc OPTIONS}]
   \{$<${\sc filename}$>${\sc DIMENSIONS}\}
   \begin{quote}
     \cmd{lbl}[{\sc POSITION}]
     \{{\sc x-coord,y-coord[,angle];\latex{} material}\}\\
     \vdots
   \end{quote}
   \cmd{end}\{\texttt{lpic}\} \vspace{2mm}\par\noindent
produces a \tex\ box with included graphics and the \latex{} material on
top of it.

\begin{itemize}
\item[$<${\sc filename}$>$] is a name of external
  graphics in \texttt{PS, EPS} or \texttt{PDF} format.  There is no need
  to give the extension of the file, appropriate format will be
  chosen, depending whether \latex{} or \pdflatex is run on the
  document. Convention is the same as for \texttt{epsfig} package.
  \vspace{2mm}
\item[{\sc DIMENSIONS}] is one of the following:
  \begin{enumerate}
  \item empty string 
  \item \texttt{() }
  \item \texttt{(,) }
  \item \texttt{(X) }
  \item \texttt{(X,) }
  \item \texttt{(,Y) }
  \item \texttt{(X,Y) }
  \end{enumerate}
  where each \texttt{X} and \texttt{Y} is either a positive decimal (with
  decimal point, not coma!) or length (currently only numerical
  constant lengths work).  Decimal number is interpreted as a scale
  coefficient and length is interpreted as the desired horisontal or
  vertical dimension of the figure.
  
  If neither \texttt{X} nor \texttt{Y} are supplied (cases 1, 2, 3), then
  the original unscaled picture is included.  If only one of \texttt{X} and
  \texttt{Y} is given (cases 4, 5, 6), then picture is scaled
  homotetically.  If both are present (case 7), then graphics is
  scaled vertically and horisontally, according to given parameters.\\
  For example: \\
  \cmd{begin}\{\texttt{lpic}\}\{\texttt{tessalation}\} -- means include
  graphics in the file \texttt{tessalation} at the original size.\\
  \cmd{begin}\{\texttt{lpic}\}\{\texttt{tessalation(0.5)}\} -- means
  include graphics at the half the original size.\\
  \cmd{begin}\{\texttt{lpic}\}\{\texttt{tessalation(0.5,3)}\} -- means
  include graphics shrinking twice in the horisontal direction and
  stretching 3 times in the vertical direction.\\
  \cmd{begin}\{\texttt{lpic}\}\{\texttt{tessalation(,10cm)}\} -- include
  graphics homotetically scaled, so that height is equal to 10cm.\\
  \cmd{begin}\{\texttt{lpic}\}\{\texttt{tessalation(150mm)}\} -- include
  graphics homotetically scaled, so that width is equal to 150mm.\\
  \cmd{begin}\{\texttt{lpic}\}\{\texttt{tessalation(150mm,0.7)}\} --
  include graphics scaled, so that width is equal to 150mm and
  height is 0.7 of the original.

  \vspace{2mm}
  \item[\sc OPTIONS] is a coma separated list of options (no spaces). 
    Option are processed
    sequentially, thus options to the right override preceding ones.
    Parameter in \texttt{()} is optional, if omitted then some default
    value is taken.
    
    Options are:
    	\item[\texttt{l(length)}] -- the size of the left margin beyond
			bounding box of graphics (default
                        0mm). Negative values are also acceptable.
	\item[\texttt{r(length)}] - right margin 
	\item[\texttt{t(lenght)}] - top margin
	\item[\texttt{b(length)}] -- bottom margin
	\item[\texttt{grid(step)}] -- Draw a grid over the picture of
			step \texttt{step*}\cmd{lpunitlength} and
			thickness \cmd{lpgridthickness}.  Parameter
			\texttt{step} must be an integer and defaults to 5.
        \item[\texttt{coords(step)}] -- write coordinates with the step
			\texttt{step*}\cmd{lpunitlength}.  Parameter step
			must be an integer and defaults to 10.
        \item[\texttt{frames(length)}] -- draw boxes of thickness {\tt
			length} over \latex{} material. Default value is
			0.01mm
	\item[\texttt{frame(length)}] -- draw a box around the whole
			thing (margins included). \texttt{length} is the
			thickness of the lines.  Default value is
			0.7mm.
        \item[\texttt{figframe(length)}] -- draw a box around the
			included graphics.  \texttt{length} is the
			thickness of the lines.  Default value is
			0.2mm.
        \item[\texttt{draft}] -- draw whatever is convenient for
			adjusting the positions of \latex{}
			material. That includes grid, coordinates, all
			types of frames.
	\item[\texttt{clean}] -- remove all auxiliary stuff.
	\item[\texttt{nolbl}] -- don't typeset any \latex{} material.
	\item[\texttt{nofigure}] -- don't include the graphics, just an
			empty box of appropriate size
  
\end{itemize}
  \vspace{2mm}\par\noindent
  Inside of \texttt{lpic} environment one can issue \cmd{lbl} command
    with the following syntax:\vspace{2mm}\par 
    \texttt{\cmd{lbl}[{\sc OPTIONS}]%
      \{{\sc COORDINATES; any \latex{} material}\}}
     \vspace{2mm}\par\noindent  
    \latex{} material is put in a box, rotated if necessary and printed
    in appropriate place. White rectangular background, which overshadows part of graphics could also be created.

\begin{itemize}
\item[\sc COORDINATES] are either pair or a triple of decimals.  The
  first two numbers are coordinates of the point, where \latex{} material
  should be placed and the third is an angle of rotation applied to
  the box containing the material.  Coordinates are measured in the
  coordinate system in the original, unscaled picture, with the unit
  equal to \cmd{lpunitlength} (default 1mm). So, if the picture is
  scaled, all the boxes containing \latex{} will hopefully stay at their
  appropriate places.
\item[\sc OPTIONS] is optional and consists of at most three letters,
  one from the set {\tt\{t,b\}}, one from {\tt\{r,l\}} and one from {\tt\{w,W\}}
  in any
  order.  \texttt{[t$|$b,l$|$r]} options give a reference point in a box containing \latex{}
  text. Coordinates refer to this reference point.  Rotation is also
  centered at this point. Thus, there are total 9 possibilities
  referring to 9 evenly spaced points in the rectangle.
  If one of \texttt{[w$|$W]} is given then \latex is put on top of white box.
  The size of the box is equal to the size of the box containing the material in case of  \texttt{w}
  and margins \cmd{lpbgsep}-wide are added in case of \texttt{W}.
  Note that \texttt{xdvi} apparently renders postscript after dvi, so any postscript covers dvi material.
  Thus, if you use background, you will not be able to see your \latex{} in \texttt{xdvi}.
  but once postscript file is created, \latex{} will show.
\end{itemize}


\section{ADJUSTABLE PARAMETERS} 

  \begin{itemize}
  \item[\cmd{lpunitlength}] (1mm) Units in the unscaled coordinate
    system.
  \item[\cmd{lpmarginright}] (0mm)	
  \item[\cmd{lpmarginleft}] (0mm)
  \item[\cmd{lpmargintop}] (0mm)
  \item[\cmd{lpmarginbottom}] (0mm) Default sizes of margins.
  \item[\cmd{lpbgsep}] (\cmd{fboxsep}) Margins for the white background.
  \item[\cmd{lpgridthickness}] (0.01mm) Thickness of the grid lines.
  \item[\cmd{lpframethickness}] (0.7mm) Thickness of the frame around
    the whole box.
  \item[\cmd{lplblframethickness}] (0.01mm) Thickness of the frame
    around labels.
  \item[\cmd{lpfigframethickness}] (0.2mm) Thickness of the frame
    around included graphics.
  \item[\tt lpgridstep] (5) Counter containing the step to draw grid lines
  \item[\tt lpcoordstep] (10) Counter containing the step to draw coordinates
  \end{itemize}

\newpage
\section{Example}
\def\T{\operatorname{\mathrm T}}
\def\d{\operatorname{\mathrm d}}
\def\o{\ensuremath{\text{\tiny$\operatorname{\mathcal O}$}}}
\def\R{\mathbb R}

Provided the file \texttt{instructions-differential.eps} or \texttt{instructions-differential.pdf}
contains the graphics one can include it in the document, drawing a
grid and putting \latex{} on top of it.

\begin{verbatim}
\begin{lpic}[l(10mm),r(5mm),t(5mm),b(10mm),draft]{instructions-differential(0.7,0.6)}
\lbl[t]{80,9;$x_0$}
\lbl[b]{87,11;$\delta x$}
\lbl[t]{101,7,-7;$x_0+\delta x$}
\lbl[b]{120,11;$\T_{x_0}X$}
\lbl[t]{88,59;$\delta x$}
\lbl[b]{120,61;$\T_{x_0}X$}
\lbl[tl]{120,3,-10;$X=\R$}
\lbl[r]{79,74;$\d f(\delta x)$}
\lbl[r]{79,102;$\T_{f(x_0)}Y$}
\lbl[lb]{21,115;$\T_{f(x_0)}Y$}
\lbl[l]{22,74;$\d f(\delta x)$}
\lbl[r]{16,88;$f(x_0)+\d f(\delta x)$}
\lbl[r]{19,60;$f(x_0)$}
\lbl[r]{11,110;$f(x_0+\delta x)$}
\lbl[l]{42,99;$\o(\delta x)$}
\lbl[b]{10,121;$Y=\R$}
\lbl[br]{47,21;Graph of $\d f$}
\lbl[bl]{26,36,13;Graph of $y=f(x)$}
\end{lpic}
\end{verbatim}

\vspace{5mm}

\begin{lpic}[l(10mm),r(5mm),t(5mm),b(10mm),draft]{instructions-differential(0.7,0.6)}
\lbl[t]{80,9;$x_0$}
\lbl[b]{87,11;$\delta x$}
\lbl[t]{101,7,-7;$x_0+\delta x$}
\lbl[b]{120,11;$\T_{x_0}X$}
\lbl[t]{88,59;$\delta x$}
\lbl[b]{120,61;$\T_{x_0}X$}
\lbl[tl]{120,3,-10;$X=\R$}
\lbl[r]{79,74;$\d f(\delta x)$}
\lbl[r]{79,102;$\T_{f(x_0)}Y$}
\lbl[lb]{21,115;$\T_{f(x_0)}Y$}
\lbl[l]{22,74;$\d f(\delta x)$}
\lbl[r]{16,88;$f(x_0)+\d f(\delta x)$}
\lbl[r]{19,60;$f(x_0)$}
\lbl[r]{11,110;$f(x_0+\delta x)$}
\lbl[l]{42,99;$\o(\delta x)$}
\lbl[b]{10,121;$Y=\R$}
\lbl[br]{47,21;Graph of $\d f$}
\lbl[bl]{26,36,13;Graph of $y=f(x)$}
\end{lpic}

\vspace{5mm}
When all label on the picture are adjusted one can get a ``clean''
picture by either removing \texttt{draft} option or adding \texttt{clean}.

\begin{verbatim}
\begin{lpic}[l(10mm),r(5mm),t(5mm),b(10mm),draft,clean]{instructions-differential(0.7,0.6)}
...
\end{lpic}
\end{verbatim}

\begin{lpic}[l(10mm),r(5mm),t(5mm),b(10mm),draft,clean]{instructions-differential(0.7,0.6)}
\lbl[t]{80,9;$x_0$}
\lbl[b]{87,11;$\delta x$}
\lbl[t]{101,7,-7;$x_0+\delta x$}
\lbl[b]{120,11;$\T_{x_0}X$}
\lbl[t]{88,59;$\delta x$}
\lbl[b]{120,61;$\T_{x_0}X$}
\lbl[tl]{120,3,-10;$X=\R$}
\lbl[r]{79,74;$\d f(\delta x)$}
\lbl[r]{79,102;$\T_{f(x_0)}Y$}
\lbl[lb]{21,115;$\T_{f(x_0)}Y$}
\lbl[l]{22,74;$\d f(\delta x)$}
\lbl[r]{16,88;$f(x_0)+\d f(\delta x)$}
\lbl[r]{19,60;$f(x_0)$}
\lbl[r]{11,110;$f(x_0+\delta x)$}
\lbl[l]{42,99;$\o(\delta x)$}
\lbl[b]{10,121;$Y=\R$}
\lbl[br]{47,21;Graph of $\d f$}
\lbl[bl]{26,36,13;Graph of $y=f(x)$}
\end{lpic}

Now if the picture is rescaled, \latex{} boxes also shift to
appropriate positions. However, the angles are the visible angles in
the final output and
sometimes they have to be adjusted after rescaling of the included graphics.
\begin{verbatim}
\begin{lpic}[l(10mm),r(5mm),t(5mm),b(10mm),draft,clean]{instructions-differential(0.8,0.4)}
...
\end{lpic}
\end{verbatim}

\begin{lpic}[l(10mm),r(5mm),t(5mm),b(10mm),draft,clean]{instructions-differential(0.8,0.4)}
\lbl[t]{80,9;$x_0$}
\lbl[b]{87,11;$\delta x$}
\lbl[t]{101,7,-7;$x_0+\delta x$}
\lbl[b]{120,11;$\T_{x_0}X$}
\lbl[t]{88,59;$\delta x$}
\lbl[b]{120,61;$\T_{x_0}X$}
\lbl[tl]{120,3,-10;$X=\R$}
\lbl[r]{79,74;$\d f(\delta x)$}
\lbl[r]{79,102;$\T_{f(x_0)}Y$}
\lbl[lb]{21,115;$\T_{f(x_0)}Y$}
\lbl[l]{22,74;$\d f(\delta x)$}
\lbl[r]{16,88;$f(x_0)+\d f(\delta x)$}
\lbl[r]{19,60;$f(x_0)$}
\lbl[r]{11,110;$f(x_0+\delta x)$}
\lbl[l]{42,99;$\o(\delta x)$}
\lbl[b]{10,121;$Y=\R$}
\lbl[br]{47,21;Graph of $\d f$}
\lbl[bl]{26,36,13;Graph of $y=f(x)$}
\end{lpic}


\vspace{5mm}

\end{document}