[OS X TeX] Improper alphabetic constant

Ross Moore ross.moore at mq.edu.au
Fri Dec 18 17:07:00 EST 2020


Hi Alain,

On 19 Dec 2020, at 6:34 am, Alain Schremmer <schremmer.alain at freemathtexts.org<mailto:schremmer.alain at freemathtexts.org>> wrote:

>>>> $\xrightarrow{5}$ and \boldsymbol{$5$} both compile but \boldsymbol{$\xrightarrow{5}$} does not.

I’m surprised that  \boldsymbol{$5$}  works at all.
It should be  $ \boldsymbol{5} $   *within* a math environment.
Or  \( \boldsymbol{5} \) .
Otherwise you may not be getting the correct math spacing around the symbol.

Note that $ … $  is *not* a font-switch indicator.
It means “ what is enclosed is a piece of mathematics”, and will be typeset using rules and conventions
appropriate for mathematical expressions;  i.e.,  even if enclosed letters look like they form words,
that is *not* the intention. Each letter is a *separate* mathematical symbol.



>>>>
>>>> The error is:
>>>>
>>>> 2.tex:1309: Improper alphabetic constant.
>>>> <to be read again>
>>>> \reserved at d
>>>> l.1309 \boldsymbol{$\xrightarrow{5}$}

Of course this fails, because you are trying to apply  \boldsymbol  to a whole
environment, rather than to a single symbol.

Is    \xrightarrow{5}  the *complete contents of the mathematical expression,
or only part of it ?

If it is the *entire* math-expression, then have you tried the following ?

      {\mathversion{bold}\( \xrightarrow{5} \)}

The surrounding  { … }   are to delimit the usage of bold mathematical symbols to just this piece.


If it is *part of a larger* math-expression, then try this:

  $ … \boldsymbol{\xrightarrow{\boldsymbol{5}}} … $

Of course you don’t want you document source to contain all those long macro names.
So instead you should probably be defining a home-grown macro:

  \newcommand{\boldto}[1]{\boldsymbol{\xrightarrow{\boldsymbol{#1}}}}

and just type;    $ … \boldto{5} … $



>>>>

>>>> Any way around it?
>>
>>> Howdy,
>>
>>> Are you sure \boldsymbol{$5$} compiles? I believe the \boldsymbol needs to be in math mode so $\boldsymbol{5}$ and $\boldsymbol{\xrightarrow{5}}$ work fine.
>>
>> Both $\boldsymbol{5}$ and \boldsymbol{$\rightarrow$} compile which is one more thing I don’t get---but which does not make me lose any sleep.

\boldsymbol is changing the math fonts for its argument.

>>
>> But $\boldsymbol{\xrightarrow{5}}$ definitely produces the error I mentioned. At least for me.

It didn’t for me.
What is the date of your LaTeX version?

Mine is as follows:

LaTeX2e <2018-12-01>
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/article.cls


>>
>> On the other hand, I just found out that $\pmb{\xrightarrow{5}}$ does work. So, I am ok.
>
> Howdy,
>
> <test.tex>
>
> <test.pdf>
>
> seems to work fine.

Sure do but not here. I tried to put my preamble on your example but I got other errors so I quit: \pmb will do here as, in fact, \boldsymbol does work for everything ELSE.

Do you understand what  \pmb  is really doing?

Try Copy/Paste of the result from \pmb  – Everything is tripled-up.

The same piece of mathematics is typeset 3 times, slightly shifted.
It’s like creating an artificial bold on a golfball typewriter, without having the proper golfball for bold symbols.
You overstrike the symbols with tiny offsets of the head. A very ugly hack!

It’s like buying a Gucci handbag from a street stall in an Asian city.
It may look like Gucci, using their attractive design; but the quality and workmanship is vastly inferior.



>>> As a side note you should get used to \(...\) instead of $...$ for inline math (and \[...\] instead of $$...$$ if you use that for display math).
>>
>> When I was writing some of my stuff on the web, I did but didn’t like it so stopped using them as soon as I stopped writing web pages.
>>
>> But, I am curious, are there other reasons?

The beginning and end delimiters are clearly specified, without the need to count how many $s have been used.

This allows you to more easily program selection of a whole math-expression,
to do any special processing required for your particular circumstances.
e.g., processing for web-pages, rather than for the printed page.

That is, it allows for better ways to capture the structure of your document.


If you think in terms of document structure, rather than just what you want to see on the page,
then you’ll find using LaTeX correctly becomes an awful lot easier.
Also use of well-named user-defined macros can make your document source a lot easier to read.


>>
>> Best
>> —s
>
> They are macros that default to $...$ and $$...$$ but packages like amsmath can change things like spacing.

Thanks but I am way too old to change my habits—unless forced to.

Speaking of habits:

Since my atheist parents always had Christmas presents under a Christmas tree, and even though this may not be a new year for everybody, I wish everybody

A Merry Christmas and a Happy New Year

because "C’est l’intention qui compte."

—schremmer

----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq<https://protect-au.mimecast.com/s/E7AeCyoj8Pu9grrNcPB2dE?domain=tex.ac.uk>
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/<https://protect-au.mimecast.com/s/sweJCzvkmpfJ3MMRiMi51S?domain=sites.esm.psu.edu>
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx<https://protect-au.mimecast.com/s/nI-xCANpnDC7gNN9sBfWqK?domain=dir.gmane.org>
https://email.esm.psu.edu/pipermail/macosx-tex/<https://protect-au.mimecast.com/s/Y-HUCBNqgBCE177VsQPoEf?domain=email.esm.psu.edu>
TeX on Mac OS X Website: http://mactex-wiki.tug.org/<https://protect-au.mimecast.com/s/Ffr8CD1vRkCg155BFvb1Vf?domain=mactex-wiki.tug.org>
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex<https://protect-au.mimecast.com/s/vjocCE8wlRCRm33WckCJ9c?domain=email.esm.psu.edu>


Dr Ross Moore
Department of Mathematics and Statistics
12 Wally’s Walk, Level 7, Room 734
Macquarie University, NSW 2109, Australia
T: +61 2 9850 8955  |  F: +61 2 9850 8114
M:+61 407 288 255  |  E: ross.moore at mq.edu.au<mailto:ross.moore at mq.edu.au>
http://www.maths.mq.edu.au
<http://mq.edu.au/>
[cid:49a8d64c-cd19-4e2e-b858-ed632f5c0265 at ausprd01.prod.outlook.com]

CRICOS Provider Number 00002J. Think before you print.
Please consider the environment before printing this email.

This message is intended for the addressee named and may
contain confidential information. If you are not the intended
recipient, please delete it and notify the sender. Views expressed
in this message are those of the individual sender, and are not
necessarily the views of Macquarie University. <http://mq.edu.au/>
<http://mq.edu.au/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://email.esm.psu.edu/pipermail/macosx-tex/attachments/20201218/735e1efc/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4605 bytes
Desc: image001.png
URL: <https://email.esm.psu.edu/pipermail/macosx-tex/attachments/20201218/735e1efc/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: texshop_image.pdf
Type: application/pdf
Size: 74761 bytes
Desc: texshop_image.pdf
URL: <https://email.esm.psu.edu/pipermail/macosx-tex/attachments/20201218/735e1efc/attachment.pdf>


More information about the MacOSX-TeX mailing list