\documentclass{book}
\usepackage[dvips]{graphics}
\usepackage{ifthen}
\newcommand{\VarName}[1]{%
\ifthenelse{\equal{#1}{a}}{This will be Caption A}{}%
\ifthenelse{\equal{#1}{b}}{This will be Caption B}{}%
\ifthenelse{\equal{#1}{c}}{This will be Caption C}{}%
}
% Arguments of putfig are
% (1) resized x dimension
% (2) resized y dimension
% (3) lower corner coordinates from PostScript page
% (4) upper corner coordinates from PostScript page
% (5) directory/filename of PostScript file
% (6) Figure label
% (7) Figure title
\newcommand{\putfig}[7]%
{\begin{figure}[tbh]%
\centerline{\resizebox{#1}{#2}{\includegraphics*[#3][#4]{/home/lk3a/#5}}}%
\caption{\label{fig:#6} #7}%
\end{figure}}
%
\begin{document}
\putfig{!}{3.25in}{150,97}{410,404}{mdata/pointres.ps}{pointres}{\VarName{a}}
\end{document}
Partial list of error messages:
This is TeX, Version 3.141 (C version d)
LaTeX2e <1994/06/01> patch level 3
(scratch.tex (/tex/lib/macros/book.cls
Document Class: book 1994/07/13 v1.2u Standard LaTeX document class
(/tex/lib/macros/bk10.clo)) (/home/lk3a/text/macros/graphics.sty
(/home/lk3a/text/macros/trig.sty) (/home/lk3a/text/macros/dvips.def))
(/tex/lib/macros/ifthen.sty) (scratch.aux
Runaway argument?
{\protect \contentsline {figure}{\protect \numberline {0.1}{\ignorespaces \ETC.
! Paragraph ended before \@writefile was complete.
<to be read again>
\par
l.2 ...toks@ {{a}{a}}\long \def #1##1##2{\def \par
}\toks@ {}#1\xdef \OT1/cm...
! Extra }, or forgotten \endgroup.
l.2 ...ks@ {{a}{a}}\long \def #1##1##2{\def \par }
\toks@ {}#1\xdef \OT1/cmr/...
! You can't use `macro parameter character #' in vertical mode.
l.2 ...}}\long \def #1##1##2{\def \par }\toks@ {}#
1\xdef \OT1/cmr/m/n/10 {}\...
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.2 ...}\long \def #1##1##2{\def \par }\toks@ {}#1
\xdef \OT1/cmr/m/n/10 {}\l...
! Missing control sequence inserted.
<inserted text>
\inaccessible
l.2 .../cmr/m/n/10 \xdef \OT1/cmr/m/n/10 {}\edef {
\textfont \symoperators \s...
--
___________________________________________________________________________________
Levent Kitis lk...@cars.mech.virginia.edu lk...@kelvin.seas.virginia.edu
University of Virginia Department of Mechanical, Aerospace, and Nuclear Engineering
___________________________________________________________________________________
Dracula> \documentclass{book}
Dracula> \usepackage[dvips]{graphics}
Dracula> \usepackage{ifthen}
Dracula> \newcommand{\VarName}[1]{%
Dracula> \ifthenelse{\equal{#1}{a}}{This will be Caption A}{}%
Dracula> \ifthenelse{\equal{#1}{b}}{This will be Caption B}{}%
Dracula> \ifthenelse{\equal{#1}{c}}{This will be Caption C}{}%
Dracula> }
Dracula> % Arguments of putfig are
Dracula> % (1) resized x dimension
Dracula> % (2) resized y dimension
Dracula> % (3) lower corner coordinates from PostScript page
Dracula> % (4) upper corner coordinates from PostScript page
Dracula> % (5) directory/filename of PostScript file
Dracula> % (6) Figure label
Dracula> % (7) Figure title
Dracula> \newcommand{\putfig}[7]%
Dracula> {\begin{figure}[tbh]%
Dracula> \centerline{\resizebox{#1}{#2}{\includegraphics*[#3][#4]{/home/lk3a/#5}}}%
Dracula> \caption{\label{fig:#6} #7}%
Dracula> \end{figure}}
Dracula> %
Dracula> \begin{document}
Dracula> \putfig{!}{3.25in}{150,97}{410,404}{mdata/pointres.ps}{pointres}{\VarName{a}}
Dracula> \end{document}
As usual, you should \protect fragile macros in moving environments.
\putfig{!}{3.25in}{150,97}{410,404}{mdata/pointres.ps}{pointres}{\protect\VarName{a}}
-- Vincent