Tikz - Set all nodes in sans serif font












3















So far I had the understanding that providing font commands after a "parental" scope/more global definition was given, is additional, but I was wrong.



How can I get nodes which are only set in the sans serif font?



Picture of MWE



enter image description here



MWE



documentclass[
fontsize=11pt,
DIV=12,
paper=a4,
]{standalone}

usepackage{
tikz,
}
usepackage{amsmath}
usepackage{textcomp}
usepackage[oldstyle,proportional]{libertine}
usepackage{libertinust1math}
usepackage{zlmtt}
usepackage[scale=0.8558]{tgheros}

usepackage{microtype}

usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}

begin{document}
begin{tikzpicture}[
font=sffamily,
every node/.style={
font=sffamily,
},]
node at (0,0) {123 - in sans!};
node[font=bfseries] at (0,-1cm) {123 not sans :(} ;
end{tikzpicture}
end{document}









share|improve this question



























    3















    So far I had the understanding that providing font commands after a "parental" scope/more global definition was given, is additional, but I was wrong.



    How can I get nodes which are only set in the sans serif font?



    Picture of MWE



    enter image description here



    MWE



    documentclass[
    fontsize=11pt,
    DIV=12,
    paper=a4,
    ]{standalone}

    usepackage{
    tikz,
    }
    usepackage{amsmath}
    usepackage{textcomp}
    usepackage[oldstyle,proportional]{libertine}
    usepackage{libertinust1math}
    usepackage{zlmtt}
    usepackage[scale=0.8558]{tgheros}

    usepackage{microtype}

    usepackage[T1]{fontenc}
    usepackage[utf8]{inputenc}

    begin{document}
    begin{tikzpicture}[
    font=sffamily,
    every node/.style={
    font=sffamily,
    },]
    node at (0,0) {123 - in sans!};
    node[font=bfseries] at (0,-1cm) {123 not sans :(} ;
    end{tikzpicture}
    end{document}









    share|improve this question

























      3












      3








      3


      0






      So far I had the understanding that providing font commands after a "parental" scope/more global definition was given, is additional, but I was wrong.



      How can I get nodes which are only set in the sans serif font?



      Picture of MWE



      enter image description here



      MWE



      documentclass[
      fontsize=11pt,
      DIV=12,
      paper=a4,
      ]{standalone}

      usepackage{
      tikz,
      }
      usepackage{amsmath}
      usepackage{textcomp}
      usepackage[oldstyle,proportional]{libertine}
      usepackage{libertinust1math}
      usepackage{zlmtt}
      usepackage[scale=0.8558]{tgheros}

      usepackage{microtype}

      usepackage[T1]{fontenc}
      usepackage[utf8]{inputenc}

      begin{document}
      begin{tikzpicture}[
      font=sffamily,
      every node/.style={
      font=sffamily,
      },]
      node at (0,0) {123 - in sans!};
      node[font=bfseries] at (0,-1cm) {123 not sans :(} ;
      end{tikzpicture}
      end{document}









      share|improve this question














      So far I had the understanding that providing font commands after a "parental" scope/more global definition was given, is additional, but I was wrong.



      How can I get nodes which are only set in the sans serif font?



      Picture of MWE



      enter image description here



      MWE



      documentclass[
      fontsize=11pt,
      DIV=12,
      paper=a4,
      ]{standalone}

      usepackage{
      tikz,
      }
      usepackage{amsmath}
      usepackage{textcomp}
      usepackage[oldstyle,proportional]{libertine}
      usepackage{libertinust1math}
      usepackage{zlmtt}
      usepackage[scale=0.8558]{tgheros}

      usepackage{microtype}

      usepackage[T1]{fontenc}
      usepackage[utf8]{inputenc}

      begin{document}
      begin{tikzpicture}[
      font=sffamily,
      every node/.style={
      font=sffamily,
      },]
      node at (0,0) {123 - in sans!};
      node[font=bfseries] at (0,-1cm) {123 not sans :(} ;
      end{tikzpicture}
      end{document}






      tikz-pgf tikz-styles






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 2 at 12:18









      henryhenry

      2,85532369




      2,85532369






















          1 Answer
          1






          active

          oldest

          votes


















          5














          In your setting, font=bfseries overrides font=sffamily. However, if you use node font instead of font in order to apply either of them, it works. This is because TikZ will apply both font and node font.



          documentclass[
          fontsize=11pt,
          DIV=12,
          paper=a4,
          ]{standalone}

          usepackage{
          tikz,
          }
          usepackage{amsmath}
          usepackage{textcomp}
          usepackage[oldstyle,proportional]{libertine}
          usepackage{libertinust1math}
          usepackage{zlmtt}
          usepackage[scale=0.8558]{tgheros}

          usepackage{microtype}

          usepackage[T1]{fontenc}
          usepackage[utf8]{inputenc}

          begin{document}
          begin{tikzpicture}[font=sffamily]
          node at (0,0) {123 - in sans!};
          node[node font=bfseries] at (0,-1cm) {123 now sans ;-)} ;
          end{tikzpicture}
          end{document}


          enter image description here



          In principle, you may reverse the roles of font and node font. However, the pgfmanual says on p. 223



          enter image description here



          whereas for node font (see p. 222) this restriction seems not to apply:



          enter image description here



          Therefore, I'd like to argue one should use those modifiers like bfseries, which change the dimensions of the text (more) with node font rather than just font.






          share|improve this answer





















          • 1





            Thank you! And based on tex.stackexchange.com/questions/359570/…, apparently there is also the option /utils/exec={sffamily},. I just found that, btw.

            – henry
            Jan 2 at 15:09








          • 1





            @henry Thanks! I did not know that.

            – marmot
            Jan 2 at 16:03






          • 1





            I didn't know node font, +1!

            – CarLaTeX
            Jan 2 at 18:22











          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',
          autoActivateHeartbeat: false,
          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%2f468232%2ftikz-set-all-nodes-in-sans-serif-font%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          5














          In your setting, font=bfseries overrides font=sffamily. However, if you use node font instead of font in order to apply either of them, it works. This is because TikZ will apply both font and node font.



          documentclass[
          fontsize=11pt,
          DIV=12,
          paper=a4,
          ]{standalone}

          usepackage{
          tikz,
          }
          usepackage{amsmath}
          usepackage{textcomp}
          usepackage[oldstyle,proportional]{libertine}
          usepackage{libertinust1math}
          usepackage{zlmtt}
          usepackage[scale=0.8558]{tgheros}

          usepackage{microtype}

          usepackage[T1]{fontenc}
          usepackage[utf8]{inputenc}

          begin{document}
          begin{tikzpicture}[font=sffamily]
          node at (0,0) {123 - in sans!};
          node[node font=bfseries] at (0,-1cm) {123 now sans ;-)} ;
          end{tikzpicture}
          end{document}


          enter image description here



          In principle, you may reverse the roles of font and node font. However, the pgfmanual says on p. 223



          enter image description here



          whereas for node font (see p. 222) this restriction seems not to apply:



          enter image description here



          Therefore, I'd like to argue one should use those modifiers like bfseries, which change the dimensions of the text (more) with node font rather than just font.






          share|improve this answer





















          • 1





            Thank you! And based on tex.stackexchange.com/questions/359570/…, apparently there is also the option /utils/exec={sffamily},. I just found that, btw.

            – henry
            Jan 2 at 15:09








          • 1





            @henry Thanks! I did not know that.

            – marmot
            Jan 2 at 16:03






          • 1





            I didn't know node font, +1!

            – CarLaTeX
            Jan 2 at 18:22
















          5














          In your setting, font=bfseries overrides font=sffamily. However, if you use node font instead of font in order to apply either of them, it works. This is because TikZ will apply both font and node font.



          documentclass[
          fontsize=11pt,
          DIV=12,
          paper=a4,
          ]{standalone}

          usepackage{
          tikz,
          }
          usepackage{amsmath}
          usepackage{textcomp}
          usepackage[oldstyle,proportional]{libertine}
          usepackage{libertinust1math}
          usepackage{zlmtt}
          usepackage[scale=0.8558]{tgheros}

          usepackage{microtype}

          usepackage[T1]{fontenc}
          usepackage[utf8]{inputenc}

          begin{document}
          begin{tikzpicture}[font=sffamily]
          node at (0,0) {123 - in sans!};
          node[node font=bfseries] at (0,-1cm) {123 now sans ;-)} ;
          end{tikzpicture}
          end{document}


          enter image description here



          In principle, you may reverse the roles of font and node font. However, the pgfmanual says on p. 223



          enter image description here



          whereas for node font (see p. 222) this restriction seems not to apply:



          enter image description here



          Therefore, I'd like to argue one should use those modifiers like bfseries, which change the dimensions of the text (more) with node font rather than just font.






          share|improve this answer





















          • 1





            Thank you! And based on tex.stackexchange.com/questions/359570/…, apparently there is also the option /utils/exec={sffamily},. I just found that, btw.

            – henry
            Jan 2 at 15:09








          • 1





            @henry Thanks! I did not know that.

            – marmot
            Jan 2 at 16:03






          • 1





            I didn't know node font, +1!

            – CarLaTeX
            Jan 2 at 18:22














          5












          5








          5







          In your setting, font=bfseries overrides font=sffamily. However, if you use node font instead of font in order to apply either of them, it works. This is because TikZ will apply both font and node font.



          documentclass[
          fontsize=11pt,
          DIV=12,
          paper=a4,
          ]{standalone}

          usepackage{
          tikz,
          }
          usepackage{amsmath}
          usepackage{textcomp}
          usepackage[oldstyle,proportional]{libertine}
          usepackage{libertinust1math}
          usepackage{zlmtt}
          usepackage[scale=0.8558]{tgheros}

          usepackage{microtype}

          usepackage[T1]{fontenc}
          usepackage[utf8]{inputenc}

          begin{document}
          begin{tikzpicture}[font=sffamily]
          node at (0,0) {123 - in sans!};
          node[node font=bfseries] at (0,-1cm) {123 now sans ;-)} ;
          end{tikzpicture}
          end{document}


          enter image description here



          In principle, you may reverse the roles of font and node font. However, the pgfmanual says on p. 223



          enter image description here



          whereas for node font (see p. 222) this restriction seems not to apply:



          enter image description here



          Therefore, I'd like to argue one should use those modifiers like bfseries, which change the dimensions of the text (more) with node font rather than just font.






          share|improve this answer















          In your setting, font=bfseries overrides font=sffamily. However, if you use node font instead of font in order to apply either of them, it works. This is because TikZ will apply both font and node font.



          documentclass[
          fontsize=11pt,
          DIV=12,
          paper=a4,
          ]{standalone}

          usepackage{
          tikz,
          }
          usepackage{amsmath}
          usepackage{textcomp}
          usepackage[oldstyle,proportional]{libertine}
          usepackage{libertinust1math}
          usepackage{zlmtt}
          usepackage[scale=0.8558]{tgheros}

          usepackage{microtype}

          usepackage[T1]{fontenc}
          usepackage[utf8]{inputenc}

          begin{document}
          begin{tikzpicture}[font=sffamily]
          node at (0,0) {123 - in sans!};
          node[node font=bfseries] at (0,-1cm) {123 now sans ;-)} ;
          end{tikzpicture}
          end{document}


          enter image description here



          In principle, you may reverse the roles of font and node font. However, the pgfmanual says on p. 223



          enter image description here



          whereas for node font (see p. 222) this restriction seems not to apply:



          enter image description here



          Therefore, I'd like to argue one should use those modifiers like bfseries, which change the dimensions of the text (more) with node font rather than just font.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 2 at 12:40

























          answered Jan 2 at 12:25









          marmotmarmot

          91.4k4106199




          91.4k4106199








          • 1





            Thank you! And based on tex.stackexchange.com/questions/359570/…, apparently there is also the option /utils/exec={sffamily},. I just found that, btw.

            – henry
            Jan 2 at 15:09








          • 1





            @henry Thanks! I did not know that.

            – marmot
            Jan 2 at 16:03






          • 1





            I didn't know node font, +1!

            – CarLaTeX
            Jan 2 at 18:22














          • 1





            Thank you! And based on tex.stackexchange.com/questions/359570/…, apparently there is also the option /utils/exec={sffamily},. I just found that, btw.

            – henry
            Jan 2 at 15:09








          • 1





            @henry Thanks! I did not know that.

            – marmot
            Jan 2 at 16:03






          • 1





            I didn't know node font, +1!

            – CarLaTeX
            Jan 2 at 18:22








          1




          1





          Thank you! And based on tex.stackexchange.com/questions/359570/…, apparently there is also the option /utils/exec={sffamily},. I just found that, btw.

          – henry
          Jan 2 at 15:09







          Thank you! And based on tex.stackexchange.com/questions/359570/…, apparently there is also the option /utils/exec={sffamily},. I just found that, btw.

          – henry
          Jan 2 at 15:09






          1




          1





          @henry Thanks! I did not know that.

          – marmot
          Jan 2 at 16:03





          @henry Thanks! I did not know that.

          – marmot
          Jan 2 at 16:03




          1




          1





          I didn't know node font, +1!

          – CarLaTeX
          Jan 2 at 18:22





          I didn't know node font, +1!

          – CarLaTeX
          Jan 2 at 18:22


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468232%2ftikz-set-all-nodes-in-sans-serif-font%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

          Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

          Does disintegrating a polymorphed enemy still kill it after the 2018 errata?

          A Topological Invariant for $pi_3(U(n))$