| 1 |
% \iffalse % egplot.dtx - Encapsulated gnuplot for LaTeX(2e) |
| 2 |
% Copyright (C) 1998 by [email protected] |
| 3 |
% |
| 4 |
% Egplot is free software; you can redistribute it and/or modify it |
| 5 |
% under the terms of the GNU General Public License as published by |
| 6 |
% the Free Software Foundation; either version 2, or (at your option) |
| 7 |
% any later version. |
| 8 |
% |
| 9 |
% Egp is distributed in the hope that it will be useful, but |
| 10 |
% WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
% GNU General Public License for more details. |
| 13 |
% |
| 14 |
% You should have received a copy of the GNU General Public License |
| 15 |
% along with this program; if not, write to the Free Software |
| 16 |
% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 17 |
% |
| 18 |
% \fi |
| 19 |
% |
| 20 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 21 |
% |
| 22 |
%% \CheckSum{449} |
| 23 |
%% \CharacterTable |
| 24 |
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 25 |
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 26 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 27 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 28 |
%% Dollar \$ Percent \% Ampersand \& |
| 29 |
%% Acute accent \' Left paren \( Right paren \) |
| 30 |
%% Asterisk \* Plus \+ Comma \, |
| 31 |
%% Minus \- Point \. Solidus \/ |
| 32 |
%% Colon \: Semicolon \; Less than \< |
| 33 |
%% Equals \= Greater than \> Question mark \? |
| 34 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 35 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 36 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 37 |
%% Right brace \} Tilde \~} |
| 38 |
%% |
| 39 |
% |
| 40 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 41 |
% |
| 42 |
% \changes{v1.00}{1998/06/17}{First released version} |
| 43 |
% \changes{v1.01}{1998/06/25}{Fixed bug with \texttt{german} option and |
| 44 |
% negative tic mark values} |
| 45 |
% \changes{v1.02}{1998/07/08}{Added options \texttt{gnuplot35} and |
| 46 |
% \texttt{gnuplot36beta} to allow output of |
| 47 |
% syntax of \GP{}-3.5.\\ |
| 48 |
% Added numbering of \GP{} files to allow multiple |
| 49 |
% \texttt{egpfile} environments w/o explicitly |
| 50 |
% defined names in one document.} |
| 51 |
% |
| 52 |
% \MakeShortVerb{\|} |
| 53 |
% |
| 54 |
% |
| 55 |
% \title{% |
| 56 |
% \EGP: \\ |
| 57 |
% Encapsulated \GP{} for \LaTeX\thanks{% |
| 58 |
% This is \texttt{\filename}, version \fileversion, date \filedate.}} |
| 59 |
% |
| 60 |
% \author{% |
| 61 |
% Axel Probst\thanks{e-mail: |
| 62 |
% \texttt{[email protected]}}\\ |
| 63 |
% \hfil \\ |
| 64 |
% c/o\\ |
| 65 |
% Federal Institute for Materials Research and Testing\\ |
| 66 |
% Unter den Eichen 87\\ |
| 67 |
% D-12205 Berlin \\ |
| 68 |
% Germany} |
| 69 |
% |
| 70 |
% \maketitle |
| 71 |
% \begin{abstract} |
| 72 |
% The \EGP{} package allows to encapsulate \GP{} commands in \LaTeX{} |
| 73 |
% sources. This is very useful for keeping illustrations in sync |
| 74 |
% with the text. It also frees the user from inventing descriptive |
| 75 |
% names for PostScript files. Additionally the package provides commands that |
| 76 |
% enable the user to let \GP{} do calculations and insert the result values |
| 77 |
% into the generated output. |
| 78 |
% \end{abstract} |
| 79 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 80 |
% \begin{multicols}{2} |
| 81 |
% \tableofcontents |
| 82 |
% \end{multicols} |
| 83 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 84 |
% \vfill |
| 85 |
% \section*{Copying} |
| 86 |
% |
| 87 |
% \EGP{} is free software; you can redistribute it and/or modify it |
| 88 |
% under the terms of the GNU General Public License as published by |
| 89 |
% the Free Software Foundation; either version 2, or (at your option) |
| 90 |
% any later version. |
| 91 |
% |
| 92 |
% \EGP{} is distributed in the hope that it will be useful, but |
| 93 |
% \emph{without any warranty}; without even the implied warranty of |
| 94 |
% \emph{merchantability} or \emph{fitness for a particular purpose}. |
| 95 |
% See the GNU General Public License for more details. |
| 96 |
% |
| 97 |
% You should have received a copy of the GNU General Public License |
| 98 |
% along with this program; if not, write to the Free Software |
| 99 |
% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 100 |
% |
| 101 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 102 |
% |
| 103 |
% \def\topfraction{0.9} |
| 104 |
% \def\bottomfraction{0.9} |
| 105 |
% \def\textfraction{0.1} |
| 106 |
% \egpfigprelude{set terminal postscript eps monochrome dashed "Helvetica" 17^^J |
| 107 |
% set title ""; set grid^^J} |
| 108 |
% |
| 109 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 110 |
% \section{Introduction} |
| 111 |
% \label{sec:intro} |
| 112 |
% |
| 113 |
% When adding illustrations to documents, one faces two bookkeeping |
| 114 |
% problems: |
| 115 |
% \begin{enumerate} |
| 116 |
% \item How to encourage oneself to keep the illustrations in sync |
| 117 |
% with the text, when the document is updated? |
| 118 |
% \item How to make sure that the illustrations appear on the right |
| 119 |
% spot? |
| 120 |
% \end{enumerate} |
| 121 |
% For both problems, the best solution is to encapsulate the figures |
| 122 |
% in the \LaTeX{} source: |
| 123 |
% \begin{enumerate} |
| 124 |
% \item It is much easier to remember to update an illustration if |
| 125 |
% one doesn't have to switch files in the editor. |
| 126 |
% \item One does not have to invent illustrative filenames, if |
| 127 |
% the computer keeps track of them. |
| 128 |
% \end{enumerate} |
| 129 |
% This concept of integrating the image generating commands into the \LaTeX{} |
| 130 |
% source was implemented for \MF{} by Thorsten |
| 131 |
% Ohl\footnote{e-mail:\texttt{[email protected]}} in the |
| 132 |
% \EMP-package. |
| 133 |
% The \EGP{} package now allows the encapsulation of \GP~\cite{GP} into |
| 134 |
% \LaTeX~\cite{LaTeX-Graphics-Companion,LaTeX,LaTeX-Companion}. Although \GP{} |
| 135 |
% provides several output formats that are suitable for the inclusion into |
| 136 |
% \LaTeX{} the \EGP{} package is only intended for use with the Postscript |
| 137 |
% terminal of \GP{} so far. |
| 138 |
% |
| 139 |
% In addition to the image inclusion commands \EGP{} provides the user with |
| 140 |
% commands to let \GP{} do calculations and include the results into the |
| 141 |
% document. Unfortunately these features are implemented with the UN*X text utils |
| 142 |
% and so they are only usable if these are installed on the system. If the user |
| 143 |
% does not provide a name for the \GP{} file the |
| 144 |
% names for the PostScript and the result values files are built by appending |
| 145 |
% the number of the \GP{} file, the figure/calculation number and a three |
| 146 |
% letter extension (|.eps| or |.val|) to |\jobname|. So the user has to |
| 147 |
% choose a |\jobname| that is short enough so that the generated |
| 148 |
% filenames fit into the conventions of certain operating systems. |
| 149 |
% |
| 150 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 151 |
% \section{Usage} |
| 152 |
% |
| 153 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 154 |
% \subsection{Options} |
| 155 |
% \label{sec:options} |
| 156 |
% |
| 157 |
% \DescribeMacro{Options} |
| 158 |
% Besides the options of the |graphicx| package \EGP{} recognizes the following |
| 159 |
% options: |
| 160 |
% \begin{description} |
| 161 |
% \item[|german|:] If |german| is specified the calculated values and the tic labels of the |
| 162 |
% diagrams are changed to show a `,' as decimal point |
| 163 |
% character. The default is a `.'. This feature is also |
| 164 |
% implemented with UN*X text utils and is only available if |
| 165 |
% they are installed on the system. |
| 166 |
% \item[|gnuplot35|:] If |gnuplot35|~(default) is specified the \GP{} commands |
| 167 |
% generated by |egplot| will be compatible with the syntax |
| 168 |
% of the official \GP{} version~3.5. Of course the user |
| 169 |
% has to look for the right syntax in his \GP{} code |
| 170 |
% himself. Special care has to be taken for the |
| 171 |
% |\egpprelude{|\dots|}| and the |\egpfigepilog{|\dots|}| |
| 172 |
% commands since these are used to implement the missing |
| 173 |
% |reset| command of \GP{}-3.5. |
| 174 |
% \item[|gnuplot36beta|:] If |gnuplot36beta| is specified the \GP{} commands |
| 175 |
% generated by |egplot| will use the features of the |
| 176 |
% beta version \GP{}~3.6beta. As mentioned above the user |
| 177 |
% has to look for the right syntax in his \GP{} code |
| 178 |
% himself. |
| 179 |
% \end{description} |
| 180 |
% |
| 181 |
% \subsection{Commands and Environments} |
| 182 |
% \label{sec:commands} |
| 183 |
% |
| 184 |
% \subsubsection{Miscellaneous} |
| 185 |
% \label{sec:misc} |
| 186 |
% |
| 187 |
% \DescribeEnv{egpfile} |
| 188 |
% All descriptions that should go into one \GP{} file are placed |
| 189 |
% inside a |egpfile| environment which takes the name of the \GP{} |
| 190 |
% file as an optional argument: |
| 191 |
% \begin{quote} |
| 192 |
% \begin{flushleft} |
| 193 |
% |\begin{egpfile}[|\meta{\GP-file}|]|\\ |
| 194 |
% \qquad\ldots\\ |
| 195 |
% |\end{egpfile}| |
| 196 |
% \end{flushleft} |
| 197 |
% \end{quote} |
| 198 |
% The default \GP-filename is |\jobname.gp|. |
| 199 |
% |
| 200 |
% \DescribeEnv{egpcmds} |
| 201 |
% \DescribeMacro{\egpwrite} |
| 202 |
% Write \GP{} commands to the current file outside of a figure. |
| 203 |
% The |\egpwrite| command is intended for short one line commands. |
| 204 |
% \begin{quote} |
| 205 |
% \begin{flushleft} |
| 206 |
% |\begin{egpcmds}|\\ |
| 207 |
% \qquad\meta{\GP-commands}\\ |
| 208 |
% |\end{egpcmds}| |
| 209 |
% \end{flushleft} |
| 210 |
% \end{quote} |
| 211 |
% |
| 212 |
% \DescribeMacro{\egpprelude} |
| 213 |
% \DescribeMacro{\egpaddtoprelude} |
| 214 |
% Define and add to the set of commands that are prepended to the top of |
| 215 |
% every \GP{} file. It is intended for the global definition of variables |
| 216 |
% or functions. |
| 217 |
% |
| 218 |
% The default is empty. |
| 219 |
% |
| 220 |
% \subsubsection{Figures} |
| 221 |
% \label{sec:images} |
| 222 |
% |
| 223 |
% \DescribeEnv{egp} |
| 224 |
% \DescribeEnv{egpx} |
| 225 |
% \DescribeEnv{egpdef} |
| 226 |
% The |egp| as the |egpx| environment contains the description of a single |
| 227 |
% figure that will be placed at the location of the environment. |
| 228 |
% The |egpdef| environment only defines a figure but does not include it into |
| 229 |
% the document. This is useful, because these environments use the |
| 230 |
% |verbatim| package and can therefore \emph{not} be used as an |
| 231 |
% argument to other macros. The \meta{name} that is assigned to the figure is |
| 232 |
% used for later inclusion with the |\egpuse{|\meta{name}|}| command. |
| 233 |
% For the |egp| and |egpx| environment the assignment of the \meta{name} is |
| 234 |
% optional. |
| 235 |
% The required argument of the |egpx| environment accepts any set of keys |
| 236 |
% accepted by the |\includegraphics| command of the |graphicx| package. |
| 237 |
% \begin{quote} |
| 238 |
% \begin{flushleft} |
| 239 |
% |\begin{egp}[|\meta{name}|]|\\ |
| 240 |
% \qquad\meta{\GP-commands}\\ |
| 241 |
% |\end{egp}| |
| 242 |
% \end{flushleft} |
| 243 |
% \end{quote} |
| 244 |
% \begin{quote} |
| 245 |
% \begin{flushleft} |
| 246 |
% |\begin{egpx}[|\meta{name}|]{|\meta{key val list}|}|\\ |
| 247 |
% \qquad\meta{\GP-commands}\\ |
| 248 |
% |\end{egpx}| |
| 249 |
% \end{flushleft} |
| 250 |
% \end{quote} |
| 251 |
% \begin{quote} |
| 252 |
% \begin{flushleft} |
| 253 |
% |\begin{egpdef}{|\meta{name}|}|\\ |
| 254 |
% \qquad\meta{\GP-commands}\\ |
| 255 |
% |\end{egpdef}| |
| 256 |
% \end{flushleft} |
| 257 |
% \end{quote} |
| 258 |
% |
| 259 |
% \DescribeMacro{\egpuse} |
| 260 |
% Reuse a previously defined figure. |
| 261 |
% The optional argument of the |\egpuse| command accepts any set of the keys |
| 262 |
% that is accepted by the |\includegraphics| command of the |graphicx| package. |
| 263 |
% \begin{quote} |
| 264 |
% \begin{flushleft} |
| 265 |
% |\egpuse[|\meta{key val list}|]{|\meta{name}|}|\\ |
| 266 |
% \end{flushleft} |
| 267 |
% \end{quote} |
| 268 |
% |
| 269 |
% \DescribeMacro{\egpfigprelude} |
| 270 |
% \DescribeMacro{\egpaddtofigprelude} |
| 271 |
% Define and add to a \GP{} prelude that is prepended to the output of |
| 272 |
% every |egp|, |egpx| or |egpdef| environment. |
| 273 |
% The default is: |
| 274 |
% \begin{quote} |
| 275 |
% \qquad{}|set terminal postscript eps monochrome dashed "Helvetica" 17| |
| 276 |
% \end{quote} |
| 277 |
% In fact this is the command where the terminal for the \GP{}-|plot| command |
| 278 |
% is set. So the user has to take care that (Encapsulated) PostScript output is |
| 279 |
% generated. |
| 280 |
% |
| 281 |
% \DescribeMacro{\egpfigepilog} |
| 282 |
% \DescribeMacro{\egpaddtofigepilog} |
| 283 |
% Define and add to a \GP{} epilog that is appended to the output of |
| 284 |
% every |egp|, |egpx| or |egpdef| environment. |
| 285 |
% This command can be used for e.g. |replot|ting the figure to the screen or |
| 286 |
% |reset|ing to the defaults after every figure. |
| 287 |
% |
| 288 |
% The defaults are as follows: |
| 289 |
% \begin{quote} |
| 290 |
% \begin{tabular}{lll} |
| 291 |
% Option: & none, |gnuplot35| & |gnuplot36beta| \\ |
| 292 |
% & |load "reset.gp"| & |reset| \\ |
| 293 |
% \end{tabular} |
| 294 |
% \end{quote} |
| 295 |
% |
| 296 |
% \subsubsection{Calculating} |
| 297 |
% \label{sec:calculations} |
| 298 |
% |
| 299 |
% In addition to the commands and environments to generate and include \GP{} |
| 300 |
% figures the \EGP{}-package provides commands to use \GP{} for the |
| 301 |
% calculation of arbitrary arithmetic expressions. Since the \GP{}-|plot| |
| 302 |
% command is used for this feature every expression that is accepted by this |
| 303 |
% command is possible. But this may also lead to unexpected results if the |
| 304 |
% expression contains the variable~$x$ which is used as the independent |
| 305 |
% variable of the \GP{}-|plot| command. As stated |
| 306 |
% above~(cf.~p.~\pageref{sec:intro}) the UN*X text utils are used for the |
| 307 |
% implementation and so the calculation commands can only be used on systems |
| 308 |
% where these are installed. |
| 309 |
% |
| 310 |
% \DescribeMacro{\egpcalc} |
| 311 |
% Let \GP{} calculate the value of a \meta{\GP-expression}. The result is written to a |
| 312 |
% file. |
| 313 |
% The optional argument assigns a name to be used with |\egpuseval{|\meta{name}|}|. |
| 314 |
% \begin{quote} |
| 315 |
% \begin{flushleft} |
| 316 |
% |\egpcalc[|\meta{name}|]{|\meta{\GP-expression}|}|\\ |
| 317 |
% \end{flushleft} |
| 318 |
% \end{quote} |
| 319 |
% |
| 320 |
% \DescribeMacro{\egpuseval} |
| 321 |
% Insert a previously defined calculation result. |
| 322 |
% |
| 323 |
% \DescribeMacro{\egpshowval} |
| 324 |
% Does the same as the |\egpcalc|-command but additionally the result is placed |
| 325 |
% in the output at the position of the |\egpshowval|-command. |
| 326 |
% |
| 327 |
% \DescribeMacro{\egpassign} |
| 328 |
% The first argument is the name of a \meta{\GP-variable} or \meta{\GP-user |
| 329 |
% function} which is assigned the second argument which is a |
| 330 |
% \meta{\GP-expression}. The result is placed in the output as for the |
| 331 |
% |\egpshowval| command. |
| 332 |
% |
| 333 |
% \subsection{Procedure} |
| 334 |
% \label{sec:procedure} |
| 335 |
% |
| 336 |
% After \LaTeX{} has done it's job for the first time you have to invoke \GP{} |
| 337 |
% on the generated file~(default: |\jobnameX.gp|, where |X| is a number). Then |
| 338 |
% another \LaTeX{} run is necessary to include the figures and the results into |
| 339 |
% the output. |
| 340 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 341 |
% \subsection{Examples} |
| 342 |
% \label{sec:examples} |
| 343 |
% |
| 344 |
% For a simple example, let's draw the function |
| 345 |
% $f(x)=\sin({\sqrt{x^2+y^2}})/\sqrt{x^2+y^2}$. |
| 346 |
% \begin{macrocode} |
| 347 |
%<*sample> |
| 348 |
\begin{egpfile} |
| 349 |
\begin{center} |
| 350 |
\begin{egpx}[sombrero]{width=0.8\linewidth} |
| 351 |
set hidden3d |
| 352 |
set nogrid |
| 353 |
set samples 1000 |
| 354 |
set isosamples 35 |
| 355 |
splot [-10:10] [-10:10] sin(sqrt(x*x+y*y))/sqrt(x*x+y*y) |
| 356 |
\end{egpx} |
| 357 |
\end{center} |
| 358 |
% \end{macrocode} |
| 359 |
\begin{egpfile} |
| 360 |
\begin{center} |
| 361 |
\begin{egpx}[sombrero]{width=0.8\linewidth} |
| 362 |
set hidden3d |
| 363 |
set nogrid |
| 364 |
set samples 1000 |
| 365 |
set isosamples 35 |
| 366 |
splot [-10:10] [-10:10] sin(sqrt(x*x+y*y))/sqrt(x*x+y*y) |
| 367 |
\end{egpx} |
| 368 |
\end{center} |
| 369 |
% |
| 370 |
% Additionally we define a figure that will not be shown here but at the place |
| 371 |
% of the appropriate |\egpuse| command. |
| 372 |
% |
| 373 |
% \begin{macrocode} |
| 374 |
\begin{egpdef}{kleinbottle} |
| 375 |
set hidden3d |
| 376 |
set parametric |
| 377 |
set nokey |
| 378 |
set nogrid |
| 379 |
set noborder |
| 380 |
set noxtics |
| 381 |
set noytics |
| 382 |
set noztics |
| 383 |
set xrange [-10:10] |
| 384 |
set yrange [-10:10] |
| 385 |
set zrange [-3:3] |
| 386 |
set urange [0:2*pi] |
| 387 |
set vrange [0:2*pi] |
| 388 |
set isosamples 39,60 |
| 389 |
set view 60,120 |
| 390 |
set title "Klein bottle" |
| 391 |
splot (2*sin(u)*cos(v/2)-sin(2*u)*sin(v/2)+8)*cos(v), \ |
| 392 |
(2*sin(u)*cos(v/2)-sin(2*u)*sin(v/2)+8)*sin(v), \ |
| 393 |
2*sin(u)*sin(v/2)+sin(2*u)*cos(v/2) |
| 394 |
\end{egpdef} |
| 395 |
% \end{macrocode} |
| 396 |
\begin{egpdef}{kleinbottle} |
| 397 |
set hidden3d |
| 398 |
set parametric |
| 399 |
set nokey |
| 400 |
set nogrid |
| 401 |
set noborder |
| 402 |
set noxtics |
| 403 |
set noytics |
| 404 |
set noztics |
| 405 |
set xrange [-10:10] |
| 406 |
set yrange [-10:10] |
| 407 |
set zrange [-3:3] |
| 408 |
set urange [0:2*pi] |
| 409 |
set vrange [0:2*pi] |
| 410 |
set isosamples 39,60 |
| 411 |
set view 60,120 |
| 412 |
set title "Klein bottle" |
| 413 |
splot (2*sin(u)*cos(v/2)-sin(2*u)*sin(v/2)+8)*cos(v), \ |
| 414 |
(2*sin(u)*cos(v/2)-sin(2*u)*sin(v/2)+8)*sin(v), \ |
| 415 |
2*sin(u)*sin(v/2)+sin(2*u)*cos(v/2) |
| 416 |
\end{egpdef} |
| 417 |
% |
| 418 |
% Since we have given a name to each diagram, we can now use them with |
| 419 |
% \begin{macrocode} |
| 420 |
\begin{figure} |
| 421 |
\begin{center} |
| 422 |
\fbox{\egpuse[scale=0.4]{sombrero}} |
| 423 |
\fbox{\egpuse[scale=0.4]{kleinbottle}} |
| 424 |
\caption{Two examples taken from the \GP{} demo}\label{fig:demo} |
| 425 |
\end{center} |
| 426 |
\end{figure} |
| 427 |
% \end{macrocode} |
| 428 |
% |
| 429 |
% and the result is shown in figure~\ref{fig:demo}. |
| 430 |
% |
| 431 |
\begin{figure} |
| 432 |
\begin{center} |
| 433 |
\fbox{\egpuse[scale=0.4]{sombrero}} |
| 434 |
\fbox{\egpuse[scale=0.4]{kleinbottle}} |
| 435 |
\caption{Two examples taken from the \GP{} demo}\label{fig:demo} |
| 436 |
\end{center} |
| 437 |
\end{figure} |
| 438 |
% |
| 439 |
% To calculate the value of $f(\pi/4)$ we issue the command |
| 440 |
% |
| 441 |
% $f(\pi/4)=\egpshowval[sin_quarter_pi]{sin(pi/4)}$ |
| 442 |
% \begin{macrocode} |
| 443 |
$f(\pi/4)=\egpshowval[sin_quarter_pi]{sin(pi/4)}$ |
| 444 |
% \end{macrocode} |
| 445 |
% and get $\frac{\sqrt{2}}{2}=\fbox{\egpuseval{sin_quarter_pi}}\footnote{I |
| 446 |
% couldn't figure out how to remove the trailing space, yet. Any hints ?}$ |
| 447 |
% \begin{macrocode} |
| 448 |
and get $\frac{\sqrt{2}}{2}=\fbox{\egpuseval{sin_quarter_pi}}$. |
| 449 |
\end{egpfile} |
| 450 |
% \end{macrocode} |
| 451 |
% |
| 452 |
\end{egpfile} |
| 453 |
% \begin{macrocode} |
| 454 |
%</sample> |
| 455 |
% \end{macrocode} |
| 456 |
% |
| 457 |
% \section{Acknowledgements} |
| 458 |
% I would like to thank Thorsten Ohl for submitting the \EMP{} package to CTAN. |
| 459 |
% By using it as a template I managed it to adapt the idea of integrating the |
| 460 |
% image generating commands into \LaTeX{} for \GP{}. A lot of code of the |
| 461 |
% \EMP{} package was reused with only marginal changes. This is also caused by |
| 462 |
% the fact that I am far away from understanding all of the code of \EMP{}. |
| 463 |
% |
| 464 |
% \section{Todo} |
| 465 |
% In additon to optimising \EGP{} it would be nice if the features that are |
| 466 |
% provided through the use of UN*X text utils were implemented in |
| 467 |
% \TeX{}/\LaTeX{}. Another interesting feature to implement in following |
| 468 |
% versions of \EGP{} is the possibility to use other output formats |
| 469 |
% provided by \GP{}, especially the |pslatex| and |pstricks| terminals but also |
| 470 |
% the |png| terminal for inclusion into PDF could be useful. |
| 471 |
% |
| 472 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 473 |
% \begin{thebibliography}{99} |
| 474 |
% \bibitem{LaTeX-Graphics-Companion} Michel Goossens, Sebastian |
| 475 |
% Rahtz, and Frank Mittelbach, \textit{The \LaTeX{} Graphics |
| 476 |
% Companion}, Addison-Wesley, Reading MA, 1997. |
| 477 |
% \bibitem{LaTeX} Leslie Lamport, \textit{\LaTeX{} --- A |
| 478 |
% Documentation Preparation System}, |
| 479 |
% Addison-Wesley, Reading MA, 1985. |
| 480 |
% \bibitem{LaTeX-Companion} Michel Goossens, Frank Mittelbach, and |
| 481 |
% Alexander Samarin, \textit{The \LaTeX{} Companion}, |
| 482 |
% Addison-Wesley, Reading MA, 1994. |
| 483 |
% \bibitem{EMP} Thorsten Ohl, \texttt{emp}, available from |
| 484 |
% CTAN (cf.~p.~\pageref{pg:CTAN}), in the \texttt{macros/latex/contrib/supported/emp} |
| 485 |
% directory. |
| 486 |
% \bibitem{GP} Thomas Williams and Colin Kelley, \textit{gnuplot}, available |
| 487 |
% from \texttt{ftp.dartmouth.edu} in the \texttt{/pub/gnuplot} directory. |
| 488 |
% \end{thebibliography} |
| 489 |
% |
| 490 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 491 |
% \section*{Distribution} |
| 492 |
% \label{sec:distribution} |
| 493 |
% |
| 494 |
% \EGP{} is available by anonymous internet ftp from any of the |
| 495 |
% Comprehensive \TeX{} Archive Network (CTAN) hosts |
| 496 |
% \label{pg:CTAN} |
| 497 |
% \begin{quote} |
| 498 |
% |ftp.tex.ac.uk|, |ftp.dante.de| |
| 499 |
% \end{quote} |
| 500 |
% in the directory |
| 501 |
% \begin{quote} |
| 502 |
% |macros/latex/contrib/supported/egplot| |
| 503 |
% \end{quote} |
| 504 |
% |
| 505 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 506 |
% \StopEventually{\PrintIndex\PrintChanges} |
| 507 |
% |
| 508 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 509 |
% \section{Implementation} |
| 510 |
% |
| 511 |
% \begin{macrocode} |
| 512 |
%<*style> |
| 513 |
\def\fileversion{v1.02a} |
| 514 |
\NeedsTeXFormat{LaTeX2e} |
| 515 |
\gdef\filename{egplot.sty}% |
| 516 |
\gdef\filedate{1998/07/08}% |
| 517 |
\gdef\filemaintainer{Axel Probst}% |
| 518 |
% \end{macrocode} |
| 519 |
% |
| 520 |
% And now the standard procedure: |
| 521 |
% \begin{macrocode} |
| 522 |
\ProvidesPackage{egplot}[\filedate\space\fileversion\space |
| 523 |
Encapsulated gnuplot LaTeX Package (\filemaintainer)] |
| 524 |
% \end{macrocode} |
| 525 |
% |
| 526 |
% Load the required packages: |
| 527 |
% \begin{macrocode} |
| 528 |
\RequirePackage{verbatim} |
| 529 |
\RequirePackage{ifthen} |
| 530 |
% \end{macrocode} |
| 531 |
% |
| 532 |
% Now the options are specified: |
| 533 |
% \begin{macrocode} |
| 534 |
\newboolean{egp@german} |
| 535 |
\setboolean{egp@german}{false} |
| 536 |
\DeclareOption{german}{% |
| 537 |
\setboolean{egp@german}{true}} |
| 538 |
\newboolean{egp@oldgp} |
| 539 |
\setboolean{egp@oldgp}{true} |
| 540 |
\DeclareOption{gnuplot35}{% |
| 541 |
\setboolean{egp@oldgp}{true}} |
| 542 |
\DeclareOption{gnuplot36beta}{% |
| 543 |
\setboolean{egp@oldgp}{false}} |
| 544 |
% \end{macrocode} |
| 545 |
% |
| 546 |
% Every option we don't understand is sent down to |graphicx|: |
| 547 |
% \begin{macrocode} |
| 548 |
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{graphicx}} |
| 549 |
\ProcessOptions |
| 550 |
\RequirePackage{graphicx}[1994/12/15] |
| 551 |
% \end{macrocode} |
| 552 |
% |
| 553 |
% \begin{macro}{\egpwrite} |
| 554 |
% Write out the argument to the \GP{} file. |
| 555 |
% \begin{macrocode} |
| 556 |
{\catcode`\#=11\gdef\egpcomment{#}} |
| 557 |
\def\egpwrite#1{% |
| 558 |
\if@egpio |
| 559 |
\immediate\write\@outegp{#1}% |
| 560 |
\fi |
| 561 |
\ignorespaces} |
| 562 |
\newif\if@egpio |
| 563 |
\@egpiotrue |
| 564 |
\newwrite\@outegp |
| 565 |
% \end{macrocode} |
| 566 |
% \end{macro} |
| 567 |
% |
| 568 |
% \begin{macro}{\egpfile} |
| 569 |
% This environment encloses each \GP{} input file. The single optional |
| 570 |
% argument gives the name of the file. |
| 571 |
% \begin{macrocode} |
| 572 |
\newcounter{egpfilenum} % 1998-03-07 |
| 573 |
\setcounter{egpfilenum}{0} % 1998-03-07 |
| 574 |
\newcommand{\egpfile}[1][\jobname\theegpfilenum_]{% |
| 575 |
\def\theegpfile{#1}% |
| 576 |
\ifthenelse{\equal{\theegpfile}{\jobname\theegpfilenum_}}{% |
| 577 |
\stepcounter{egpfilenum}% |
| 578 |
\def\theegpfilename{\jobname\theegpfilenum.gp}}{% |
| 579 |
\def\theegpfilename{\theegpfile.gp}} |
| 580 |
% \end{macrocode} |
| 581 |
% Open the \GP{} file. |
| 582 |
% \begin{macrocode} |
| 583 |
\if@egpio |
| 584 |
\immediate\openout\@outegp=\theegpfilename\relax |
| 585 |
\egpwrite{\egpcomment\space \theegpfilename -- % |
| 586 |
do not edit, generated automatically by \jobname.tex^^J} |
| 587 |
% \end{macrocode} |
| 588 |
% append the defined prelude and write it out: |
| 589 |
% \begin{macrocode} |
| 590 |
\expandafter\ifx\expandafter*\the\egp@prelude*\else |
| 591 |
\egpwrite{\the\egp@prelude;}% |
| 592 |
\fi |
| 593 |
\fi |
| 594 |
% \end{macrocode} |
| 595 |
% Count the figures and the calculations |
| 596 |
% \begin{macrocode} |
| 597 |
\setcounter{egpfig}{0} |
| 598 |
\setcounter{egpcalc}{0}} |
| 599 |
\let\theegpfile\relax |
| 600 |
\newcounter{egpfig} |
| 601 |
\newcounter{egpcalc} |
| 602 |
% \end{macrocode} |
| 603 |
% Standard preludes for the whole file and for every figure and the per figure |
| 604 |
% epilog: |
| 605 |
% \begin{macrocode} |
| 606 |
\newtoks\egp@prelude |
| 607 |
\newtoks\egp@figprelude |
| 608 |
\newtoks\egp@figepilog |
| 609 |
% |
| 610 |
% \end{macrocode} |
| 611 |
% \end{macro} |
| 612 |
% |
| 613 |
% \begin{macro}{\egpprelude} |
| 614 |
% \begin{macro}{\egpfigprelude} |
| 615 |
% \begin{macro}{\egpfigepilog} |
| 616 |
% \begin{macro}{\egpaddtoprelude} |
| 617 |
% \begin{macro}{\egpaddtofigprelude} |
| 618 |
% \begin{macro}{\egpaddtofigepilog} |
| 619 |
% Define and add to the file or figure prelude and the figure epilog. |
| 620 |
% \begin{macrocode} |
| 621 |
\def\egpprelude#1{\egp@prelude={#1}} |
| 622 |
\def\egpfigprelude#1{\egp@figprelude={#1}} |
| 623 |
\def\egpfigepilog#1{\egp@figepilog={#1}} |
| 624 |
\def\egpaddtoprelude#1{\egp@prelude=\expandafter{\the\egp@prelude^^J#1}} |
| 625 |
\def\egpaddtofigprelude#1{\egp@figprelude=\expandafter{\the\egp@figprelude^^J#1}} |
| 626 |
\def\egpaddtofigepilog#1{\egp@figepilog=\expandafter{\the\egp@figepilog^^J#1}} |
| 627 |
% \end{macrocode} |
| 628 |
% \end{macro} |
| 629 |
% \end{macro} |
| 630 |
% \end{macro} |
| 631 |
% \end{macro} |
| 632 |
% \end{macro} |
| 633 |
% \end{macro} |
| 634 |
% |
| 635 |
% \begin{macro}{\endegpfile} |
| 636 |
% And here is how we close the |egpfile| environment: |
| 637 |
% \begin{macrocode} |
| 638 |
\def\endegpfile{% |
| 639 |
\egpwrite{\egpcomment\space the end.}% |
| 640 |
\let\theegpfile\relax |
| 641 |
\if@egpio |
| 642 |
\immediate\closeout\@outegp |
| 643 |
\fi} |
| 644 |
% \end{macrocode} |
| 645 |
% \end{macro} |
| 646 |
% |
| 647 |
% \begin{macro}{\egp} |
| 648 |
% \begin{macro}{\egpx} |
| 649 |
% \begin{macro}{\egpdef} |
| 650 |
% Here are the environments to define and to define and include the \GP{} diagrams. |
| 651 |
% \begin{macrocode} |
| 652 |
\newcommand{\egp}[1][*]{% |
| 653 |
\def\egp@@name{#1}% |
| 654 |
\egp@} |
| 655 |
\newcommand{\egpx}[2][*]{% |
| 656 |
\def\egp@@name{#1}% |
| 657 |
\egp@x{#2}} |
| 658 |
\newcommand{\egpdef}[1]{% |
| 659 |
\def\egp@@name{#1}% |
| 660 |
\egp@def} |
| 661 |
% \end{macrocode} |
| 662 |
% \end{macro} |
| 663 |
% \end{macro} |
| 664 |
% \end{macro} |
| 665 |
% |
| 666 |
% \begin{macro}{\egp@} |
| 667 |
% \begin{macro}{\egp@x} |
| 668 |
% \begin{macro}{\egp@def} |
| 669 |
% And here the real work is done. |
| 670 |
% \begin{macrocode} |
| 671 |
\def\egp@{% |
| 672 |
\egp@start% |
| 673 |
\ifthenelse{\boolean{egp@oldgp}} |
| 674 |
{\egpwrite{\egpcomment\space --- \theegpfile\theegpfig.eps ---}} |
| 675 |
{\egpwrite{print 'generating picture ---- \theegpfile\theegpfig.eps'}} |
| 676 |
\egpwrite{set output '\theegpfile\theegpfig.eps'} |
| 677 |
\egp@includegraphics{\theegpfile}{\theegpfig}% |
| 678 |
\egpcmds} |
| 679 |
\def\egp@x#1{% |
| 680 |
\egp@start% |
| 681 |
\ifthenelse{\boolean{egp@oldgp}} |
| 682 |
{\egpwrite{\egpcomment\space --- \theegpfile\theegpfig.eps ---}} |
| 683 |
{\egpwrite{print 'generating picture ---- \theegpfile\theegpfig.eps'}} |
| 684 |
\egpwrite{set output '\theegpfile\theegpfig.eps'} |
| 685 |
\egp@includegraphicx[#1]{\theegpfile}{\theegpfig}% |
| 686 |
\egpcmds} |
| 687 |
\def\egp@def{% |
| 688 |
\egp@start% |
| 689 |
\ifthenelse{\boolean{egp@oldgp}} |
| 690 |
{\egpwrite{\egpcomment\space --- \theegpfile\theegpfig.eps ---}} |
| 691 |
{\egpwrite{print 'generating picture ---- \theegpfile\theegpfig.eps'}} |
| 692 |
\egpwrite{set output '\theegpfile\theegpfig.eps'} |
| 693 |
\egpcmds} |
| 694 |
% \end{macrocode} |
| 695 |
% \end{macro} |
| 696 |
% \end{macro} |
| 697 |
% \end{macro} |
| 698 |
% |
| 699 |
% \begin{macro}{\egp@start} |
| 700 |
% \begin{macrocode} |
| 701 |
\def\egp@start{% |
| 702 |
\egp@checkfile |
| 703 |
% \end{macrocode} |
| 704 |
% We can't use |\stepcounter| because of the |amstext| option of |
| 705 |
% AMS-\LaTeX{} disables it sometimes. |
| 706 |
% \begin{macrocode} |
| 707 |
\global\expandafter\advance\csname c@egpfig\endcsname \@ne |
| 708 |
\egp@@def{\egp@@name}% |
| 709 |
% \end{macrocode} |
| 710 |
% Start the \GP{} figure: |
| 711 |
% \begin{macrocode} |
| 712 |
\expandafter\ifx\expandafter*\the\egp@figprelude*\else |
| 713 |
\egpwrite{\the\egp@figprelude}% |
| 714 |
\fi} |
| 715 |
% \end{macrocode} |
| 716 |
% \end{macro} |
| 717 |
% |
| 718 |
% \begin{macro}{\egp@checkfile} |
| 719 |
% Make sure that a \GP{} file is open, otherwise \emph{really} |
| 720 |
% obscure error messages are possible: |
| 721 |
% \begin{macrocode} |
| 722 |
\def\egp@checkfile{% |
| 723 |
\ifx\theegpfile\relax |
| 724 |
\errhelp={Outside an egpfile environment, I have no clue as to where^^J% |
| 725 |
the gnuplot commands should go. I will use egpdefault.gp^^J% |
| 726 |
for this graph, but you'd better fix your code!}% |
| 727 |
\errmessage{I detected a egp environment outside of egpfile}% |
| 728 |
\egpfile[egpdefault] |
| 729 |
\fi} |
| 730 |
% \end{macrocode} |
| 731 |
% \end{macro} |
| 732 |
% |
| 733 |
% \begin{macro}{\egp@includegraphics} |
| 734 |
% \begin{macro}{\egp@includegraphicx} |
| 735 |
% Include the Postscript files that were generated by \GP{} |
| 736 |
% \begin{macrocode} |
| 737 |
\def\egp@includegraphics#1#2{% |
| 738 |
\leavevmode |
| 739 |
\IfFileExists{#1#2.eps}% |
| 740 |
{\includegraphics{#1#2.eps}}% |
| 741 |
{\typeout{% |
| 742 |
egp: File #1#2.eps\space not found:^^J% |
| 743 |
egp: Process \theegpfilename\space with gnuplot and then % |
| 744 |
reprocess this file.}}} |
| 745 |
\newcommand{\egp@includegraphicx}[3][scale=1]{% |
| 746 |
\leavevmode |
| 747 |
\IfFileExists{#2#3.eps}% |
| 748 |
{\includegraphics[#1]{#2#3.eps}}% |
| 749 |
{\typeout{% |
| 750 |
egp: File #2#3.eps\space not found:^^J% |
| 751 |
egp: Process \theegpfilename\space with gnuplot and then % |
| 752 |
reprocess this file.}}} |
| 753 |
% \end{macrocode} |
| 754 |
% \end{macro} |
| 755 |
% \end{macro} |
| 756 |
% |
| 757 |
% \begin{macro}{\egpcmds} |
| 758 |
% Write to the file: |
| 759 |
% \begin{macrocode} |
| 760 |
\def\egpcmds{% |
| 761 |
\begingroup |
| 762 |
\@bsphack |
| 763 |
\let\do\@makeother\dospecials |
| 764 |
\catcode`\^^M\active |
| 765 |
\def\verbatim@processline{\egpwrite{\the\verbatim@line}}% |
| 766 |
\verbatim@start}% |
| 767 |
% \end{macrocode} |
| 768 |
% \end{macro} |
| 769 |
% |
| 770 |
% \begin{macro}{\endegpcmds} |
| 771 |
% \begin{macrocode} |
| 772 |
\def\endegpcmds{% |
| 773 |
\@esphack |
| 774 |
\endgroup} |
| 775 |
% \end{macrocode} |
| 776 |
% \end{macro} |
| 777 |
% |
| 778 |
% \begin{macro}{\endegp} |
| 779 |
% \begin{macro}{\endegpx} |
| 780 |
% \begin{macro}{\endegpdef} |
| 781 |
% If the |german| option is used the decimal point character is changed to be |
| 782 |
% |{,}|. This is done to avoid the additional space \LaTeX{} inserts after the |
| 783 |
% `,' in math mode. This is implemented by using some of the UN*X text utils |
| 784 |
% and therefore these have to be availlable on the system to benefit from this |
| 785 |
% feature. |
| 786 |
% \begin{macrocode} |
| 787 |
\def\endegp{% |
| 788 |
\endegpcmds |
| 789 |
\ifthenelse{\boolean{egp@german}}{% |
| 790 |
\egpwrite{!sed -e '/[0-9]*[.][0-9]*)\ .show/s/[.]/,/' % |
| 791 |
\theegpfile\theegpfig.eps >\theegpfile\theegpfig.tmp} |
| 792 |
\egpwrite{!cp \theegpfile\theegpfig.tmp \theegpfile\theegpfig.eps} |
| 793 |
\egpwrite{!rm -f \theegpfile\theegpfig.tmp}} |
| 794 |
{} |
| 795 |
\expandafter\ifx\expandafter*\the\egp@figepilog*\else |
| 796 |
\egpwrite{\the\egp@figepilog}% |
| 797 |
\fi |
| 798 |
\egpwrite{}} |
| 799 |
\def\endegpx{\endegp} |
| 800 |
\def\endegpdef{\endegp} |
| 801 |
% \end{macrocode} |
| 802 |
% \end{macro} |
| 803 |
% \end{macro} |
| 804 |
% \end{macro} |
| 805 |
% |
| 806 |
% \begin{macro}{\egp@@def} |
| 807 |
% \begin{macrocode} |
| 808 |
\def\egp@@def#1{% |
| 809 |
\global\e@namedef{egp@k:f:#1}{\theegpfile}% |
| 810 |
\global\e@namedef{egp@k:c:#1}{\theegpfig}} |
| 811 |
% \end{macrocode} |
| 812 |
% \end{macro} |
| 813 |
% |
| 814 |
% \begin{macro}{\e@namedef} |
| 815 |
% \begin{macrocode} |
| 816 |
\def\e@namedef#1{\expandafter\edef\csname #1\endcsname} |
| 817 |
% \end{macrocode} |
| 818 |
% \end{macro} |
| 819 |
% |
| 820 |
% \begin{macro}{\egpuse} |
| 821 |
% Reuse a previously defined figure. The figure is referred to by the name |
| 822 |
% given on the |egp|, |egpx| or |egpdef| environment. |
| 823 |
% \begin{macrocode} |
| 824 |
\newcommand{\egpuse}[2][scale=1]{% |
| 825 |
\@ifundefined{egp@k:f:#2}% |
| 826 |
{\typeout{egp: \string\egpuse: `#2' undefined!}}% |
| 827 |
{\egp@includegraphicx[#1]{\@nameuse{egp@k:f:#2}}{\@nameuse{egp@k:c:#2}}}} |
| 828 |
% \end{macrocode} |
| 829 |
% \end{macro} |
| 830 |
% |
| 831 |
% \begin{macro}{\egpcalc} |
| 832 |
% Calculate the expression in the required argument. |
| 833 |
% \begin{macrocode} |
| 834 |
\newcommand{\egpcalc}[2][*]{% |
| 835 |
\def\egp@@name{#1}% |
| 836 |
\def\egp@expression{#2} |
| 837 |
\egp@calc} |
| 838 |
% \end{macrocode} |
| 839 |
% \end{macro} |
| 840 |
% |
| 841 |
% \begin{macro}{\egp@calc} |
| 842 |
% Write the commands to the \GP{} file. |
| 843 |
% To get the calculated results in a file the \GP{} |table| terminal is used. |
| 844 |
% The number of samples is set to the lowest possible value and the |zero| |
| 845 |
% tolerance is set to 0. |
| 846 |
% \begin{macrocode} |
| 847 |
\def\egp@calc{% |
| 848 |
\egp@checkfile |
| 849 |
\global\expandafter\advance\csname c@egpcalc\endcsname \@ne |
| 850 |
\egpc@@def{\egp@@name}% |
| 851 |
\ifthenelse{\boolean{egp@oldgp}} |
| 852 |
{\egpwrite{\egpcomment\space --- \theegpfile\theegpcalc.val ---}} |
| 853 |
{\egpwrite{print 'calculating value ----- \theegpfile\theegpcalc.val'}} |
| 854 |
\egpwrite{set term table; set output '\theegpfile\theegpcalc.tmp'^^J% |
| 855 |
set samples 2^^J% |
| 856 |
set zero 0^^J% |
| 857 |
plot [0:0] \egp@expression} |
| 858 |
% \end{macrocode} |
| 859 |
% |
| 860 |
% Here intensive usage of UN*X text utils is made to extract the calculated |
| 861 |
% value out of the file \GP{} generated. |
| 862 |
% |
| 863 |
% If the |german| option is used the decimal point character is changed to be |
| 864 |
% `|{,}|'. This is done to avoid the additional space \LaTeX{} inserts after the |
| 865 |
% `,' in math mode. |
| 866 |
% |
| 867 |
% Maybe someone is able to implement all this in \TeX{} what would make this |
| 868 |
% package much more portable. |
| 869 |
% |
| 870 |
% \begin{macrocode} |
| 871 |
\ifthenelse{\boolean{egp@german}}{% |
| 872 |
\egpwrite{!tail -3 \theegpfile\theegpcalc.tmp | head -1 |% |
| 873 |
cut -f 2 -d' ' | sed -e 's/[.]/{,}/' % |
| 874 |
>\theegpfile\theegpcalc.val}} |
| 875 |
{\egpwrite{!tail -3 \theegpfile\theegpcalc.tmp | head -1 |% |
| 876 |
cut -f 2 -d' ' >\theegpfile\theegpcalc.val}} |
| 877 |
\egpwrite{!rm -f \theegpfile\theegpcalc.tmp} |
| 878 |
% \ifthenelse{\boolean{egp@oldgp}}{% |
| 879 |
% \egpwrite{load "reset.gp"}}{% |
| 880 |
% \egpwrite{reset}} |
| 881 |
\egpwrite{}} |
| 882 |
% \end{macrocode} |
| 883 |
% \end{macro} |
| 884 |
% |
| 885 |
% \begin{macro}{\egpc@@def} |
| 886 |
% \begin{macrocode} |
| 887 |
\def\egpc@@def#1{% |
| 888 |
\global\e@namedef{egp@k:f:#1}{\theegpfile}% |
| 889 |
\global\e@namedef{egp@k:v:#1}{\theegpcalc}} |
| 890 |
% \end{macrocode} |
| 891 |
% \end{macro} |
| 892 |
% |
| 893 |
% \begin{macro}{\egp@includevalue} |
| 894 |
% With this command the generated result is read into the \LaTeX{} file. |
| 895 |
% Unfortunately a trailing \verb*+\ + is shown after the included value what is |
| 896 |
% caused --- as I think --- by the |\input| command. There should be a way to |
| 897 |
% avoid this but I don't know how. Any wizards out there? |
| 898 |
% \begin{macrocode} |
| 899 |
\newcommand{\egp@includevalue}[2]{% |
| 900 |
% \InputIfFileExists{#1#2.val}{\ignorespaces}% |
| 901 |
\IfFileExists{#1#2.val}% |
| 902 |
{\input{#1#2.val}}% |
| 903 |
{\typeout{% |
| 904 |
egp: File #1#2.val\space not found:^^J% |
| 905 |
egp: Process \theegpfilename\space with gnuplot and then % |
| 906 |
reprocess this file.}}} |
| 907 |
% \end{macrocode} |
| 908 |
% \end{macro} |
| 909 |
% |
| 910 |
% \begin{macro}{\egpshowval} |
| 911 |
% Calculate and include the result during the \LaTeX{} run. |
| 912 |
% \begin{macrocode} |
| 913 |
\newcommand{\egpshowval}[2][*]{% |
| 914 |
\def\egp@@name{#1}% |
| 915 |
\def\egp@expression{#2}% |
| 916 |
\egp@calc% |
| 917 |
\egp@includevalue{\theegpfile}{\theegpcalc}} |
| 918 |
% \end{macrocode} |
| 919 |
% \end{macro} |
| 920 |
% |
| 921 |
% \begin{macro}{\egpuseval} |
| 922 |
% Include a previously defined value. |
| 923 |
% \begin{macrocode} |
| 924 |
\newcommand{\egpuseval}[1]{% |
| 925 |
\@ifundefined{egp@k:f:#1}% |
| 926 |
{\typeout{egp: \string\egpuseval: `#1' undefined!}}% |
| 927 |
{\egp@includevalue{\@nameuse{egp@k:f:#1}}{\@nameuse{egp@k:v:#1}}}} |
| 928 |
% \end{macrocode} |
| 929 |
% \end{macro} |
| 930 |
% |
| 931 |
% \begin{macro}{\egpassign} |
| 932 |
% \begin{macrocode} |
| 933 |
\newcommand{\egpassign}[2]{% |
| 934 |
\egpwrite{#1=#2}\egpshowval{#1}} |
| 935 |
% \end{macrocode} |
| 936 |
% \end{macro} |
| 937 |
% |
| 938 |
% Define the file prelude: |
| 939 |
% If the user specifies that the official version \GP{}-3.5 is used a file with |
| 940 |
% the name |reset.gp| is generated at the start of the \GP{} run. Wherever a |
| 941 |
% |reset| is done in the \GP{}-3.6 file this file is |load|ed instead. |
| 942 |
% \begin{macrocode} |
| 943 |
\ifthenelse{\boolean{egp@oldgp}} |
| 944 |
{\egpprelude{save "reset.gp"}} |
| 945 |
{\relax} |
| 946 |
% \end{macrocode} |
| 947 |
% |
| 948 |
% Define the default prelude for the figures: |
| 949 |
% \begin{macrocode} |
| 950 |
\egpfigprelude{set terminal postscript eps monochrome dashed "Helvetica" 17} |
| 951 |
% \end{macrocode} |
| 952 |
% To get e.g. Computer Modern as font for the axis tics you can specify the |
| 953 |
% name of a CM-Type-1 font file as fontname option of the \GP{} postscript |
| 954 |
% terminal. |
| 955 |
% For example: |
| 956 |
% \begin{quote} |
| 957 |
% \begin{flushleft} |
| 958 |
% |\egpfigprelude{set terminal postscript eps monochrome dashed "CMSS17" 20}| |
| 959 |
% \end{flushleft} |
| 960 |
% \end{quote} |
| 961 |
% To see the correct font in the Postscript file you have to use the |
| 962 |
% appropriate fontmap when calling dvips or you have to download the file |
| 963 |
% |cmss17.pfb| as header file. The error message of dvips can then be |
| 964 |
% ignored.\\ |
| 965 |
% |
| 966 |
% |
| 967 |
% |
| 968 |
% Reset all options to their default values after every |egp|, |egpx| and |
| 969 |
% |egpdef| environment. |
| 970 |
% As mentioned above the file |reset.gp| that is generated at the start of the |
| 971 |
% \GP{} run is |load|ed to implement the new |reset| command of \GP{}-3.6beta |
| 972 |
% if the user didn't specify |gnuplot36beta| as package option. |
| 973 |
% \begin{macrocode} |
| 974 |
\ifthenelse{\boolean{egp@oldgp}}{% |
| 975 |
\egpfigepilog{load "reset.gp"}}{% |
| 976 |
\egpfigepilog{reset}} |
| 977 |
% \end{macrocode} |
| 978 |
% |
| 979 |
% You can configure \EGP{} by putting the appropriate commands in the file |
| 980 |
% egplot.cfg that has to be located where \TeX{} can find it. |
| 981 |
% \begin{macrocode} |
| 982 |
\InputIfFileExists{egplot.cfg} |
| 983 |
{\typeout{egp: Using configuration file 'egplot.cfg'}} |
| 984 |
{} |
| 985 |
%</style> |
| 986 |
% \end{macrocode} |
| 987 |
% |
| 988 |
% \Finale |
| 989 |
% |
| 990 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 991 |
% \appendix |
| 992 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 993 |
% \section{Driver File} |
| 994 |
% |
| 995 |
% \begin{macrocode} |
| 996 |
%<*driver> |
| 997 |
\documentclass[a4paper]{article} |
| 998 |
\usepackage{doc} |
| 999 |
\usepackage{multicol} |
| 1000 |
% \end{macrocode} |
| 1001 |
% |
| 1002 |
% \begin{macrocode} |
| 1003 |
\IfFileExists{mflogo.sty}% |
| 1004 |
{\usepackage{mflogo}% |
| 1005 |
\def\GP{\textsf{gnuplot}}% |
| 1006 |
\def\EGP{\textsf{egplot}}% |
| 1007 |
\def\EMP{\textlogo{EMP}}}% |
| 1008 |
{\def\GP{\textsf{gnuplot}}% |
| 1009 |
\def\EMP{\textsf{EMP}}% |
| 1010 |
\def\EGP{\textsf{egplot}}} |
| 1011 |
% \end{macrocode} |
| 1012 |
% |
| 1013 |
% \begin{macrocode} |
| 1014 |
\usepackage[gnuplot35]{egplot} |
| 1015 |
%\usepackage[gnuplot36beta]{egplot} |
| 1016 |
% \end{macrocode} |
| 1017 |
% \begin{macrocode} |
| 1018 |
\setlength{\parindent}{0pt} |
| 1019 |
\def\manindex#1{\SortIndex{#1}{#1}} |
| 1020 |
%<manual>\OnlyDescription |
| 1021 |
\EnableCrossrefs |
| 1022 |
\RecordChanges |
| 1023 |
\CodelineIndex |
| 1024 |
\DoNotIndex{\def,\gdef,\long,\let,\begin,\end,\if,\ifx,\else,\fi} |
| 1025 |
\DoNotIndex{\immediate,\write,\newwrite,\openout,\closeout,\typeout} |
| 1026 |
\DoNotIndex{\font,\jobname,\documentclass,\char,\catcode,\ } |
| 1027 |
\DoNotIndex{\CodelineIndex,\DocInput,\DoNotIndex,\EnableCrossrefs} |
| 1028 |
\DoNotIndex{\filedate,\filename,\fileversion,\logo,\manfnt} |
| 1029 |
\DoNotIndex{\NeedsTeXFormat,\ProvidesPackage,\RecordChanges,\space} |
| 1030 |
\DoNotIndex{\begingroup,\csname,\edef,\endcsname,\expandafter} |
| 1031 |
\DoNotIndex{\usepackage,\@ifundefined,\ignorespaces,\item,\leavevmode} |
| 1032 |
\DoNotIndex{\newcounter,\newif,\par,\parindent} |
| 1033 |
\DoNotIndex{\relax,\setcounter,\stepcounter,\the,\advance} |
| 1034 |
\DoNotIndex{\CurrentOption,\DeclareOption,\documentstyle} |
| 1035 |
\DoNotIndex{\endgroup,\global,\hfuzz,\LaTeX,\LaTeXe} |
| 1036 |
\DoNotIndex{\macrocode,\@makeother,\OnlyDescription,\PassOptionsToPackage} |
| 1037 |
\DoNotIndex{\ProcessOptions,\RequirePackage,\string,\textsf,\unitlength} |
| 1038 |
\DoNotIndex{\@bsphack,\@esphack,\@nameuse,\@ne,\active,\do,\dospecials} |
| 1039 |
\DoNotIndex{\errhelp,\errmessage,\ifcase,\IfFileExists,\includegraphics} |
| 1040 |
\DoNotIndex{\manindex,\SortIndex,\newcommand,\newtoks,\or,\origmacrocode} |
| 1041 |
\DoNotIndex{\alpha,\displaystyle,\frac,\sin,\texttt} |
| 1042 |
% \end{macrocode} |
| 1043 |
% Cut the line breaking some slack for macro code which might contain |
| 1044 |
% long lines (it doesn't really hurt if they stick out a bit). |
| 1045 |
% \begin{macrocode} |
| 1046 |
\let\origmacrocode\macrocode |
| 1047 |
\def\macrocode{\hfuzz 5em\origmacrocode} |
| 1048 |
\begin{document} |
| 1049 |
\DocInput{egplot.dtx} |
| 1050 |
\end{document} |
| 1051 |
%</driver> |
| 1052 |
% \end{macrocode} |
| 1053 |
% |
| 1054 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |