How can I set the boldmath font with unicode-math?











up vote
5
down vote

favorite
1












I am trying to typeset a document in Linux Libertine, and I want to use the font for alphanumeric characters in math mode as well. I am using unicode-math, not mathspec, because I need to specify alphabets like mathup explicitly for compatibility with packages like hepnames. I did not find a way to do that with mathspec. The engine I use is XeLaTeX. I initially specify TeX Gyre Pagella Math as a complete math font for symbols etc. I want the subsequent declarations to overwrite the font for text characters as Libertine.



I find several problems, illustrated by the MWE below:




  1. The boldmath switch doesn't do anything.

  2. Numbers are not rendered correctly in bold and italic, only letters.


  3. mathbf (the last "A = 1" in the MWE) is rendered in Pagella, not in Libertine at all.


I already tried adding /{latin,Latin,num} to the range declarations, without success. What am I missing here?



documentclass{minimal}

usepackage{fontspec}
usepackage{unicode-math}

setmainfont[%
Ligatures=TeX,
BoldFont=LinLibertine_RB.otf,
ItalicFont=LinLibertine_RI.otf,
BoldItalicFont=LinLibertine_RBI.otf]
{LinLibertine_R.otf}

setmathfont{texgyrepagella-math.otf}

setmathfont[range=mathup]{LinLibertine_R.otf}
setmathfont[range=mathbf]{LinLibertine_RB.otf}
setmathfont[range=mathit]{LinLibertine_RI.otf}
setmathfont[range=mathbfit]{LinLibertine_RBI.otf}

begin{document}
begin{tabular}{lll}
Text & A = 1 & textit{B = 2}\
Textbf & textbf{A = 1} & textbf{textit{B = 2}}\
Math & $A = 1$ & $mathit{B = 2}$\
Boldmath & {boldmath $A = 1$} & {boldmath $mathit{B = 2}$}\
Mathbf & $mathbf{A = 1}$ & $mathbfit{B = 2}$\
end{tabular}
end{document}


enter image description here



Without font changes, everything looks OK:



documentclass{minimal}

begin{document}
begin{tabular}{lll}
Text & A = 1 & textit{B = 2}\
Textbf & textbf{A = 1} & textbf{textit{B = 2}}\
Math & $A = 1$ & $mathit{B = 2}$\
Boldmath & {boldmath $A = 1$} & {boldmath $mathit{B = 2}$}\
end{tabular}
end{document}


enter image description here










share|improve this question


















  • 1




    by default unicode-math sets up boldmath not to switch fonts but rather to switch characters into the bold math alphabet range starting at U+1d400 in the current math font, so the appearance depends on the glyphs in that range.
    – David Carlisle
    Apr 30 '15 at 11:06






  • 2




    boldmath is shorthand for mathversion{bold} unicode-math allows a version=bold key in its font setting option to specify fonts to use in that case.
    – David Carlisle
    Apr 30 '15 at 11:08










  • I already looked ad version=bold. If I add lines like setmathfont[range=mathup,version=bold]{LinLibertine_RB.otf} or setmathfont[range=mathit,version=bold]{LinLibertine_RBI.otf}, all characters in math mode become bold/italic. I guess I'm doing it wrong.
    – tg85
    Apr 30 '15 at 11:26















up vote
5
down vote

favorite
1












I am trying to typeset a document in Linux Libertine, and I want to use the font for alphanumeric characters in math mode as well. I am using unicode-math, not mathspec, because I need to specify alphabets like mathup explicitly for compatibility with packages like hepnames. I did not find a way to do that with mathspec. The engine I use is XeLaTeX. I initially specify TeX Gyre Pagella Math as a complete math font for symbols etc. I want the subsequent declarations to overwrite the font for text characters as Libertine.



I find several problems, illustrated by the MWE below:




  1. The boldmath switch doesn't do anything.

  2. Numbers are not rendered correctly in bold and italic, only letters.


  3. mathbf (the last "A = 1" in the MWE) is rendered in Pagella, not in Libertine at all.


I already tried adding /{latin,Latin,num} to the range declarations, without success. What am I missing here?



documentclass{minimal}

usepackage{fontspec}
usepackage{unicode-math}

setmainfont[%
Ligatures=TeX,
BoldFont=LinLibertine_RB.otf,
ItalicFont=LinLibertine_RI.otf,
BoldItalicFont=LinLibertine_RBI.otf]
{LinLibertine_R.otf}

setmathfont{texgyrepagella-math.otf}

setmathfont[range=mathup]{LinLibertine_R.otf}
setmathfont[range=mathbf]{LinLibertine_RB.otf}
setmathfont[range=mathit]{LinLibertine_RI.otf}
setmathfont[range=mathbfit]{LinLibertine_RBI.otf}

begin{document}
begin{tabular}{lll}
Text & A = 1 & textit{B = 2}\
Textbf & textbf{A = 1} & textbf{textit{B = 2}}\
Math & $A = 1$ & $mathit{B = 2}$\
Boldmath & {boldmath $A = 1$} & {boldmath $mathit{B = 2}$}\
Mathbf & $mathbf{A = 1}$ & $mathbfit{B = 2}$\
end{tabular}
end{document}


