| 1 |
%% Copyright 2010 R. Matveyev |
| 2 |
% |
| 3 |
% This work may be distributed and/or modified under the |
| 4 |
% conditions of the LaTeX Project Public License, either version 1.3 |
| 5 |
% of this license or (at your option) any later version. |
| 6 |
% The latest version of this license is in |
| 7 |
% http://www.latex-project.org/lppl.txt |
| 8 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 9 |
% version 2005/12/01 or later. |
| 10 |
% |
| 11 |
% This work has the LPPL maintenance status `maintained'. |
| 12 |
% |
| 13 |
% The Current Maintainer of this work is R. Matveyev. |
| 14 |
% |
| 15 |
% This work consists of the files: |
| 16 |
% lpic.sty instructions.tex |
| 17 |
% instructions.pdf instructions-differential.eps |
| 18 |
% instructions-differential.pdf README |
| 19 |
|
| 20 |
|
| 21 |
\documentclass[10pt]{amsart} |
| 22 |
\usepackage{lpic} |
| 23 |
\setlength{\topmargin}{0mm} |
| 24 |
\setlength{\textheight}{210mm} |
| 25 |
\def\cmd#1{\texttt{$\backslash$#1}} |
| 26 |
\let\tex=\TeX |
| 27 |
\let\latex=\LaTeX |
| 28 |
\def\pdflatex{pdf\LaTeX} |
| 29 |
\title{Package \texttt{lpic.sty}. \latex{} over included graphics.} |
| 30 |
\author{R. Matveyev} |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
\begin{document} |
| 35 |
\maketitle |
| 36 |
|
| 37 |
The package \textbf{\texttt{lpic}} defines convenient interface to put any |
| 38 |
\latex{} material on top of included graphics. |
| 39 |
\latex{} material could also be rotated and typeset on top of a white |
| 40 |
box overshadowing graphics. Since coordinates of \latex{} boxes are |
| 41 |
given relative to the original, unscaled graphics, when graphics is |
| 42 |
rescaled, \latex{} annotations stay at their right places (unless you |
| 43 |
do something extreme). In a draft mode it allows to draw a coordinate |
| 44 |
grid over the picture for easy adjustment of positions of the annotations. |
| 45 |
|
| 46 |
\section{Usage} |
| 47 |
|
| 48 |
Package defines an environment \texttt{lpic} and \cmd{lbl}. |
| 49 |
The environment \vspace{2mm}\par\noindent |
| 50 |
\cmd{begin}\{\texttt{lpic}\}[{\sc OPTIONS}] |
| 51 |
\{$<${\sc filename}$>${\sc DIMENSIONS}\} |
| 52 |
\begin{quote} |
| 53 |
\cmd{lbl}[{\sc POSITION}] |
| 54 |
\{{\sc x-coord,y-coord[,angle];\latex{} material}\}\\ |
| 55 |
\vdots |
| 56 |
\end{quote} |
| 57 |
\cmd{end}\{\texttt{lpic}\} \vspace{2mm}\par\noindent |
| 58 |
produces a \tex\ box with included graphics and the \latex{} material on |
| 59 |
top of it. |
| 60 |
|
| 61 |
\begin{itemize} |
| 62 |
\item[$<${\sc filename}$>$] is a name of external |
| 63 |
graphics in \texttt{PS, EPS} or \texttt{PDF} format. There is no need |
| 64 |
to give the extension of the file, appropriate format will be |
| 65 |
chosen, depending whether \latex{} or \pdflatex is run on the |
| 66 |
document. Convention is the same as for \texttt{epsfig} package. |
| 67 |
\vspace{2mm} |
| 68 |
\item[{\sc DIMENSIONS}] is one of the following: |
| 69 |
\begin{enumerate} |
| 70 |
\item empty string |
| 71 |
\item \texttt{() } |
| 72 |
\item \texttt{(,) } |
| 73 |
\item \texttt{(X) } |
| 74 |
\item \texttt{(X,) } |
| 75 |
\item \texttt{(,Y) } |
| 76 |
\item \texttt{(X,Y) } |
| 77 |
\end{enumerate} |
| 78 |
where each \texttt{X} and \texttt{Y} is either a positive decimal (with |
| 79 |
decimal point, not coma!) or length (currently only numerical |
| 80 |
constant lengths work). Decimal number is interpreted as a scale |
| 81 |
coefficient and length is interpreted as the desired horisontal or |
| 82 |
vertical dimension of the figure. |
| 83 |
|
| 84 |
If neither \texttt{X} nor \texttt{Y} are supplied (cases 1, 2, 3), then |
| 85 |
the original unscaled picture is included. If only one of \texttt{X} and |
| 86 |
\texttt{Y} is given (cases 4, 5, 6), then picture is scaled |
| 87 |
homotetically. If both are present (case 7), then graphics is |
| 88 |
scaled vertically and horisontally, according to given parameters.\\ |
| 89 |
For example: \\ |
| 90 |
\cmd{begin}\{\texttt{lpic}\}\{\texttt{tessalation}\} -- means include |
| 91 |
graphics in the file \texttt{tessalation} at the original size.\\ |
| 92 |
\cmd{begin}\{\texttt{lpic}\}\{\texttt{tessalation(0.5)}\} -- means |
| 93 |
include graphics at the half the original size.\\ |
| 94 |
\cmd{begin}\{\texttt{lpic}\}\{\texttt{tessalation(0.5,3)}\} -- means |
| 95 |
include graphics shrinking twice in the horisontal direction and |
| 96 |
stretching 3 times in the vertical direction.\\ |
| 97 |
\cmd{begin}\{\texttt{lpic}\}\{\texttt{tessalation(,10cm)}\} -- include |
| 98 |
graphics homotetically scaled, so that height is equal to 10cm.\\ |
| 99 |
\cmd{begin}\{\texttt{lpic}\}\{\texttt{tessalation(150mm)}\} -- include |
| 100 |
graphics homotetically scaled, so that width is equal to 150mm.\\ |
| 101 |
\cmd{begin}\{\texttt{lpic}\}\{\texttt{tessalation(150mm,0.7)}\} -- |
| 102 |
include graphics scaled, so that width is equal to 150mm and |
| 103 |
height is 0.7 of the original. |
| 104 |
|
| 105 |
\vspace{2mm} |
| 106 |
\item[\sc OPTIONS] is a coma separated list of options (no spaces). |
| 107 |
Option are processed |
| 108 |
sequentially, thus options to the right override preceding ones. |
| 109 |
Parameter in \texttt{()} is optional, if omitted then some default |
| 110 |
value is taken. |
| 111 |
|
| 112 |
Options are: |
| 113 |
\item[\texttt{l(length)}] -- the size of the left margin beyond |
| 114 |
bounding box of graphics (default |
| 115 |
0mm). Negative values are also acceptable. |
| 116 |
\item[\texttt{r(length)}] - right margin |
| 117 |
\item[\texttt{t(lenght)}] - top margin |
| 118 |
\item[\texttt{b(length)}] -- bottom margin |
| 119 |
\item[\texttt{grid(step)}] -- Draw a grid over the picture of |
| 120 |
step \texttt{step*}\cmd{lpunitlength} and |
| 121 |
thickness \cmd{lpgridthickness}. Parameter |
| 122 |
\texttt{step} must be an integer and defaults to 5. |
| 123 |
\item[\texttt{coords(step)}] -- write coordinates with the step |
| 124 |
\texttt{step*}\cmd{lpunitlength}. Parameter step |
| 125 |
must be an integer and defaults to 10. |
| 126 |
\item[\texttt{frames(length)}] -- draw boxes of thickness {\tt |
| 127 |
length} over \latex{} material. Default value is |
| 128 |
0.01mm |
| 129 |
\item[\texttt{frame(length)}] -- draw a box around the whole |
| 130 |
thing (margins included). \texttt{length} is the |
| 131 |
thickness of the lines. Default value is |
| 132 |
0.7mm. |
| 133 |
\item[\texttt{figframe(length)}] -- draw a box around the |
| 134 |
included graphics. \texttt{length} is the |
| 135 |
thickness of the lines. Default value is |
| 136 |
0.2mm. |
| 137 |
\item[\texttt{draft}] -- draw whatever is convenient for |
| 138 |
adjusting the positions of \latex{} |
| 139 |
material. That includes grid, coordinates, all |
| 140 |
types of frames. |
| 141 |
\item[\texttt{clean}] -- remove all auxiliary stuff. |
| 142 |
\item[\texttt{nolbl}] -- don't typeset any \latex{} material. |
| 143 |
\item[\texttt{nofigure}] -- don't include the graphics, just an |
| 144 |
empty box of appropriate size |
| 145 |
|
| 146 |
\end{itemize} |
| 147 |
\vspace{2mm}\par\noindent |
| 148 |
Inside of \texttt{lpic} environment one can issue \cmd{lbl} command |
| 149 |
with the following syntax:\vspace{2mm}\par |
| 150 |
\texttt{\cmd{lbl}[{\sc OPTIONS}]% |
| 151 |
\{{\sc COORDINATES; any \latex{} material}\}} |
| 152 |
\vspace{2mm}\par\noindent |
| 153 |
\latex{} material is put in a box, rotated if necessary and printed |
| 154 |
in appropriate place. White rectangular background, which overshadows part of graphics could also be created. |
| 155 |
|
| 156 |
\begin{itemize} |
| 157 |
\item[\sc COORDINATES] are either pair or a triple of decimals. The |
| 158 |
first two numbers are coordinates of the point, where \latex{} material |
| 159 |
should be placed and the third is an angle of rotation applied to |
| 160 |
the box containing the material. Coordinates are measured in the |
| 161 |
coordinate system in the original, unscaled picture, with the unit |
| 162 |
equal to \cmd{lpunitlength} (default 1mm). So, if the picture is |
| 163 |
scaled, all the boxes containing \latex{} will hopefully stay at their |
| 164 |
appropriate places. |
| 165 |
\item[\sc OPTIONS] is optional and consists of at most three letters, |
| 166 |
one from the set {\tt\{t,b\}}, one from {\tt\{r,l\}} and one from {\tt\{w,W\}} |
| 167 |
in any |
| 168 |
order. \texttt{[t$|$b,l$|$r]} options give a reference point in a box containing \latex{} |
| 169 |
text. Coordinates refer to this reference point. Rotation is also |
| 170 |
centered at this point. Thus, there are total 9 possibilities |
| 171 |
referring to 9 evenly spaced points in the rectangle. |
| 172 |
If one of \texttt{[w$|$W]} is given then \latex is put on top of white box. |
| 173 |
The size of the box is equal to the size of the box containing the material in case of \texttt{w} |
| 174 |
and margins \cmd{lpbgsep}-wide are added in case of \texttt{W}. |
| 175 |
Note that \texttt{xdvi} apparently renders postscript after dvi, so any postscript covers dvi material. |
| 176 |
Thus, if you use background, you will not be able to see your \latex{} in \texttt{xdvi}. |
| 177 |
but once postscript file is created, \latex{} will show. |
| 178 |
\end{itemize} |
| 179 |
|
| 180 |
|
| 181 |
\section{ADJUSTABLE PARAMETERS} |
| 182 |
|
| 183 |
\begin{itemize} |
| 184 |
\item[\cmd{lpunitlength}] (1mm) Units in the unscaled coordinate |
| 185 |
system. |
| 186 |
\item[\cmd{lpmarginright}] (0mm) |
| 187 |
\item[\cmd{lpmarginleft}] (0mm) |
| 188 |
\item[\cmd{lpmargintop}] (0mm) |
| 189 |
\item[\cmd{lpmarginbottom}] (0mm) Default sizes of margins. |
| 190 |
\item[\cmd{lpbgsep}] (\cmd{fboxsep}) Margins for the white background. |
| 191 |
\item[\cmd{lpgridthickness}] (0.01mm) Thickness of the grid lines. |
| 192 |
\item[\cmd{lpframethickness}] (0.7mm) Thickness of the frame around |
| 193 |
the whole box. |
| 194 |
\item[\cmd{lplblframethickness}] (0.01mm) Thickness of the frame |
| 195 |
around labels. |
| 196 |
\item[\cmd{lpfigframethickness}] (0.2mm) Thickness of the frame |
| 197 |
around included graphics. |
| 198 |
\item[\tt lpgridstep] (5) Counter containing the step to draw grid lines |
| 199 |
\item[\tt lpcoordstep] (10) Counter containing the step to draw coordinates |
| 200 |
\end{itemize} |
| 201 |
|
| 202 |
\newpage |
| 203 |
\section{Example} |
| 204 |
\def\T{\operatorname{\mathrm T}} |
| 205 |
\def\d{\operatorname{\mathrm d}} |
| 206 |
\def\o{\ensuremath{\text{\tiny$\operatorname{\mathcal O}$}}} |
| 207 |
\def\R{\mathbb R} |
| 208 |
|
| 209 |
Provided the file \texttt{instructions-differential.eps} or \texttt{instructions-differential.pdf} |
| 210 |
contains the graphics one can include it in the document, drawing a |
| 211 |
grid and putting \latex{} on top of it. |
| 212 |
|
| 213 |
\begin{verbatim} |
| 214 |
\begin{lpic}[l(10mm),r(5mm),t(5mm),b(10mm),draft]{instructions-differential(0.7,0.6)} |
| 215 |
\lbl[t]{80,9;$x_0$} |
| 216 |
\lbl[b]{87,11;$\delta x$} |
| 217 |
\lbl[t]{101,7,-7;$x_0+\delta x$} |
| 218 |
\lbl[b]{120,11;$\T_{x_0}X$} |
| 219 |
\lbl[t]{88,59;$\delta x$} |
| 220 |
\lbl[b]{120,61;$\T_{x_0}X$} |
| 221 |
\lbl[tl]{120,3,-10;$X=\R$} |
| 222 |
\lbl[r]{79,74;$\d f(\delta x)$} |
| 223 |
\lbl[r]{79,102;$\T_{f(x_0)}Y$} |
| 224 |
\lbl[lb]{21,115;$\T_{f(x_0)}Y$} |
| 225 |
\lbl[l]{22,74;$\d f(\delta x)$} |
| 226 |
\lbl[r]{16,88;$f(x_0)+\d f(\delta x)$} |
| 227 |
\lbl[r]{19,60;$f(x_0)$} |
| 228 |
\lbl[r]{11,110;$f(x_0+\delta x)$} |
| 229 |
\lbl[l]{42,99;$\o(\delta x)$} |
| 230 |
\lbl[b]{10,121;$Y=\R$} |
| 231 |
\lbl[br]{47,21;Graph of $\d f$} |
| 232 |
\lbl[bl]{26,36,13;Graph of $y=f(x)$} |
| 233 |
\end{lpic} |
| 234 |
\end{verbatim} |
| 235 |
|
| 236 |
\vspace{5mm} |
| 237 |
|
| 238 |
\begin{lpic}[l(10mm),r(5mm),t(5mm),b(10mm),draft]{instructions-differential(0.7,0.6)} |
| 239 |
\lbl[t]{80,9;$x_0$} |
| 240 |
\lbl[b]{87,11;$\delta x$} |
| 241 |
\lbl[t]{101,7,-7;$x_0+\delta x$} |
| 242 |
\lbl[b]{120,11;$\T_{x_0}X$} |
| 243 |
\lbl[t]{88,59;$\delta x$} |
| 244 |
\lbl[b]{120,61;$\T_{x_0}X$} |
| 245 |
\lbl[tl]{120,3,-10;$X=\R$} |
| 246 |
\lbl[r]{79,74;$\d f(\delta x)$} |
| 247 |
\lbl[r]{79,102;$\T_{f(x_0)}Y$} |
| 248 |
\lbl[lb]{21,115;$\T_{f(x_0)}Y$} |
| 249 |
\lbl[l]{22,74;$\d f(\delta x)$} |
| 250 |
\lbl[r]{16,88;$f(x_0)+\d f(\delta x)$} |
| 251 |
\lbl[r]{19,60;$f(x_0)$} |
| 252 |
\lbl[r]{11,110;$f(x_0+\delta x)$} |
| 253 |
\lbl[l]{42,99;$\o(\delta x)$} |
| 254 |
\lbl[b]{10,121;$Y=\R$} |
| 255 |
\lbl[br]{47,21;Graph of $\d f$} |
| 256 |
\lbl[bl]{26,36,13;Graph of $y=f(x)$} |
| 257 |
\end{lpic} |
| 258 |
|
| 259 |
\vspace{5mm} |
| 260 |
When all label on the picture are adjusted one can get a ``clean'' |
| 261 |
picture by either removing \texttt{draft} option or adding \texttt{clean}. |
| 262 |
|
| 263 |
\begin{verbatim} |
| 264 |
\begin{lpic}[l(10mm),r(5mm),t(5mm),b(10mm),draft,clean]{instructions-differential(0.7,0.6)} |
| 265 |
... |
| 266 |
\end{lpic} |
| 267 |
\end{verbatim} |
| 268 |
|
| 269 |
\begin{lpic}[l(10mm),r(5mm),t(5mm),b(10mm),draft,clean]{instructions-differential(0.7,0.6)} |
| 270 |
\lbl[t]{80,9;$x_0$} |
| 271 |
\lbl[b]{87,11;$\delta x$} |
| 272 |
\lbl[t]{101,7,-7;$x_0+\delta x$} |
| 273 |
\lbl[b]{120,11;$\T_{x_0}X$} |
| 274 |
\lbl[t]{88,59;$\delta x$} |
| 275 |
\lbl[b]{120,61;$\T_{x_0}X$} |
| 276 |
\lbl[tl]{120,3,-10;$X=\R$} |
| 277 |
\lbl[r]{79,74;$\d f(\delta x)$} |
| 278 |
\lbl[r]{79,102;$\T_{f(x_0)}Y$} |
| 279 |
\lbl[lb]{21,115;$\T_{f(x_0)}Y$} |
| 280 |
\lbl[l]{22,74;$\d f(\delta x)$} |
| 281 |
\lbl[r]{16,88;$f(x_0)+\d f(\delta x)$} |
| 282 |
\lbl[r]{19,60;$f(x_0)$} |
| 283 |
\lbl[r]{11,110;$f(x_0+\delta x)$} |
| 284 |
\lbl[l]{42,99;$\o(\delta x)$} |
| 285 |
\lbl[b]{10,121;$Y=\R$} |
| 286 |
\lbl[br]{47,21;Graph of $\d f$} |
| 287 |
\lbl[bl]{26,36,13;Graph of $y=f(x)$} |
| 288 |
\end{lpic} |
| 289 |
|
| 290 |
Now if the picture is rescaled, \latex{} boxes also shift to |
| 291 |
appropriate positions. However, the angles are the visible angles in |
| 292 |
the final output and |
| 293 |
sometimes they have to be adjusted after rescaling of the included graphics. |
| 294 |
\begin{verbatim} |
| 295 |
\begin{lpic}[l(10mm),r(5mm),t(5mm),b(10mm),draft,clean]{instructions-differential(0.8,0.4)} |
| 296 |
... |
| 297 |
\end{lpic} |
| 298 |
\end{verbatim} |
| 299 |
|
| 300 |
\begin{lpic}[l(10mm),r(5mm),t(5mm),b(10mm),draft,clean]{instructions-differential(0.8,0.4)} |
| 301 |
\lbl[t]{80,9;$x_0$} |
| 302 |
\lbl[b]{87,11;$\delta x$} |
| 303 |
\lbl[t]{101,7,-7;$x_0+\delta x$} |
| 304 |
\lbl[b]{120,11;$\T_{x_0}X$} |
| 305 |
\lbl[t]{88,59;$\delta x$} |
| 306 |
\lbl[b]{120,61;$\T_{x_0}X$} |
| 307 |
\lbl[tl]{120,3,-10;$X=\R$} |
| 308 |
\lbl[r]{79,74;$\d f(\delta x)$} |
| 309 |
\lbl[r]{79,102;$\T_{f(x_0)}Y$} |
| 310 |
\lbl[lb]{21,115;$\T_{f(x_0)}Y$} |
| 311 |
\lbl[l]{22,74;$\d f(\delta x)$} |
| 312 |
\lbl[r]{16,88;$f(x_0)+\d f(\delta x)$} |
| 313 |
\lbl[r]{19,60;$f(x_0)$} |
| 314 |
\lbl[r]{11,110;$f(x_0+\delta x)$} |
| 315 |
\lbl[l]{42,99;$\o(\delta x)$} |
| 316 |
\lbl[b]{10,121;$Y=\R$} |
| 317 |
\lbl[br]{47,21;Graph of $\d f$} |
| 318 |
\lbl[bl]{26,36,13;Graph of $y=f(x)$} |
| 319 |
\end{lpic} |
| 320 |
|
| 321 |
|
| 322 |
\vspace{5mm} |
| 323 |
|
| 324 |
\end{document} |
| 325 |
|
| 326 |
|