2

Update

Now some volunteer contacts me and the project begins. Thanks go to all the readers.



Sometimes we need to call for upright Greek lowercase letters compatible with the computer modern italic ones in shapes. Here is a solution for which XeLaTeX couldn't be used. And as follows @David Carlisle also gives a solution involving the unicode-math package which may be clashed with some other packages, for example, the mathspec package. So it's necessary to create a single and smart package to invoke computer modern upright greek lowercase letters as mathematical symbols.

Now I've created the regular and bold OTF font files for them, then who can write a package maybe called cmupgreek (there is already a upgreek package for upright Greek letters from the Euler or Adobe Symbol fonts)?

The following is the screen shots for shapes of them.

enter image description here

enter image description here

The commands for them are as follows, and we could get the bold ones if we use \mathbf{}, \boldmath and so on.

Command Unicode
\upalpha 03B1
\upbeta 03B2
\upgamma 03B3
\updelta 03B4
\upepsilon 03B5
\upzeta 03B6
\upeta 03B7
\uptheta 03B8
\upiota 03B9
\upkappa 03BA
\uplambda 03BB
\upmu 03BC
\upnu 03BD
\upxi 03BE
\upomicron 03BF
\uppi 03C0
\uprho 03C1
\upsigma 03C3
\uptao 03C4
\upupsilon 03C5
\upphi 03C6
\upchi 03C7
\uppsi 03C8
\upomega 03C9
\upvartheta 03D1
\upvarphi 03D5
\upvarpi 03D6
\upvarsigma 03D8
\upvarkappa 03F0
\upvarrho 03F1
\upvarepsilon 03F5
M. Logic
  • 4,214
  • Maybe a stupid question, but what does this provide that is not in latin modern math and/or computer modern book, for example? Are the glyphs different? How? – mickep Jul 07 '22 at 16:35
  • @mickep These up Greek lowercase letters are not in LaTeX, but sometimes we need them. – M. Logic Jul 07 '22 at 16:41
  • Why not using, for example, the options given in the answers to this question? – Vincent Jul 07 '22 at 16:42
  • @Vincent 1. XeLaTeX could not be used; 2. the slant angles are different that it's not convenient to do that while I have adjusted them in the font files uniformly. – M. Logic Jul 07 '22 at 16:45
  • And \mupalpha and so on (using unicode-math) is not what you want? I assume you use luatex/xetex. – mickep Jul 07 '22 at 16:48
  • @mickep But we may need up and italic ones at the same time while if we use unicode-math to get the up ones in this way, we couldn't get the italic ones. – M. Logic Jul 07 '22 at 16:54
  • I do not understand. Try \alpha\mupalpha\mbfalpha for example. – mickep Jul 07 '22 at 17:08
  • @mickep I tried: 1. using the french or upright style in unicode-math (\usepackage[math-style=french]{unicode-math} or \usepackage[math-style=upright]{unicode-math}), they are all up ones; 2. using only unicode-math (\usepackage{unicode-math}), they are all italic ones. And sometimes we may invoke packages clashed with unicode-math, for example, the mathspec package. So we need a simple package compatible with the other packages. – M. Logic Jul 07 '22 at 17:34
  • But then you have \mitalpha, don't you? – mickep Jul 07 '22 at 19:00
  • with any unicode math font lowercase greek is available in upright, bold upright, italic, bold italic, bold sans serif (not normal weight sans serif), slanted bold sans serif, in the same font, are you sure you need additional fonts? see https://www.w3.org/2003/entities/2007doc/Overview.html#alphabets – David Carlisle Jul 07 '22 at 20:57
  • The current package clashing situation is a bit complicated, but I don't think your proposal is a good idea either. The glyphs are already available in Latin Modern Math font files, duplicating to something-else would make the situation more complicated. – user202729 Jul 08 '22 at 08:33
  • What engine do you intend to support? // Side note, this question appears to be similar to xetex - Is there a way to use unicode-math in a limited fashion? - TeX - LaTeX Stack Exchange – user202729 Jul 08 '22 at 08:37
  • @user202729 It may be more convenient in many cases, by creating a single and smart package which is compatible with many other packages. – M. Logic Jul 08 '22 at 08:51
  • Needless to say it's impossible for any package to be compatible with every other packages (new packages can be created), which "other packages" are you thinking about? mathspec? – user202729 Jul 08 '22 at 08:52
  • @user202729 Your are right, and this shows that it's necessary to create a new package for some particular uses. – M. Logic Jul 08 '22 at 08:53
  • I think mathspec can already load otf font? So simply load the necessary characters from Latin modern font and use them? (although I don't know yet how to actually do that) – user202729 Jul 08 '22 at 08:54
  • @user202729 You are right. But it doesn't give commands to invoke upright Greek lowercase letters. – M. Logic Jul 08 '22 at 09:04
  • Good point. Although any solution that answers the "unicode-math in limited fashion" question above would also answer this one. Maybe unicode-math-table can be used on this point (it has list of command → character mapping). – user202729 Jul 08 '22 at 09:26

1 Answers1

4

enter image description here

Any Unicode Math font includes Greek in upright, italic, bold upright, bold italic, bold sans serif and slanted bold sans serif. unicode-math makes these available using \sym... commands, or you can simply type the characters directly: αβγ (which also works in other contexts such as web pages).

\documentclass{article}

\usepackage{unicode-math}

\begin{document}

$ \symup{\alpha}\symup{\beta}\symup{\gamma} \symbfup{\alpha}\symbfup{\beta}\symbfup{\gamma} \symit{\alpha}\symit{\beta}\symit{\gamma} \symbfit{\alpha}\symbfit{\beta}\symbfit{\gamma} \symbfsf{\alpha}\symbfsf{\beta}\symbfsf{\gamma} \symbfsfit{\alpha}\symbfsfit{\beta}\symbfsfit{\gamma} $

$αβγ$

\end{document}

this shows the Latin Modern font, so in the style of Computer Modern, but the same input works with any font. Adding \setmathfont{Stix Two Math} produces

enter image description here


As requested, an example not using unicode-math and showing how you can use any font with Unicode Mathematical Greek with no special package support needed. (I loaded the fonts by font name, you may need to use the file name if you have not configured fontconfig).

The example loads (but does not use) mathspec so you need xelatex here (otherwise the example would also work in lualatex)

enter image description here

\documentclass{article}

\usepackage{mathspec}% not needed here but just to show it is compatible \usepackage{fontspec}

% Any Font with Mathmatical Greek in Unicode positions will work here % I am using some standard ones but you could use your new font

\newfontfamily\lmfont{Latin Modern Math}[NFSSFamily=lmmath] \DeclareMathAlphabet\mathlm{TU}{lmmath}{m}{n}

\newfontfamily\ncmfont{NewComputerModernMath}[NFSSFamily=ncmmath] \DeclareMathAlphabet\mathncm{TU}{ncmmath}{m}{n}

\newfontfamily\stxfont{STIX Two Math}[NFSSFamily=stix2math] \DeclareMathAlphabet\mathstix{TU}{stix2math}{m}{n}

\begin{document}

LM

$\mathlm{αβγ}$

NCM

$\mathncm{αβγ}$

Stix2

$\mathstix{αβγ}$

\end{document}

David Carlisle
  • 757,742
  • But sometimes some package is clashed with the unicode-math package, for example, the mathespec package. So it's necessary to create a single and smart package to invoke computer modern up greek lowercase letters as mathematical symbols, f. – M. Logic Jul 08 '22 at 02:40
  • @M.Logic No sorry you are mistaken. Latin Modern Math and NewComputerModernMath are both fonts in Computer modern style, with upper/lowercase Greek in upright,italic, bold upright and bold italic, you don't need any package at all (or even math mode) Just load the font with fontspec (or a primitive \font command and use the standard Unicode characters for Mathematical Greek: αβγ . As shown in this comment, you don't need to change fonts for the different styles. If you are using a package incompatible with loading a font, I am not sure what answer to give – David Carlisle Jul 08 '22 at 07:59
  • But sometimes we indeed invoke packages such as mathspec which may be clashed with unicode-math. Anyway, thanks very much. – M. Logic Jul 08 '22 at 08:47
  • Looking around a bit there's mathspec - How to use .otf font file as math font in XeLaTeX? - TeX - LaTeX Stack Exchange but (annoyingly) there's no real solution there. – user202729 Jul 08 '22 at 08:49
  • as I say you don't need to use unicode-math you could load the font with mathspec, or fontspec, I'll add an example... @M.Logic – David Carlisle Jul 08 '22 at 08:54
  • But I've already invoked some other otf fonts on my PC by mathspec. What now I need are some upright greek lowercase letters as mathematical symbols, and the smart package to be created serves it. – M. Logic Jul 08 '22 at 08:55
  • @M.Logic I added an example using mathspec You do not need a package. – David Carlisle Jul 08 '22 at 09:21
  • 1
    @user202729 example added – David Carlisle Jul 08 '22 at 09:23
  • @M.Logic no you are using xelatex so unlike classic tex (16 alphabets of 256 characters) You have 256 alphabets of thousands of characters. You will not run out of math alphabets. You can of course take the two lines of code shown above, changd to set for your font, and save it as a package .sty file but that is all you need. – David Carlisle Jul 08 '22 at 09:35
  • It's indeed a solution. While unfortunately many people don't install latin modern on their pcs, including me (I compiled the example and found it) ^-^... Anyway, thanks very much. – M. Logic Jul 08 '22 at 09:37
  • You are right that there are many symbols, but I always select some particular ones to satisfy my personal taste. For example, in fact I don't like very much the computer modern lowercase italic geek letters (none existed is my taste since there always some ugly one to me in the fonts) which matches not very well with the old style fonts used now by me, and so I may design a new font for italic greek letters ... – M. Logic Jul 08 '22 at 09:46
  • @M.Logic certainly you can set up your own fonts, but the question asks about a package to load a font with Greek and the answer is that the package just needs the two lines shown, adapted to use whatever font name you need. – David Carlisle Jul 08 '22 at 09:46
  • Unfortunately, latin modern is not installed on my mac since it says "./newexample.tex:10: Package fontspec Error: The font "Latin Modern Math" cannot be found." – M. Logic Jul 08 '22 at 09:47
  • @M.Logic I don't understand that last comment. Let's say your font is named abc.otf , you can use the code above replacing "Latin Modern Math" with "abc" and it will work (probably). Alternatively if you're okay with Latin Modern Math just somehow fix your TeX installation (Latin Modern Math should be installed by default). What's the problem? – user202729 Jul 08 '22 at 12:41
  • @user202729 I don't know why it produces such problems since the MacTex installed on my Macbook is the newest and complete. – M. Logic Jul 08 '22 at 12:52
  • @M.Logic Probably https://tex.stackexchange.com/questions/285850/how-do-i-install-latin-modern-math-with-basictex, but if you want to use your own otf file then no need to do that. Either way it's getting unrelated to this answer – user202729 Jul 08 '22 at 13:59