enter image description here



Without font changes, everything looks OK:



documentclass{minimal}

begin{document}
begin{tabular}{lll}
Text & A = 1 & textit{B = 2}\
Textbf & textbf{A = 1} & textbf{textit{B = 2}}\
Math & $A = 1$ & $mathit{B = 2}$\
Boldmath & {boldmath $A = 1$} & {boldmath $mathit{B = 2}$}\
end{tabular}
end{document}


enter image description here










share|improve this question


















  • 1




    by default unicode-math sets up boldmath not to switch fonts but rather to switch characters into the bold math alphabet range starting at U+1d400 in the current math font, so the appearance depends on the glyphs in that range.
    – David Carlisle
    Apr 30 '15 at 11:06






  • 2




    boldmath is shorthand for mathversion{bold} unicode-math allows a version=bold key in its font setting option to specify fonts to use in that case.
    – David Carlisle
    Apr 30 '15 at 11:08










  • I already looked ad version=bold. If I add lines like setmathfont[range=mathup,version=bold]{LinLibertine_RB.otf} or setmathfont[range=mathit,version=bold]{LinLibertine_RBI.otf}, all characters in math mode become bold/italic. I guess I'm doing it wrong.
    – tg85
    Apr 30 '15 at 11:26













up vote
5
down vote

favorite
1









up vote
5
down vote

favorite
1






1





I am trying to typeset a document in Linux Libertine, and I want to use the font for alphanumeric characters in math mode as well. I am using unicode-math, not mathspec, because I need to specify alphabets like mathup explicitly for compatibility with packages like hepnames. I did not find a way to do that with mathspec. The engine I use is XeLaTeX. I initially specify TeX Gyre Pagella Math as a complete math font for symbols etc. I want the subsequent declarations to overwrite the font for text characters as Libertine.



I find several problems, illustrated by the MWE below:




  1. The boldmath switch doesn't do anything.

  2. Numbers are not rendered correctly in bold and italic, only letters.


  3. mathbf (the last "A = 1" in the MWE) is rendered in Pagella, not in Libertine at all.


I already tried adding /{latin,Latin,num} to the range declarations, without success. What am I missing here?



documentclass{minimal}

usepackage{fontspec}
usepackage{unicode-math}

setmainfont[%
Ligatures=TeX,
BoldFont=LinLibertine_RB.otf,
ItalicFont=LinLibertine_RI.otf,
BoldItalicFont=LinLibertine_RBI.otf]
{LinLibertine_R.otf}

setmathfont{texgyrepagella-math.otf}

setmathfont[range=mathup]{LinLibertine_R.otf}
setmathfont[range=mathbf]{LinLibertine_RB.otf}
setmathfont[range=mathit]{LinLibertine_RI.otf}
setmathfont[range=mathbfit]{LinLibertine_RBI.otf}

begin{document}
begin{tabular}{lll}
Text & A = 1 & textit{B = 2}\
Textbf & textbf{A = 1} & textbf{textit{B = 2}}\
Math & $A = 1$ & $mathit{B = 2}$\
Boldmath & {boldmath $A = 1$} & {boldmath $mathit{B = 2}$}\
Mathbf & $mathbf{A = 1}$ & $mathbfit{B = 2}$\
end{tabular}
end{document}


enter image description here



Without font changes, everything looks OK:



documentclass{minimal}

begin{document}
begin{tabular}{lll}
Text & A = 1 & textit{B = 2}\
Textbf & textbf{A = 1} & textbf{textit{B = 2}}\
Math & $A = 1$ & $mathit{B = 2}$\
Boldmath & {boldmath $A = 1$} & {boldmath $mathit{B = 2}$}\
end{tabular}
end{document}


enter image description here










share|improve this question













I am trying to typeset a document in Linux Libertine, and I want to use the font for alphanumeric characters in math mode as well. I am using unicode-math, not mathspec, because I need to specify alphabets like mathup explicitly for compatibility with packages like hepnames. I did not find a way to do that with mathspec. The engine I use is XeLaTeX. I initially specify TeX Gyre Pagella Math as a complete math font for symbols etc. I want the subsequent declarations to overwrite the font for text characters as Libertine.



I find several problems, illustrated by the MWE below:




  1. The boldmath switch doesn't do anything.

  2. Numbers are not rendered correctly in bold and italic, only letters.


  3. mathbf (the last "A = 1" in the MWE) is rendered in Pagella, not in Libertine at all.


I already tried adding /{latin,Latin,num} to the range declarations, without success. What am I missing here?



documentclass{minimal}

usepackage{fontspec}
usepackage{unicode-math}

setmainfont[%
Ligatures=TeX,
BoldFont=LinLibertine_RB.otf,
ItalicFont=LinLibertine_RI.otf,
BoldItalicFont=LinLibertine_RBI.otf]
{LinLibertine_R.otf}

