bugGNU Octave - Bugs: bug #52287, degree sign (\circ) not as...

 
 

bug #52287: degree sign (\circ) not as superscript

Submitter:  Muhali <muhali>
Submitted:  Thu 26 Oct 2017 11:47:29 AM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.2.1 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 31 Oct 2017 10:14:14 PM UTC, comment #14: 

See Mike Miller's comment #3.  It appears that U+00BA is a typo.

Rik <rik5>
Group administrator
Tue 31 Oct 2017 09:32:43 PM UTC, comment #13: 

The following was posted to the mailing list:

R> There is a list, from Matlab, of what each Tex symbol should create.  See
R> http://www.mathworks.com/help/matlab/ref/text.html#inputarg_Interpreter.

That page claims that matlab maps \circ to U+00BA MASCULINE ORDINAL INDICATOR.

Which of course may just mean that whoever wrote it doesn't know how to type ?.

-JimC

John W. Eaton <jwe>
Group administrator
Sun 29 Oct 2017 01:08:24 AM UTC, comment #12: 

I made the change to the documentation (http://hg.savannah.gnu.org/hgweb/octave/rev/5e3d45f108d9).  I also grafted the change back on to the stable branch, although I'm not sure there will be a 4.2.2 release.

Rik <rik5>
Group administrator
Sun 29 Oct 2017 12:08:00 AM UTC, comment #11: 

Rik: Seems to do the job, and close the report.

Michael Godfrey <godfrey>
Group Member
Sat 28 Oct 2017 07:19:38 PM UTC, comment #10: 

I've made a small patch for the documentation that explains the difference between \circ and \deg.  Is this a good enough way out of this bug report?

(file #42285)

Rik <rik5>
Group administrator
Fri 27 Oct 2017 11:28:06 AM UTC, comment #9: 

Ok, so I understand now and this looks like a sensible choice from Octave's part.

>> So we could mention the syntax 'x^\circ' as a Matlab compatible and TeX compatible way of rendering something that looks like a degree sign.


I would add that the only way to obtain a consistent degree symbol on screen and on printout is to use "\\deg": since the Symbol font only has the degree symbol, we have mapped "\\circ" to the same glyph as "\\deg" and consequently in printout the "^\\circ" will appear as if it was "^\\deg", that is much too hight above the baseline. See


ht = text (.5, .6, '\rightarrow^{\circ}C', 'horizontalalignment', 'left');
ht = text (.5, .6, '^{\circ}C', 'horizontalalignment', 'right', 'interpreter', 'none');
ht = text (.5, .3, '\rightarrow{\deg}C', 'horizontalalignment', 'left');
ht = text (.5, .3, '{\deg}C', 'horizontalalignment', 'right', 'interpreter', 'none');
print toto.eps
open toto.eps


Note also that it also means that we currently have no way to reprent the actual non superscripted "\\circ" in printout.

Pantxo Diribarne <pantxo>
Group Member
Thu 26 Oct 2017 08:26:23 PM UTC, comment #8: 

This might  be useful:


https://en.wikibooks.org/wiki/LaTeX/Special_Characters


Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Thu 26 Oct 2017 08:21:59 PM UTC, comment #7: 

It's not clear to me that it is different. I think it might be worth asking someone for clarity, with a very large font. But I've seen some posts suggesting that the proper way to get something that looks like a degree sign in Matlab is with the superscript operator, which agrees with the TeX site.

So we could mention the syntax 'x^\circ' as a Matlab compatible and TeX compatible way of rendering something that looks like a degree sign.

Mike Miller <mtmiller>
Group Member
Thu 26 Oct 2017 08:06:01 PM UTC, comment #6: 

This is all starting to come back to me, slowly.  I think we decided to implement \circ according to TeX, and then have \deg to access the degree symbol.

There is table 15.1 in the manual that documents what output one should expect for each TeX input.

Beyond that, do we want to have a special mention in the documentation about the different interpretation of \circ?  Maybe we should put an asterisk and a footnote.

Rik <rik5>
Group administrator
Thu 26 Oct 2017 07:04:09 PM UTC, comment #5: 

Rik is right as far as I know having done this work a
long time ago. I used TeX definitions. It seems to me
that this is simplest and best. Matlab makes some other choices.

Michael Godfrey <godfrey>
Group Member
Thu 26 Oct 2017 06:45:15 PM UTC, comment #4: 

I see some answers on Matlab Central recommending using "^\circ" or "^{\circ}" for a proper degree symbol.

Mike Miller <mtmiller>
Group Member
Thu 26 Oct 2017 06:41:56 PM UTC, comment #3: 

Weirdly, it looks to me like the Matlab table of TeX characters is showing º (U+00BA MASCULINE ORDINAL INDICATOR) for \circ. But I guess they intended that to be ° (U+00B0 DEGREE SIGN)?

By the way, on https://www.johndcook.com/blog/math_symbols/ it's easy to miss but it looks like he is saying that "^\circ" is mapped to °, notice the superscript carat for that one case.

Running "\circ" through plain tex, I get a non-superscripted ∘ (U+2218 RING OPERATOR).

Mike Miller <mtmiller>
Group Member
Thu 26 Oct 2017 03:49:04 PM UTC, comment #2: 

There is a list, from Matlab, of what each Tex symbol should create.  See http://www.mathworks.com/help/matlab/ref/text.html#inputarg_Interpreter.  If you can tell that \circ is mapping to unicode 0x2218 from this table then we maybe could make the change for compatibility.

I think there was discussion a long time back about wanting to stay true to TeX, and I believe that TeX maps circ to 0x00BO.  This is certainly what this website says: https://www.johndcook.com/blog/math_symbols/

Also, see comment #3 at https://savannah.gnu.org/bugs/?func=detailitem&item_id=33155.

There is an argument for why '\circ' should produce the circle, rather than degree, symbol.


Rik <rik5>
Group administrator
Thu 26 Oct 2017 12:22:55 PM UTC, comment #1: 

In octave we have the additional '\deg' tex symbol (not matlab compatible) that is mapped to the superscript "°" symbol (unicode 0x00B0). For some reason the '\circ' has been mapped to unicode 0x2218 which is a non superscript version.

The attached patch maps both '\deg' and '\circ' to the same unicode character. Those tex symbols are already mapped to the same character in Windows symbol codes system and in Symbol font.

The workaround to display degree onscreen is to use thus '\deg'.



(file #42268)

Pantxo Diribarne <pantxo>
Group Member
Thu 26 Oct 2017 11:47:29 AM UTC, original submission:  

The command

text(0.5, 0.5, '{\circ}')

does not seem to create a superscript in the plot window (see attached foo.png). It does so in the corresponding print.

Muhali <muhali>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #42285:  degree.cset added by rik5 (1KiB - application/octet-stream)
file #42268:  circ.patch added by pantxo (867B - text/x-patch)
file #42267:  foo.png added by muhali (18KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by pantxo (Updated the item)
  • -email is unavailable- added by muhali (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-10-29 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2017-10-28 rik5 Attached File- Added degree.cset, #42285
        StatusConfirmed Patch Submitted
    2017-10-26 pantxo Attached File- Added circ.patch, #42268
        StatusNone Confirmed
    2017-10-26 muhali Attached File- Added foo.png, #42267

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code