[OS X TeX] preamble vs. macro (problem with xy and ps4pdf)

Ross Moore ross at ics.mq.edu.au
Thu Apr 7 01:28:01 EDT 2005

Hi Roger,

On 07/04/2005, at 2:58 PM, Roger Hart wrote:

> I need to standardize the preambles to numerous files I'm working on,
> so it seemed to make sense to me to put all of my packages,
> environments, and commands in a single file and use that as a package,
> mypackages.sty. This works with the exception of a command using both
> ps4pdf and xy. Basically, to simplify a bit to get at the problem,
> what I want to do is to put the following command in my file of
> commands and packages,
>
> \def\mydiagram#1{\PSforPDF{\xymatrix@!=0mm at R-=10mm at C-=6mm@*[c]{#1}}}
>
> The problem seems to be with the xymatrix options. That is,
>
> \def\mydiagram#1{\PSforPDF{\xymatrix{#1}}}
>
> works just fine in mypackages.sty, but if I try to add the xymatrix
> options,
>
> @!=0mm at R-=10mm at C-=6mm@*[c]
>
> which is the whole reason I'm defining \mydiagram, then I get an
> "unknown control sequence" error.

Sounds like a category-code error.
I'd like to see the complete log-message,
where it shows you which control-sequence is apparently undefined.

It would also help to see the complete .tex file that is being
processed at the time of the error.
(You may need to edit a script to prevent it being removed,
similar to advice given on this list for a different package.)

Here is an attempt to solve the problem, without knowing enough
to be sure that I have it correctly diagnosed:

Presumably you are defining \mydiagram  within the preamble,
or within a package.

In this case, try:

\makeatother
\def\mydiagram#1{\PSforPDF{\xymatrix@!=0mm at R-=10mm at C-=6mm@*[c]{#1}}}
\makeatletter

Or if that doesn't work, try

\def\mydiagram#1{\PSforPDF{{\xycatcodes\xymatrix@!=0mm at R-=10mm at C-
=6mm@*[c]{#1}}}}

>
> I've spent a few hours, I'm embarrassed to admit, reading and
> rereading my LaTeX and TeX books, and trying quite blindly various
> combinations of \expand this, \noexpand that, expandafter the other,
> etc., with a \edef here, and a \gdef there, but with no success. I've
> also looked at the xymatrix documentation, but could not find a better
> way to set the options. Any suggestions?
>
> Thanks very much,

Hope this helps,

Ross

>
> Roger
>
>
> ********************************
>
> Roger Hart
> Assistant Professor, Departments of History and Asian Studies
> University of Texas at Austin
>
> office: Room 405, Garrison Hall
> office phone: 512-475-7258
> department fax: 512-475-7222
> email: rhart at mail.utexas.edu
> http://uts.cc.utexas.edu/~rhart
>
> *********************************
>
> --------------------- Info ---------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>           & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
>
>
>
------------------------------------------------------------------------
Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia                                  fax: +61 +2 9850 8114
------------------------------------------------------------------------

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>