setmathfont{texgyrepagella-math.otf}

setmathfont[range=mathup]{LinLibertine_R.otf}
setmathfont[range=mathbf]{LinLibertine_RB.otf}
setmathfont[range=mathit]{LinLibertine_RI.otf}
setmathfont[range=mathbfit]{LinLibertine_RBI.otf}

begin{document}
begin{tabular}{lll}
Text & A = 1 & textit{B = 2}\
Textbf & textbf{A = 1} & textbf{textit{B = 2}}\
Math & $A = 1$ & $mathit{B = 2}$\
Boldmath & {boldmath $A = 1$} & {boldmath $mathit{B = 2}$}\
Mathbf & $mathbf{A = 1}$ & $mathbfit{B = 2}$\
end{tabular}
end{document}


enter image description here



Without font changes, everything looks OK:



documentclass{minimal}

begin{document}
begin{tabular}{lll}
Text & A = 1 & textit{B = 2}\
Textbf & textbf{A = 1} & textbf{textit{B = 2}}\
Math & $A = 1$ & $mathit{B = 2}$\
Boldmath & {boldmath $A = 1$} & {boldmath $mathit{B = 2}$}\
end{tabular}
end{document}


enter image description here







math-mode fonts xetex fontspec unicode-math






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 30 '15 at 11:03









tg85

566




566








  • 1




    by default unicode-math sets up boldmath not to switch fonts but rather to switch characters into the bold math alphabet range starting at U+1d400 in the current math font, so the appearance depends on the glyphs in that range.
    – David Carlisle
    Apr 30 '15 at 11:06






  • 2




    boldmath is shorthand for mathversion{bold} unicode-math allows a version=bold key in its font setting option to specify fonts to use in that case.
    – David Carlisle
    Apr 30 '15 at 11:08










  • I already looked ad version=bold. If I add lines like setmathfont[range=mathup,version=bold]{LinLibertine_RB.otf} or setmathfont[range=mathit,version=bold]{LinLibertine_RBI.otf}, all characters in math mode become bold/italic. I guess I'm doing it wrong.
    – tg85
    Apr 30 '15 at 11:26














  • 1




    by default unicode-math sets up boldmath not to switch fonts but rather to switch characters into the bold math alphabet range starting at U+1d400 in the current math font, so the appearance depends on the glyphs in that range.
    – David Carlisle
    Apr 30 '15 at 11:06






  • 2




    boldmath is shorthand for mathversion{bold} unicode-math allows a version=bold key in its font setting option to specify fonts to use in that case.
    – David Carlisle
    Apr 30 '15 at 11:08










  • I already looked ad version=bold. If I add lines like setmathfont[range=mathup,version=bold]{LinLibertine_RB.otf} or setmathfont[range=mathit,version=bold]{LinLibertine_RBI.otf}, all characters in math mode become bold/italic. I guess I'm doing it wrong.
    – tg85
    Apr 30 '15 at 11:26








1




1




by default unicode-math sets up boldmath not to switch fonts but rather to switch characters into the bold math alphabet range starting at U+1d400 in the current math font, so the appearance depends on the glyphs in that range.
– David Carlisle
Apr 30 '15 at 11:06




by default unicode-math sets up boldmath not to switch fonts but rather to switch characters into the bold math alphabet range starting at U+1d400 in the current math font, so the appearance depends on the glyphs in that range.
– David Carlisle
Apr 30 '15 at 11:06




2




2




boldmath is shorthand for mathversion{bold} unicode-math allows a version=bold key in its font setting option to specify fonts to use in that case.
– David Carlisle
Apr 30 '15 at 11:08




boldmath is shorthand for mathversion{bold} unicode-math allows a version=bold key in its font setting option to specify fonts to use in that case.
– David Carlisle
Apr 30 '15 at 11:08












I already looked ad version=bold. If I add lines like setmathfont[range=mathup,version=bold]{LinLibertine_RB.otf} or setmathfont[range=mathit,version=bold]{LinLibertine_RBI.otf}, all characters in math mode become bold/italic. I guess I'm doing it wrong.
– tg85
Apr 30 '15 at 11:26




I already looked ad version=bold. If I add lines like setmathfont[range=mathup,version=bold]{LinLibertine_RB.otf} or setmathfont[range=mathit,version=bold]{LinLibertine_RBI.otf}, all characters in math mode become bold/italic. I guess I'm doing it wrong.
– tg85
Apr 30 '15 at 11:26










3 Answers
3






active

oldest

votes

















up vote
1
down vote



accepted










I found a solution that works for me. I started playing around with version=bold, as David suggested, but that kept turning all my math mode text bold. In the end I switched from file names to system font names. (I wanted to avoid that initially, since I am working on the same document from several different machines.) With system font names, boldmath worked immediately and automatically. I also found that mathbfup must be specified instead of mathbf.



Another problem with using system font names is that, for some reason, the semi-bold Libertine style is loaded per default as bold. That is the reason for the BoldFont specification in the MWE below.



