Greek letters, subscripts, and superscripts in the editor
18 views (last 30 days)
Show older comments
Why in the world is matlab's editor not capable of dealing with greek letters, subscripts and superscripts? I cannot possibly be the only one who would rather see the greek letter for pi instead of the word. Really, though, it would just be nice if my equations in the editor could more closely resemble the real thing..
c'mon... physics, engineering, math... everyone uses greek letters and subscripts/superscripts! Why can't matlab's editor?
1 Comment
David Sherwood
on 27 Aug 2020
I agree. I would like to use Greek letters/symbols in comments, '% ...'. They can be pasted in fine and printed out fine but the editor does not save them! When you go back to your script after closing/saving it, the Greek letter/symbols appear as '?'. Is there a way around this other than "publishing" or LaTEX?
Answers (1)
Sean de Wolski
on 9 Sep 2011
Sure you can, you just have to use LaTeX. See the example in:
doc
Matlab>User Guide>Desktop Tools>Publishing M-Files>Formatting Mfile Comments:
- Including Inline LaTeX Math Symbols in M-Files for Publishing
- Including Blocks of LaTeX Math Symbols in M-Files for Publishing
7 Comments
Walter Roberson
on 12 Sep 2011
Sure, some programs (I mentioned Maple already) allow "2D notation" in entering equations. It is often a PITA to actually use or understand.
For example, in that input mode, Maple does translate underscore in to subscripts. Which is a nuisance if you have underscores in your variable names that do _not_ indicate subscripts. And when you see x with the subscript 1, does that indicate index 1 in to the vector x, or does it indicate the variable whose name is x subscript 1 ?
Or try something simple like x^2+1 . The ^ triggers superscript mode, so your cursor rises above the x, you type in the 2, you type in the +1 ... and you notice that you now have what is logically equivalent to x^(2+1) because the 2D math entry mode doesn't know that you finished entering the superscript. So after the 2, you have to press some key combination to indicate the end of superscript mode, and then the program tries to guess about where you want to be next ... usually getting it wrong, so a lot of the time you end up having to click to get where you want. And then you probably have to click again a few times because it highlighted an entire term instead of understanding that you are trying to position after the term...
So then you want to enter 1/2/3 (i.e., ((1/2)/3) . But the program helpfully went in to divisor mode when you typed the first / and so you end up with the equivalent of (1/(2/3))... and so on.
And Pi? You better pull it out of a character-table menu, since there are at least 6 different _kinds_ of Pi that are used as mathematical symbols with different meanings.
With regards to your claim that "And geometry certainly does use greek characters." -- did you read down to the "Semantic Distinctions" paragraph of section 2.2 of the technical report I referenced? As far as mathematics papers are concerned, a sans-serif bold italic "alpha" is *not* the same symbol as a Greek alpha.
The international standards encode characters. Characters are entities that retain their identity no matter how they are drawn. For example, an italic "k" in the Helvetica font is the same _character_ as a bold "k" is the Century New Schoolbook font, even though they look different. Mathematics and physics, though, impart meaning to the different looks of the symbols. When the meaning of a symbol depends on the way it looks, then one is not referring to characters: one is referring to glyphs. See http://en.wikipedia.org/wiki/Glyph for an example of 9 different glyphs associated with the lowercase character "a". Mathematics and physics (including geometry) prescribe different meanings to the different glyphs.
"No defensible reason" -- you would be surprised how much work it is to get the representations you propose to work properly. The effort is measured in person-decades. As you do not know or care about the details of ASCII, it seems fairly likely that you have not completed any of the "double-bend" exercises in Knuth's manuals on TeX and thus do not know how complicated some of the practical aspects get.
See Also
Categories
Find more on Labels and Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!