9

I'd like to produce a "⋆" operator symbol with rather narrow points, resembling an asterisk, as seen in the Wikipedia page on cross-correlation:

f \star g

If I use the default math font (Latin Modern Math), the command \star produces exactly what I'm looking for (and seems to be what this Wikipedia page is using). But I'd much prefer to continue using the newtxmath package, which in this case produces something more resembling a regular pentagram, similar to the one seen in Wolfram Mathworld:

f \star g

Is there a way to have the \star command write a character in the default math font while using the newtxmath package elsewhere?

10

In the modern toolchain, with unicode-math, you can load a symbol from another math font with the range= option of \setmathfont:

\usepackage{unicode-math}
\defaultfontfeatures{ Scale=MatchLowercase, Ligatures=TeX }
\setmainfont{TeX Gyre Termes}[Scale=1.0]
\setmathfont{TeX Gyre Termes Math}
\setmathfont{Latin Modern Math}[range=\star]
| improve this answer | |
  • What is the \defaultfontfeatures line doing here? Can I use this with only the first and last lines? – Jackson Aug 7 at 2:09
  • @Jackson That automatically scales all fonts in the document to the same x-height. Scale=MatchUppercase would scale them to the same caps-height. – Davislor Aug 7 at 6:26
  • 1
    @Jackson You could remove the \defaultfontfeatures line and it would still work. You could also remove \setmainfont to use the default main font, Latin Modern Roman. You do need to set a math font before you can replace individual symbols with range=. So you need at least the first line and the last two. – Davislor Aug 7 at 6:30
  • @Davislor Look, I have not seen your answer :-(. – Sebastiano Aug 7 at 10:42
  • 1
    @VincentFourmond No, I meant the toolchain with unicode-math and LuaLaTeX (or XeLaTeX, although that is now in maintenance mode as well). It does not support PDFLaTeX. – Davislor Aug 7 at 16:17
10

You could borrow the \star from Latin Modern.

\documentclass[11pt]{article}
\usepackage{newtxtext}
\usepackage{newtxmath}
\DeclareSymbolFont{LMletters}{OML}{lmm}{m}{it}
\DeclareMathSymbol{\lmstar}{\mathbin}{LMletters}{63}
\begin{document}
\( f \star g \)

\( f \lmstar g \)
\end{document}

| improve this answer | |
  • This is exactly what I was looking for! Can you tell me a little about how the syntax works? Is the \DeclareSymbolFont line defining a command LMletters, and the number 63 choosing the star symbol? And if so, what is OML, and where can I find a list of symbols with their corresponding numbers? – Jackson Aug 7 at 0:32
8

Update 1: after the correct comment of @Vincent

After many attemps and looked the manual of MnSymbol I have taken all the fonts of type MnSymbolC

enter image description here

enter image description here

etc...and with \DeclareMathSymbol{\thinstar}{\mathbin}{MnSyC}{134} I have obtained only the \thinstar operator (code 134).

\documentclass[a4paper,12pt]{article}
\usepackage{newtxtext}
\usepackage{newtxmath}
\DeclareFontFamily{U} {MnSymbolC}{}

\DeclareFontShape{U}{MnSymbolC}{m}{n}{
<-6> MnSymbolC5
<6-7> MnSymbolC6
<7-8> MnSymbolC7
<8-9> MnSymbolC8
<9-10> MnSymbolC9
<10-12> MnSymbolC10
<12-> MnSymbolC12}{}
\DeclareFontShape{U}{MnSymbolC}{b}{n}{
<-6> MnSymbolC-Bold5
<6-7> MnSymbolC-Bold6
<7-8> MnSymbolC-Bold7
<8-9> MnSymbolC-Bold8
<9-10> MnSymbolC-Bold9
<10-12> MnSymbolC-Bold10
<12-> MnSymbolC-Bold12}{}
\DeclareSymbolFont{MnSyC}         {U}  {MnSymbolC}{m}{n}
\SetSymbolFont{MnSyC} {bold}{U} {MnSymbolC}{b}{n}
\DeclareMathSymbol{\thinstar}{\mathbin}{MnSyC}{134}


\begin{document}
$\sum_{i=1}^n g\thinstar f \cup R$
or other
\[\sum \sigma_s\prod a_i\]
\end{document}

It seem that the symbols are all of newtxmath

enter image description here

if we compare with \sum and \prod of MnSymbol (for example),

enter image description here


I add some proposals....

    \documentclass[11pt]{article}
    \usepackage{newtxtext}
    \usepackage{newtxmath}
    \usepackage{MnSymbol}
    \usepackage{wasysym}
    
    
    \begin{document}
    \( f \star g \), \verb|classic star|
    
    \( f \mathbin{\filledstar}  g \), \verb|MnSymbol package|
    
    $f \mathrel{\thinstar} g $, \verb|MnSymbol package|
    
    $f \mathbin{\APLstar} g $, \verb|Table 330: wasysym APL Symbols|
    \end{document}

enter image description here

| improve this answer | |
  • 2
    One should know that loading MnSymbol this way will change many symbols in the font. In fact, if I'm not mistaken, the \star symbol displayed in this example comes from MnSymbol and not from newtx or computer modern. – Vincent Aug 6 at 21:48
  • 1
    Is there a way to use the \thinstar symbol without also having the\star symbol be the one in MnSymbol? – Jackson Aug 7 at 0:34
  • @Vincent It is absolutely true..and I now, after many attemps, my answer. +1 for your comment. – Sebastiano Aug 7 at 10:37
  • @Jackson I have improved my answer....Now, I think, :-) you can use only \thinstar from MnSymbol if I have not make of the mistakes. – Sebastiano Aug 7 at 10:39
  • 1
    Brilliant! Thank you for this thorough answer – Jackson Aug 7 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.