The solution is not perfect. You can see that all numbers in math mode are rendered upright, even in mathit. Also, the number in mathbfit is not bold. All fonts are correct though, and it's good enough for my purposes.



documentclass{minimal}

usepackage{fontspec}
usepackage{unicode-math}

setmainfont[
BoldFont=Linux Libertine Bold,
BoldItalicFont=Linux Libertine Bold Italic]
{Linux Libertine}

setmathfont{TeX Gyre Pagella Math}

setmathfont[range=mathup,
BoldFont=Linux Libertine Bold,
BoldItalicFont=Linux Libertine Bold Italic]
{Linux Libertine}
setmathfont[range=mathit,
BoldFont=Linux Libertine Bold Italic]
{Linux Libertine Italic}
setmathfont[range=mathbfup]{Linux Libertine Bold}
setmathfont[range=mathbfit]{Linux Libertine Bold Italic}

begin{document}
begin{tabular}{lll}
~ & Regular & Italic\
Text & A = 1 & textit{A = 1}\
Textbf & textbf{A = 1} & textbf{textit{A = 1}}\
Math & $A = 1$ & $mathit{A = 1}$\
Boldmath & {boldmath $A = 1$} & {boldmath $mathit{A = 1}$}\
Mathbf & $mathbf{A = 1}$ & $mathbfit{A = 1}$\
end{tabular}
end{document}


enter image description here






