# [OS X TeX] Missing $inserted in a "variations" environment Iraj Kalantari I-Kalantari at wiu.edu Sun Mar 15 19:18:21 CET 2009 I am sorry -- Jonathon also explains my remark too! In my haste, I did not read his comprehensive analysis. Iraj. On Mar 15, 2009, at 1:10 PM, Iraj Kalantari wrote: > Setting aside Jonathan's wonderful analysis, if in the minimal > example provided > one replaces the first '\mI' with '$\mI$' > in the line: > \m{f(x)} & \bg \mI & \c \h{\pI} & \bb& \mI & \c & \h{-1} & \d \mI & > \bb > the problem goes away. > > Iraj. > > > > > On Mar 15, 2009, at 12:39 PM, Jonathan Kew wrote: > >> On 15 Mar 2009, at 14:09, <ewan.Delanoy at math.unicaen.fr> <ewan.Delanoy at math.unicaen.fr >> > wrote: >> >>> Hello all, >>> >>> >>> I've just encountered the following problem with TeXShop : >> >> You're having a problem with LaTeX, not with TeXShop. It would be >> useful to learn something about the distinction. >> >>> >>> 1) Compilation stops with the error message "Missing$ inserted".
>>> 2) If I insist and press "Enter" twice in the console, it eventually
>>> compiles completely
>>> and produces a fine output.
>>
>> Not quite. Look at the first minus-infinity at the bottom; it'll
>> have a hyphen instead of a minus sign.
>>
>>>
>>> 3) By trial and error, I see that what causes this behaviour is a
>>> "variations" array
>>> (from the variations package) in the middle of my text.
>>> 3) The line number displayed in the error message, l.259, is not
>>> very
>>> illuminating
>>> because the source text is as follows
>>
>> This is presumably because none of the content of the {variations}
>> environment actually gets processed until the end reached.
>>
>>>
>>> \noindent \makebox[\textwidth][c]{
>>> \begin{variations}
>>> x  & \mI  &   & \alpha& & & 1 & & \beta&  & & 2 & & \pI & \\
>>> \filet
>>> f'(x) & \bg & + & \bb&  & + & \z & -& \bb & & - &\z& + & &\bd \\
>>> \filet
>>> \m{f(x)} & \bg \mI &  \c \h{\pI} & \bb& \mI & \c & \h{-1} & \d \mI
>>> & \bb
>>> & \h{\pI}& \d &\frac{3}{2}& \c
>>> & \h{\pI} & \bd \\
>>> \end{variations}
>>> }<- Line 259 is here
>>>
>>> Can anyone help me on this ?
>>
>> One way to locate the problem more precisely, if you don't notice
>> the incorrect minus sign at first, is to type "i XXXX" in response
>> to the error message instead of just hitting Enter. You'll see the
>> things are going wrong.
>>
>> It seems that {variations} is automatically putting each "cell" of
>> the table it creates into math mode, probably using an \halign
>> template. But the \bg command, besides creating an extra rule on
>> the left, also cancels the alignment template for the current entry
>> (\show\bg indicates that its expansion  begins with \omit). So
>> where you have "....& \bg \mI &...." the automatic math mode does
>> not apply, and hence you get an error when you try to use the
>> infinity symbol.
>>
>> You can remove the error by adding $...$ around \mI in this case,
>> but (a) it seems ugly to have to do this, when other cells are
>> automatically in math mode; and (b) this results in extra space
>> between the symbol and the following arrow. So it's not really very
>> satisfactory.
>>
>> It looks like what you should really do is split off the border
>> you're creating with \bg into a separate column of the table, as
>> the {variations} environment doesn't know how to combine this
>> nicely with math-mode content. Thus:
>>
>> 	\noindent \makebox[\textwidth][c]{
>> 	\begin{variations}
>> 	x & & \mI & & \alpha& & & 1 & & \beta& & & 2 & & \pI & \\
>> 	\filet
>> 	f'(x) & \bg & & + & \bb& & + & \z & -& \bb & & - &\z& + & &\bd \\
>> 	\filet
>> 	\m{f(x)} & \bg & \mI & \c \h{\pI} & \bb& \mI & \c & \h{-1} & \d
>> \mI & \bb
>> 	& \h{\pI}& \d &\frac{3}{2}& \c
>> 	& \h{\pI} & \bd \\
>> 	\end{variations}
>> 	}
>>
>> HTH,  JK
>>
>> ----------- Please Consult the Following Before Posting -----------
>> TeX FAQ: http://www.tex.ac.uk/faq
>> List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
>> List Archive: http://tug.org/pipermail/macostex-archives/
>> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
>> List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex
>>
>
> ----------- Please Consult the Following Before Posting -----------
> TeX FAQ: http://www.tex.ac.uk/faq
> List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
> List Archive: http://tug.org/pipermail/macostex-archives/
> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
> List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex
>