[Xy-pic] Compilation error:
Ross Moore
ross at ics.mq.edu.au
Fri Dec 14 01:08:11 CET 2007
Hello Lars,
On 14/12/2007, at 1:33 AM, Lars Peter Cleary wrote:
> Dear Ross
>
> For my setup I also needed to add $ to indicate mathematical formulas.
Strange.
Xy-pic was designed to put labels directly into math-mode,
so that there would be no need to insert the delimiters,
especially since most diagrams are done in math-displays anyway.
>
> Below the final code for the tree, it's a Markow-event-tree:
> \xymatrix{
> & & & & {\circ} \ar@{-}[dll]_{$\frac{1}{2}$}
> If the following is of any interest:
> My setup is Windows XP, MikTex 2.7 (all packages) and GPL
> ghostscript 8.61.
> My editor is Eclipse (3.3.1.1) with the TeXlipse plugin (1.2.1).
> This setup works very well, by the way.
>
> For the math I use following packages:
> \usepackage{amsmath}
> \usepackage{amsthm}
> \usepackage{amsfonts}
> \usepackage[all]{xy}
> \usepackage{xytree}
Ahah. Here's the culprit.
xytree.sty has a very unfriendly line of coding:
\def\labelstyle{\hbox}
This globally overrides the Xy-pic default setting of:
\xylet@\labelstyle=\scriptstyle
It also has an effect on parsing, since \hbox requires
a parameter.
Note that this gives a good explanation of your original
problem:
\ar@{-}[dll]_\frac{1}{2}
would result in trying to set the label using \hbox{\frac}
and the numbers {1}{2} would just become part of the
current cell's contents.
The author of xytree.sty should have implemented a better way
to apply his desired change to \labelstyle by restricting it
to the commands, defined within his own package, such as
\xytree and \yytree .
Otherwise it affects usage within Xy-pic diagrams that have
no relation whatsoever to his tree-like layouts.
It means that such diagrams cannot be copied and reused
within documents that do not load his xytree package,
without the risk of encountering problems, whose solution
is not documented anywhere (until now!).
BTW, xtree.sty also changes \objectstyle to \hbox ,
but this is limited to the argument of the \xytext command.
I'm very surprised that people haven't encountered problems
in examples using this.
>
> Thanks a lot for the pointer, Ross, that was very helpful!
Thank you for reporting it,
and the subsequent incompatibility that your latest
message has revealed.
>
> Kind regards
> Lars
>
> On 12/13/07, Ross Moore <ross at ics.mq.edu.au> wrote:
>> Hello Lars,
>>
>> On 12/12/2007, at 10:20 PM, Lars Peter Cleary wrote:
>>
>>> Hi all
>>>
>>> I have some trouble compiling this bit of added code (without it it
>>> works):
>>>
>>> \xymatrix{
>>> & & & & & & & {\circ} \ar@{-}[dl]_\frac{1}{2} \ar@{-}[dr]^\frac
>>> {1}{2}
>>
>> You cannot set a complicated object, such as a fraction,
>> as a label in this way. It has to be:
>>
>> \ar@{-}[dl]_{\frac{1}{2}} \ar@{-}[dr]^{\frac{1}{2}}
>>
>> using extra braces.
>> Otherwise the \frac will end up being used in a place
>> quite apart from its arguments, thus triggering the kind
>> of messages that you are seeing.
>>
>>
>>> & & & & & & & \\
>>> & & & *+[F]\txt{L1} \ar@{-}[dl]_\frac{1}{2} \ar@{-}[dr]^\frac{1}
>>> {2} &
>>> & & & & & & & *+[F]\txt{L2} \ar@{-}[dl]_\frac{1}{4}
>>> \ar@{-}[dr]^\frac{3}{4} & & & \\
>>> & & *+[o][F-]\txt{G} \ar@{-}[dl]_1 \ar@{-}[dr]^1 & & *+[o][F-]
>>> \txt{V}
>>> \ar@{-}[dl]_1 \ar@{-}[dr]^1 & & & & & &
>>> *+[o][F-]\txt{G} \ar@{-}[dl]_1 \ar@{-}[dr]^1 & & *+[o][F-]\txt{V}
>>> \ar@{-}[dl]_1 \ar@{-}[dr]^1 & & \\ & *+[F]\txt{L1}
>>> \ar@{-}[dl]_\frac{1}{2} \ar@{-}[dr]^\frac{1}{2} & & & &
>>> *+[F]\txt{L2} \ar@{-}[dl]_\frac{1}{4} \ar@{-}[dr]^\frac{3}{4} & & &
>>> *+[F]\txt{L2} \ar@{-}[dl]_\frac{1}{4}
>>> \ar@{-}[dr]^\frac{3}{4} & & & & *+[F]\txt{L1} \ar@{-}[dl]_\frac
>>> {1}{2}
>>> \ar@{-}[dr]^\frac{1}{2} & \\
>>> *+[o][F-]\txt{G} & & *+[o][F-]\txt{V} & & *+[o][F-]\txt{G} &
>>> *+[o][F-]\txt{V} & & *+[o][F-]\txt{G} & & *+[o][F-]\txt{V}
>>> & & *+[o][F-]\txt{G} & & *+[o][F-]\txt{V}
>>> }
>>
>> Put braces around all the \frac constructions, and it all
>> compiles just fine --- though the resulting tree diagram makes
>> no sense to me, presumably because it is incomplete at this stage.
>>
>>
>> Hope this helps,
>>
>> Ross Moore
>>
>>
>>>
>>> The error messages I get from the console:
>>> Argument of \frac has an extra }. } (followed by: )
>>> Paragraph ended before \frac was complete. } (followed by: )
>>>
>>> The lines indicated are the ones of the last bracket closing
>>> '\xymatrix{}'.
>>>
>>>
>>>
>>> I tried omitting the fractions, then it compiles (some formatting
>>> corrections are needed though, I'll sort that later.).
>>>
>>>
>>>
>>> Does anybody see an obvious error in my code?
>>>
>>> Thanks and kind regards
>>> Lars
>>> _______________________________________________
>>> xy-pic mailing list
>>> http://tug.org/mailman/listinfo/xy-pic
>>
>> ---------------------------------------------------------------------
>> ---
>> Ross Moore
>> ross at maths.mq.edu.au
>> Mathematics Department office: E7A-419
>> Macquarie University tel: +61 +2
>> 9850 8955
>> Sydney, Australia 2109 fax: +61 +2
>> 9850 8114
>> ---------------------------------------------------------------------
>> ---
>>
>>
>>
> _______________________________________________
> xy-pic mailing list
> http://tug.org/mailman/listinfo/xy-pic
------------------------------------------------------------------------
Ross Moore ross at maths.mq.edu.au
Mathematics Department office: E7A-419
Macquarie University tel: +61 +2 9850 8955
Sydney, Australia 2109 fax: +61 +2 9850 8114
------------------------------------------------------------------------
More information about the xy-pic
mailing list