TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any good and convincing reason to explain why LaTeX restricts usage of \DeclareSymbolFont and \DeclareMathSymbol to the preamble? and I could also ask the question for many other macros.

update: I add \DeclareMathVersion as a particularly relevant one.

I add the different case of \mathversion: it can only be used outside of math mode. This one would appear to everyone to be without any reason to discuss it. Or is it? as TeX looks at the math fonts when reaching the end of the math list, if one could use \mathversion (essentially \boldmath) midway this would change even previous things. So one could think, ok this is rationale enough to make it impossible to use it in math mode. But is it really? the user, rather than being authorized to see by himself the consequences of his choices (despite the suitable warnings in the manuals) just receive an error message which says than it is forbidden to do that.

I just don't see the point: in both cases an error arises. In the first case an error in the result; and after all the user will see it does not work the intended way. This will be motivation to get a good reference manual. In the second case, judgement is rendered immediately: it is just forbidden to do it! Which one is the best situation? I prefer the first.

share|improve this question
@egreg I like freedom. Why should I not want to do such a thing ? – jfbu Jan 14 '13 at 17:30
Sorry, but I don't follow you. Changing or introducing a new symbol mid document is just the wrong thing to do; where are you going to find the definition? How do you know what \foo does at a particular spot? – egreg Jan 14 '13 at 17:34
Not at all: you can define as many version you like in the preamble and use them when they seem fit. I can't think to any good reason for changing the effect of a math version in the middle of a document. – egreg Jan 14 '13 at 17:43
@egreg @DavidCarlisle imagine I want to write a book composed of chapters, using \include. Imagine each chapter uses specific math fonts. And imagine further that the chapters are contributed by different authors. As coordinator I will have to modify accordingly my preamble each time one of my dreamy collaborator changes her mind about the set-up? wouldn't it be better for the \DeclareMathVersion to be usable in each chapter? – jfbu Jan 14 '13 at 17:54
@egreg The whole point is that LaTeX seems to too often issue too precise guidelines... ;-) – jfbu Jan 14 '13 at 18:02
up vote 8 down vote accepted

At \begin{document} LaTeX has to do a lot of work setting up the font tables that have been declared. If you were allowed to change these later it would be considerably more complicated. Also LaTeX2e on a machine in 1993 only just fitted into TeX's available memory, by redefining all the font declaration machinery (and package loading machinery) to be \let to the same definition it freed up a lot of token memory that allowed you to have cross references and other definitions within the document.

share|improve this answer
The complexity of source2e with respect to the math set-up is such that I never got much beyond a very superficial reading. So I can only accept that these were the constraints of the time. Nevertheless, nfss is very flexible and nice to use for text font selection, and one does feel that math mode puts much more constraints on the user. Why in particular should \DeclareMathVersion be preamble-only? – jfbu Jan 14 '13 at 17:47
Every font size command has to be set up to load (or not) all the math fonts for all versions at that size, if you could switch mathversion mid document the thing would be vastly complicated, you could not free up the memory of the nfss tables and there would be absolutely no benefit as you can always declare the version in the preamble. – David Carlisle Jan 14 '13 at 17:51
thanks for the explanation which is useful. As I said, I find source2e a bit impenetrable there, hence my ignorance. Yes, in most cases the \DeclareMathVersion's will find their natural place in the preamble. Still, the current global math set up mechanism is so rigid that most LaTeX users do not even know about the concept of math versions. – jfbu Jan 14 '13 at 18:01
The only math version in common use is boldnath (\mathversion{bold}) the mathtime package had a heavy version as well, but there are very few math font families available in multiple versions, many not even bold. The math version can be used for things other than weight, but there are really insignificantly few circumstances where you need more versions. It really is not much different from text fonts you only have one global setting say [12pt] to set up the document font size. You can change font size locally of course but by default you can't change the entire document setup mid-document. – David Carlisle Jan 14 '13 at 20:20

Your Answer


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.