Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a problem compiling the following document.

First, I have a file macros.sty that consists of :

\newcommand{\test}{
\xymatrix@R=0mm{x}
}

Then, I have an auxiliary file out.aux that consists of :

\test

Finally, the main file is :

\documentclass{article}
\usepackage[all]{xy}
\usepackage{macros}
\begin{document}
\input{out.aux}
\end{document}

The error message is :

./out.aux:1: Undefined control sequence.
\xymatrix@R ->\Addop@@ 
                   \xymatrixrowsep@ \dimen@ii 

Note that if you remove the R=0mm, the problem no longer holds.

Is that a bug ?

It is very strange because I remember to have already used a command similar to \test in an input file without any problem.

Does it come from my distribution ?

Thank you :)

share|improve this question
3  
As a side note, you might consider accepting some of the answers from your previous questions. This will improve your 'acceptance rate', and may influence how many people answer your current question :) –  cmhughes Oct 18 '11 at 15:19
    
I agree with you --- but, actually, some of my questions didn't get a satisfying answer, imo. (Even though these answers are interesting and nice) –  Colas Oct 18 '11 at 16:03
add comment

1 Answer

up vote 6 down vote accepted

The problem is that .sty files are read with an implicit \makeatletter command, so your input is interpreted as the command \xymatrix@R and not as \xymatrix followed by @. Either write

\makeatother
\newcommand{\test}{\xymatrix@R=0mm{x}}
\makeatletter

or move the definition of \test to a file that you load with \input and not with \usepackage.

share|improve this answer
    
Clear and nice answer ! Apart from this @-matter, what's the difference between \input and \usepackage ? Should I prefer \usepackage for my commands ? –  Colas Oct 18 '11 at 16:04
    
Your idea works but I dont understand why there is no problem if I execute directly in the .tex file the command \test. –  Colas Oct 18 '11 at 16:08
    
@Colas I get the same error both with \input and writing \test directly in the file. I'd recommend \input for your macros. –  egreg Oct 18 '11 at 16:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.