share|improve this answer






























    up vote
    0
    down vote













    With xelatex or lualatex



    documentclass{standalone}
    usepackage{hepparticles}
    usepackage{hepnames}
    usepackage[math-style=ISO]{unicode-math}
    usepackage{libertinus}
    usepackage{array}
    begin{document}

    tabcolsep=10pt
    begin{tabular}{>{ttfamilytextbackslash}lll}
    normalfont & Regular &itshape Italic\
    textnormal & A = 1 & textit{A = 1}\
    textbf & textbf{A = 1} & textbf{textit{A = 1}}\
    mathup & $mathup{A} = 1$ & $A = 1$\
    symbf & $symbfup{A = 1}$ & $symbfit{A = 1}$\
    mathbf & $mathbf{A = 1}$ & $mathbfit{A = 1}$\
    end{tabular}

    end{document}


    enter image description here






    share|improve this answer




























      up vote
      -1
      down vote













      Using the package amsbsy and pmb seems to get the boldmath.



      documentclass{minimal}

      usepackage{fontspec}
      usepackage{unicode-math}
      usepackage{amsbsy}

      setmainfont[%
      Ligatures=TeX,
      BoldFont=LinLibertine_RB.otf,
      ItalicFont=LinLibertine_RI.otf,
      BoldItalicFont=LinLibertine_RBI.otf]
      {LinLibertine_R.otf}

      setmathfont{texgyrepagella-math.otf}

      setmathfont[range=mathup]{LinLibertine_R.otf}
      setmathfont[range=mathbf]{LinLibertine_RB.otf}
      setmathfont[range=mathit]{LinLibertine_RI.otf}
      setmathfont[range=mathbfit]{LinLibertine_RBI.otf}

      begin{document}
      begin{tabular}{lll}
      Text & A = 1 & textit{B = 2}\
      Textbf & textbf{A = 1} & textbf{textit{B = 2}}\
      Math & $A = 1$ & $mathit{B = 2}$\
      Boldmath & { $pmb{A = 1}$} & {$pmb{mathit{B = 2}}$}\
      Mathbf & $mathbf{A = 1}$ & $mathbfit{B = 2}$\
      end{tabular}
      end{document}


      enter image description here






      share|improve this answer



















      • 1




        This seems to produce a different (third?) font. imgur.com/Bw48aZc
        – tg85
        Apr 30 '15 at 11:20










      • I do not see any different font!
        – Ambika Vanchinathan
        Apr 30 '15 at 11:24










      • pmb just prints three copies of the glyph slightly offset, it is not a true bold font.
        – Andrew Swann
        Apr 30 '15 at 12:14






      • 3




        don't use pmb unless you are desperate (and then consider not using it:-)
        – David Carlisle
        Apr 30 '15 at 12:20











      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "85"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














       

      draft saved


      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f241382%2fhow-can-i-set-the-boldmath-font-with-unicode-math%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      1
      down vote



      accepted










      I found a solution that works for me. I started playing around with version=bold, as David suggested, but that kept turning all my math mode text bold. In the end I switched from file names to system font names. (I wanted to avoid that initially, since I am working on the same document from several different machines.) With system font names, boldmath worked immediately and automatically. I also found that mathbfup must be specified instead of mathbf.



      Another problem with using system font names is that, for some reason, the semi-bold Libertine style is loaded per default as bold. That is the reason for the BoldFont specification in the MWE below.



      The solution is not perfect. You can see that all numbers in math mode are rendered upright, even in mathit. Also, the number in mathbfit is not bold. All fonts are correct though, and it's good enough for my purposes.



      documentclass{minimal}

      usepackage{fontspec}
      usepackage{unicode-math}

      setmainfont[
      BoldFont=Linux Libertine Bold,
      BoldItalicFont=Linux Libertine Bold Italic]
      {Linux Libertine}

      setmathfont{TeX Gyre Pagella Math}

      setmathfont[range=mathup,
      BoldFont=Linux Libertine Bold,
      BoldItalicFont=Linux Libertine Bold Italic]
      {Linux Libertine}
      setmathfont[range=mathit,
      BoldFont=Linux Libertine Bold Italic]
      {Linux Libertine Italic}
      setmathfont[range=mathbfup]{Linux Libertine Bold}
      setmathfont[range=mathbfit]{Linux Libertine Bold Italic}

      begin{document}
      begin{tabular}{lll}
      ~ & Regular & Italic\
      Text & A = 1 & textit{A = 1}\
      Textbf & textbf{A = 1} & textbf{textit{A = 1}}\
      Math & $A = 1$ & $mathit{A = 1}$\
      Boldmath & {boldmath $A = 1$} & {boldmath $mathit{A = 1}$}\
      Mathbf & $mathbf{A = 1}$ & $mathbfit{A = 1}$\
      end{tabular}
      end{document}


      enter image description here






      share|improve this answer



























        up vote
        1
        down vote



        accepted










        I found a solution that works for me. I started playing around with version=bold, as David suggested, but that kept turning all my math mode text bold. In the end I switched from file names to system font names. (I wanted to avoid that initially, since I am working on the same document from several different machines.) With system font names, boldmath worked immediately and automatically. I also found that mathbfup must be specified instead of mathbf.



        Another problem with using system font names is that, for some reason, the semi-bold Libertine style is loaded per default as bold. That is the reason for the BoldFont specification in the MWE below.



        The solution is not perfect. You can see that all numbers in math mode are rendered upright, even in mathit. Also, the number in mathbfit is not bold. All fonts are correct though, and it's good enough for my purposes.



        documentclass{minimal}

        usepackage{fontspec}
        usepackage{unicode-math}

        setmainfont[
        BoldFont=Linux Libertine Bold,
        BoldItalicFont=Linux Libertine Bold Italic]
        {Linux Libertine}

        setmathfont{TeX Gyre Pagella Math}

        setmathfont[range=mathup,
        BoldFont=Linux Libertine Bold,
        BoldItalicFont=Linux Libertine Bold Italic]
        {Linux Libertine}
        setmathfont[range=mathit,
        BoldFont=Linux Libertine Bold Italic]
        {Linux Libertine Italic}
        setmathfont[range=mathbfup]{Linux Libertine Bold}
        setmathfont[range=mathbfit]{Linux Libertine Bold Italic}

        begin{document}
        begin{tabular}{lll}
        ~ & Regular & Italic\
        Text & A = 1 & textit{A = 1}\
        Textbf & textbf{A = 1} & textbf{textit{A = 1}}\
        Math & $A = 1$ & $mathit{A = 1}$\
        Boldmath & {boldmath $A = 1$} & {boldmath $mathit{A = 1}$}\
        Mathbf & $mathbf{A = 1}$ & $mathbfit{A = 1}$\
        end{tabular}
        end{document}


        enter image description here






        share|improve this answer

























          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          I found a solution that works for me. I started playing around with version=bold, as David suggested, but that kept turning all my math mode text bold. In the end I switched from file names to system font names. (I wanted to avoid that initially, since I am working on the same document from several different machines.) With system font names, boldmath worked immediately and automatically. I also found that mathbfup must be specified instead of mathbf.



          Another problem with using system font names is that, for some reason, the semi-bold Libertine style is loaded per default as bold. That is the reason for the BoldFont specification in the MWE below.



          The solution is not perfect. You can see that all numbers in math mode are rendered upright, even in mathit. Also, the number in mathbfit is not bold. All fonts are correct though, and it's good enough for my purposes.



          documentclass{minimal}

          usepackage{fontspec}
          usepackage{unicode-math}

          setmainfont[
          BoldFont=Linux Libertine Bold,
          BoldItalicFont=Linux Libertine Bold Italic]
          {Linux Libertine}

          setmathfont{TeX Gyre Pagella Math}

          setmathfont[range=mathup,
          BoldFont=Linux Libertine Bold,
          BoldItalicFont=Linux Libertine Bold Italic]
          {Linux Libertine}
          setmathfont[range=mathit,
          BoldFont=Linux Libertine Bold Italic]
          {Linux Libertine Italic}
          setmathfont[range=mathbfup]{Linux Libertine Bold}
          setmathfont[range=mathbfit]{Linux Libertine Bold Italic}

          begin{document}
          begin{tabular}{lll}
          ~ & Regular & Italic\
          Text & A = 1 & textit{A = 1}\
          Textbf & textbf{A = 1} & textbf{textit{A = 1}}\
          Math & $A = 1$ & $mathit{A = 1}$\
          Boldmath & {boldmath $A = 1$} & {boldmath $mathit{A = 1}$}\
          Mathbf & $mathbf{A = 1}$ & $mathbfit{A = 1}$\
          end{tabular}
          end{document}


          enter image description here






          share|improve this answer














          I found a solution that works for me. I started playing around with version=bold, as David suggested, but that kept turning all my math mode text bold. In the end I switched from file names to system font names. (I wanted to avoid that initially, since I am working on the same document from several different machines.) With system font names, boldmath worked immediately and automatically. I also found that mathbfup must be specified instead of mathbf.



          Another problem with using system font names is that, for some reason, the semi-bold Libertine style is loaded per default as bold. That is the reason for the BoldFont specification in the MWE below.



          The solution is not perfect. You can see that all numbers in math mode are rendered upright, even in mathit. Also, the number in mathbfit is not bold. All fonts are correct though, and it's good enough for my purposes.



          documentclass{minimal}

          usepackage{fontspec}
          usepackage{unicode-math}

          setmainfont[
          BoldFont=Linux Libertine Bold,
          BoldItalicFont=Linux Libertine Bold Italic]
          {Linux Libertine}

          setmathfont{TeX Gyre Pagella Math}

          setmathfont[range=mathup,
          BoldFont=Linux Libertine Bold,
          BoldItalicFont=Linux Libertine Bold Italic]
          {Linux Libertine}
          setmathfont[range=mathit,
          BoldFont=Linux Libertine Bold Italic]
          {Linux Libertine Italic}
          setmathfont[range=mathbfup]{Linux Libertine Bold}
          setmathfont[range=mathbfit]{Linux Libertine Bold Italic}

          begin{document}
          begin{tabular}{lll}
          ~ & Regular & Italic\
          Text & A = 1 & textit{A = 1}\
          Textbf & textbf{A = 1} & textbf{textit{A = 1}}\
          Math & $A = 1$ & $mathit{A = 1}$\
          Boldmath & {boldmath $A = 1$} & {boldmath $mathit{A = 1}$}\
          Mathbf & $mathbf{A = 1}$ & $mathbfit{A = 1}$\
          end{tabular}
          end{document}


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 2 '15 at 21:43

























          answered Apr 30 '15 at 14:51









          tg85

          566




          566






















              up vote
              0
              down vote













              With xelatex or lualatex



              documentclass{standalone}
              usepackage{hepparticles}
              usepackage{hepnames}
              usepackage[math-style=ISO]{unicode-math}
              usepackage{libertinus}
              usepackage{array}
              begin{document}

              tabcolsep=10pt
              begin{tabular}{>{ttfamilytextbackslash}lll}
              normalfont & Regular &itshape Italic\
              textnormal & A = 1 & textit{A = 1}\
              textbf & textbf{A = 1} & textbf{textit{A = 1}}\
              mathup & $mathup{A} = 1$ & $A = 1$\
              symbf & $symbfup{A = 1}$ & $symbfit{A = 1}$\
              mathbf & $mathbf{A = 1}$ & $mathbfit{A = 1}$\
              end{tabular}

              end{document}


              enter image description here






              share|improve this answer

























                up vote
                0
                down vote













                With xelatex or lualatex



                documentclass{standalone}
                usepackage{hepparticles}
                usepackage{hepnames}
                usepackage[math-style=ISO]{unicode-math}
                usepackage{libertinus}
                usepackage{array}
                begin{document}

                tabcolsep=10pt
                begin{tabular}{>{ttfamilytextbackslash}lll}
                normalfont & Regular &itshape Italic\
                textnormal & A = 1 & textit{A = 1}\
                textbf & textbf{A = 1} & textbf{textit{A = 1}}\
                mathup & $mathup{A} = 1$ & $A = 1$\
                symbf & $symbfup{A = 1}$ & $symbfit{A = 1}$\
                mathbf & $mathbf{A = 1}$ & $mathbfit{A = 1}$\
                end{tabular}

                end{document}


                enter image description here






                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  With xelatex or lualatex



                  documentclass{standalone}
                  usepackage{hepparticles}
                  usepackage{hepnames}
                  usepackage[math-style=ISO]{unicode-math}
                  usepackage{libertinus}
                  usepackage{array}
                  begin{document}

                  tabcolsep=10pt
                  begin{tabular}{>{ttfamilytextbackslash}lll}
                  normalfont & Regular &itshape Italic\
                  textnormal & A = 1 & textit{A = 1}\
                  textbf & textbf{A = 1} & textbf{textit{A = 1}}\
                  mathup & $mathup{A} = 1$ & $A = 1$\
                  symbf & $symbfup{A = 1}$ & $symbfit{A = 1}$\
                  mathbf & $mathbf{A = 1}$ & $mathbfit{A = 1}$\
                  end{tabular}

                  end{document}


                  enter image description here






                  share|improve this answer












                  With xelatex or lualatex



                  documentclass{standalone}
                  usepackage{hepparticles}
                  usepackage{hepnames}
                  usepackage[math-style=ISO]{unicode-math}
                  usepackage{libertinus}
                  usepackage{array}
                  begin{document}

                  tabcolsep=10pt
                  begin{tabular}{>{ttfamilytextbackslash}lll}
                  normalfont & Regular &itshape Italic\
                  textnormal & A = 1 & textit{A = 1}\
                  textbf & textbf{A = 1} & textbf{textit{A = 1}}\
                  mathup & $mathup{A} = 1$ & $A = 1$\
                  symbf & $symbfup{A = 1}$ & $symbfit{A = 1}$\
                  mathbf & $mathbf{A = 1}$ & $mathbfit{A = 1}$\
                  end{tabular}

                  end{document}


                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 13 hours ago









                  Herbert

                  265k23403712




                  265k23403712






















                      up vote
                      -1
                      down vote













                      Using the package amsbsy and pmb seems to get the boldmath.



                      documentclass{minimal}

                      usepackage{fontspec}
                      usepackage{unicode-math}
                      usepackage{amsbsy}

                      setmainfont[%
                      Ligatures=TeX,
                      BoldFont=LinLibertine_RB.otf,
                      ItalicFont=LinLibertine_RI.otf,
                      BoldItalicFont=LinLibertine_RBI.otf]
                      {LinLibertine_R.otf}

                      setmathfont{texgyrepagella-math.otf}

                      setmathfont[range=mathup]{LinLibertine_R.otf}
                      setmathfont[range=mathbf]{LinLibertine_RB.otf}
                      setmathfont[range=mathit]{LinLibertine_RI.otf}
                      setmathfont[range=mathbfit]{LinLibertine_RBI.otf}

                      begin{document}
                      begin{tabular}{lll}
                      Text & A = 1 & textit{B = 2}\
                      Textbf & textbf{A = 1} & textbf{textit{B = 2}}\
                      Math & $A = 1$ & $mathit{B = 2}$\
                      Boldmath & { $pmb{A = 1}$} & {$pmb{mathit{B = 2}}$}\
                      Mathbf & $mathbf{A = 1}$ & $mathbfit{B = 2}$\
                      end{tabular}
                      end{document}


                      enter image description here






                      share|improve this answer



















                      • 1




                        This seems to produce a different (third?) font. imgur.com/Bw48aZc
                        – tg85
                        Apr 30 '15 at 11:20










                      • I do not see any different font!
                        – Ambika Vanchinathan
                        Apr 30 '15 at 11:24










                      • pmb just prints three copies of the glyph slightly offset, it is not a true bold font.
                        – Andrew Swann
                        Apr 30 '15 at 12:14






                      • 3




                        don't use pmb unless you are desperate (and then consider not using it:-)
                        – David Carlisle
                        Apr 30 '15 at 12:20















                      up vote
                      -1
                      down vote













                      Using the package amsbsy and pmb seems to get the boldmath.



                      documentclass{minimal}

                      usepackage{fontspec}
                      usepackage{unicode-math}
                      usepackage{amsbsy}

                      setmainfont[%
                      Ligatures=TeX,
                      BoldFont=LinLibertine_RB.otf,
                      ItalicFont=LinLibertine_RI.otf,
                      BoldItalicFont=LinLibertine_RBI.otf]
                      {LinLibertine_R.otf}

                      setmathfont{texgyrepagella-math.otf}

                      setmathfont[range=mathup]{LinLibertine_R.otf}
                      setmathfont[range=mathbf]{LinLibertine_RB.otf}
                      setmathfont[range=mathit]{LinLibertine_RI.otf}
                      setmathfont[range=mathbfit]{LinLibertine_RBI.otf}

                      begin{document}
                      begin{tabular}{lll}
                      Text & A = 1 & textit{B = 2}\
                      Textbf & textbf{A = 1} & textbf{textit{B = 2}}\
                      Math & $A = 1$ & $mathit{B = 2}$\
                      Boldmath & { $pmb{A = 1}$} & {$pmb{mathit{B = 2}}$}\
                      Mathbf & $mathbf{A = 1}$ & $mathbfit{B = 2}$\
                      end{tabular}
                      end{document}


                      enter image description here






                      share|improve this answer



















                      • 1




                        This seems to produce a different (third?) font. imgur.com/Bw48aZc
                        – tg85
                        Apr 30 '15 at 11:20










                      • I do not see any different font!
                        – Ambika Vanchinathan
                        Apr 30 '15 at 11:24










                      • pmb just prints three copies of the glyph slightly offset, it is not a true bold font.
                        – Andrew Swann
                        Apr 30 '15 at 12:14






                      • 3




                        don't use pmb unless you are desperate (and then consider not using it:-)
                        – David Carlisle
                        Apr 30 '15 at 12:20













                      up vote
                      -1
                      down vote










                      up vote
                      -1
                      down vote









                      Using the package amsbsy and pmb seems to get the boldmath.



                      documentclass{minimal}

                      usepackage{fontspec}
                      usepackage{unicode-math}
                      usepackage{amsbsy}

                      setmainfont[%
                      Ligatures=TeX,
                      BoldFont=LinLibertine_RB.otf,
                      ItalicFont=LinLibertine_RI.otf,
                      BoldItalicFont=LinLibertine_RBI.otf]
                      {LinLibertine_R.otf}

                      setmathfont{texgyrepagella-math.otf}

                      setmathfont[range=mathup]{LinLibertine_R.otf}
                      setmathfont[range=mathbf]{LinLibertine_RB.otf}
                      setmathfont[range=mathit]{LinLibertine_RI.otf}
                      setmathfont[range=mathbfit]{LinLibertine_RBI.otf}

                      begin{document}
                      begin{tabular}{lll}
                      Text & A = 1 & textit{B = 2}\
                      Textbf & textbf{A = 1} & textbf{textit{B = 2}}\
                      Math & $A = 1$ & $mathit{B = 2}$\
                      Boldmath & { $pmb{A = 1}$} & {$pmb{mathit{B = 2}}$}\
                      Mathbf & $mathbf{A = 1}$ & $mathbfit{B = 2}$\
                      end{tabular}
                      end{document}


                      enter image description here






                      share|improve this answer














                      Using the package amsbsy and pmb seems to get the boldmath.



                      documentclass{minimal}

                      usepackage{fontspec}
                      usepackage{unicode-math}
                      usepackage{amsbsy}

                      setmainfont[%
                      Ligatures=TeX,
                      BoldFont=LinLibertine_RB.otf,
                      ItalicFont=LinLibertine_RI.otf,
                      BoldItalicFont=LinLibertine_RBI.otf]
                      {LinLibertine_R.otf}

                      setmathfont{texgyrepagella-math.otf}

                      setmathfont[range=mathup]{LinLibertine_R.otf}
                      setmathfont[range=mathbf]{LinLibertine_RB.otf}
                      setmathfont[range=mathit]{LinLibertine_RI.otf}
                      setmathfont[range=mathbfit]{LinLibertine_RBI.otf}

                      begin{document}
                      begin{tabular}{lll}
                      Text & A = 1 & textit{B = 2}\
                      Textbf & textbf{A = 1} & textbf{textit{B = 2}}\
                      Math & $A = 1$ & $mathit{B = 2}$\
                      Boldmath & { $pmb{A = 1}$} & {$pmb{mathit{B = 2}}$}\
                      Mathbf & $mathbf{A = 1}$ & $mathbfit{B = 2}$\
                      end{tabular}
                      end{document}


                      enter image description here







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Apr 30 '15 at 11:23









                      Andrew Swann

                      76k9126321




                      76k9126321










                      answered Apr 30 '15 at 11:11









                      Ambika Vanchinathan

                      2,39359




                      2,39359








                      • 1




                        This seems to produce a different (third?) font. imgur.com/Bw48aZc
                        – tg85
                        Apr 30 '15 at 11:20










                      • I do not see any different font!
                        – Ambika Vanchinathan
                        Apr 30 '15 at 11:24










                      • pmb just prints three copies of the glyph slightly offset, it is not a true bold font.
                        – Andrew Swann
                        Apr 30 '15 at 12:14






                      • 3




                        don't use pmb unless you are desperate (and then consider not using it:-)
                        – David Carlisle
                        Apr 30 '15 at 12:20














                      • 1




                        This seems to produce a different (third?) font. imgur.com/Bw48aZc
                        – tg85
                        Apr 30 '15 at 11:20










                      • I do not see any different font!
                        – Ambika Vanchinathan
                        Apr 30 '15 at 11:24










                      • pmb just prints three copies of the glyph slightly offset, it is not a true bold font.
                        – Andrew Swann
                        Apr 30 '15 at 12:14






                      • 3




                        don't use pmb unless you are desperate (and then consider not using it:-)
                        – David Carlisle
                        Apr 30 '15 at 12:20








                      1




                      1




                      This seems to produce a different (third?) font. imgur.com/Bw48aZc
                      – tg85
                      Apr 30 '15 at 11:20




                      This seems to produce a different (third?) font. imgur.com/Bw48aZc
                      – tg85
                      Apr 30 '15 at 11:20












                      I do not see any different font!
                      – Ambika Vanchinathan
                      Apr 30 '15 at 11:24




                      I do not see any different font!
                      – Ambika Vanchinathan
                      Apr 30 '15 at 11:24












                      pmb just prints three copies of the glyph slightly offset, it is not a true bold font.
                      – Andrew Swann
                      Apr 30 '15 at 12:14




                      pmb just prints three copies of the glyph slightly offset, it is not a true bold font.
                      – Andrew Swann
                      Apr 30 '15 at 12:14




                      3




                      3




                      don't use pmb unless you are desperate (and then consider not using it:-)
                      – David Carlisle
                      Apr 30 '15 at 12:20




                      don't use pmb unless you are desperate (and then consider not using it:-)
                      – David Carlisle
                      Apr 30 '15 at 12:20


















                       

                      draft saved


                      draft discarded



















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f241382%2fhow-can-i-set-the-boldmath-font-with-unicode-math%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      サソリ

                      広島県道265号伴広島線

                      Accessing regular linux commands in Huawei's Dopra Linux