[OS X TeX] Strange error

Ross Moore ross at ics.mq.edu.au
Mon Nov 12 16:46:42 EST 2007


Hi Alain,

On 13/11/2007, at 7:45 AM, Alain Schremmer wrote:

> or, at least, an error I don't understand.
>
> Yesterday, I started to get the following error:
>
> When I try to use align, say from the LaTeX panel, I get the  
> following console error:
>
> 	! Improper \halign inside $$'s.
> 	<recently read> \halign
>
> 	l.11 \end{align}
>
> 	?
>
> 1) I have reduced to the following minimal example:
>
> 		\documentclass[11pt]{book}
> 		\usepackage{lmodern}
> 		\usepackage{amsmath}
> 		\usepackage{fink}
> 		
> 		\begin{document}
> 			\begin{align}
> 	 		  1 &= 2  \\
> 			   3 &=  4
> 			\end{align}
> 		\end{document}


I cannot fully explain why the error occurs, but can say something
about what is going on, and offer an easy workaround.

It is  fink.sty  that triggers the difficulties.
This is because it redefines LaTeX's \input macro,
and the \IfFileExists macro.
(Just why it does this is not clear from looking at  fink.sty  alone.
However, it seems to be related to finding the exact suffix of each file
that LaTeX reads; perhaps to allow multiple '.' characters to be used
within a single filename.)

Now your sample file above triggers the error when mathematics fonts
are first needed for typesetting; requiring  .fd  files to be read,
for math-symbols, operator-name letters, extension symbols, etc.
Now the patched \input is called. This seems to work OK, insofar as
constructing file-names, and reading the .fd  files is concerned.
However it mustn't be cleaning up after itself properly, as it doesn't
fit cleanly within the delicate structure of TeX's \halign  primitive.
This is what triggers the message that you reported.
Exactly what it does wrong, I haven't traced yet.


The fix is easy.
Force the math-fonts to be loaded *before* loading the  fink.sty
package. You can do this as follows:

		\documentclass[11pt]{book}
		\usepackage{lmodern}
		\usepackage{amsmath}
		\setbox0=\hbox{$\relax$}
		\usepackage{fink}
		
		\begin{document}
			\begin{align}
	 		  1 &= 2  \\
			   3 &=  4
			\end{align}
		\end{document}

Now when the \begin{align} is encountered, the math fonts are already
loaded, so there is no need to call \input on .fd files at this point.
Hence all goes smoothly now.


>
> - If I comment out
> 	\usepackage{lmodern}
> or
> 	\usepackage{fink}
> LaTeX typesets the minimal file.

Probably the LaTeX style has preloaded the CM fonts.
It is only the switch to  lmodern  (or any other set of math-fonts)
that loads the bullet ...

... then \usepackage{fink}  cocks the trigger ...

... and the first math-environment encountered causes the discharge.


>
> - If not, a return carriage in the console lets LaTeX typeset 1=2  
> and 3=4 properly aligned. Here is the end of the console log:

Yes.
There is no actual error in the TeX processing of the input source.
Just some weird side-effect that upsets the use of  \halign .
(Perhaps it is just a stray space, or carriage-return occurring in an
unexpected place, but otherwise having no effect.)

>
> 	1{/usr/local/gwTeX/texmf.local/fonts/map/pdftex/updmap/pdftex.map}]
> 	(./Untitled.aux) ){/usr/local/gwTeX/texmf.texlive/fonts/enc/dvips/ 
> lm/lm-rm.enc}
> 	</usr/local/gwTeX/texmf.texlive/fonts/type1/public/lm/lmr10.pfb>
> 	Output written on Untitled.pdf (1 page, 17921 bytes).
> 	Transcript written on Untitled.log.
>
> 2) What makes it really strange is that:
> -- it just started even though, to my knowledge, my installation  
> and my preamble have not changed for several months (I am still on  
> 10.4.9)-- any and all the align that I used in the magnum opus  
> still typeset without the console squawking but any new one brings  
> up the abovementioned error message.

It isn't the fault of the specific \begin{align} .
It is the fact that this is the *first* piece of mathematics
that is handled within your document.
Put anything else, such as  $ $  before it, and the problem
will go away.


Of course there ought to be a better way to fix this.
Using \setbox in the preamble is a neat trick to force font-loading,
without actually putting anything into the document.


> -- if I copy-paste the above align in any of the chapters that used  
> to typeset without problem they immediately cease to work. If I  
> comment the pasted align out, the chapters work again.

You must have pasted it at the beginning, yes ?
Put it after any other piece of math and you should not get this  
problem.


> -- if I copy-paste an align that works, it doesn't work any more
> -- commenting out lmodern does not help in the magnum opus and I  
> can't afford not to use the fink package.

What purpose do you use  fink for ?


>
> I have no idea what's going on (I couldn't even find halign in the  
> companion 2ed and from
> 	http://www.cam.ac.uk/cs/docs/leaflets/u36/
>  I get the feeling that it is a tex command anyhow) and would very  
> much appreciate any explanation/help.


Hope this helps.

>
> Regards
> --schremmer

Cheers,

	Ross


------------------------------------------------------------------------
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 MacOSX-TeX mailing list