font families side by side











up vote
0
down vote

favorite












for sure nothing that not has been answered already but i can't find it.



How to get roman and sansserif fonts in one document?



I need the LATEX Roman while my document is sans serif.



documentclass[11pt]{article}
usepackage{fontspec}
setromanfont{Times-Roman}
setmonofont{FiraMono-Regular.otf}
setmainfont{FiraSans}[
Ligatures=TeX,
Path = /Users/novski/Library/Fonts/,
BoldFont = *-Regular,
BoldItalicFont = *-Italic,
ItalicFont = *-Italic,
UprightFont = *-UltraLight,
]
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt} \ [4mm]
Large{textsc{this Document is Typset with}} \ [3mm]
textrm{ Huge{LaTeX{}} }\ [1mm]
noindentrule{textwidth}{1pt}\
vspace*{fill}
end{center}
end{document}


sansserif Latex instead of roman










share|improve this question






















  • I should have mentioned that i have a full document that i like to be set in sans serif. This is the last page of that document...
    – novski
    Sep 19 at 19:04










  • {setmainfont{Times-Roman}LaTeX}?
    – TeXnician
    Sep 19 at 19:26












  • This works. Can you explain why the font set by 'setromanfont{Times-Roman}' can not be called? To set the main font seams to me as a workaround but not a solution. I wold expect to call the special font and leave the main font for the document untouched...
    – novski
    Sep 20 at 4:49










  • Because setromanfont is the outdated equivalent of setmainfont and you override your roman font by making Fira Sans the main font. Alternatively you can do newfontfamilymyfont{Times-Roman} in the preamble and do {myfontLaTeX}.
    – TeXnician
    Sep 20 at 6:02










  • doesn't that mean that i can not exchange this part of text because its depending on a self declared fontname 'myfont' that somebody else needs to declare first? Is it possible to make that exchangeable?
    – novski
    Sep 20 at 6:04















up vote
0
down vote

favorite












for sure nothing that not has been answered already but i can't find it.



How to get roman and sansserif fonts in one document?



I need the LATEX Roman while my document is sans serif.



documentclass[11pt]{article}
usepackage{fontspec}
setromanfont{Times-Roman}
setmonofont{FiraMono-Regular.otf}
setmainfont{FiraSans}[
Ligatures=TeX,
Path = /Users/novski/Library/Fonts/,
BoldFont = *-Regular,
BoldItalicFont = *-Italic,
ItalicFont = *-Italic,
UprightFont = *-UltraLight,
]
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt} \ [4mm]
Large{textsc{this Document is Typset with}} \ [3mm]
textrm{ Huge{LaTeX{}} }\ [1mm]
noindentrule{textwidth}{1pt}\
vspace*{fill}
end{center}
end{document}


sansserif Latex instead of roman










share|improve this question






















  • I should have mentioned that i have a full document that i like to be set in sans serif. This is the last page of that document...
    – novski
    Sep 19 at 19:04










  • {setmainfont{Times-Roman}LaTeX}?
    – TeXnician
    Sep 19 at 19:26












  • This works. Can you explain why the font set by 'setromanfont{Times-Roman}' can not be called? To set the main font seams to me as a workaround but not a solution. I wold expect to call the special font and leave the main font for the document untouched...
    – novski
    Sep 20 at 4:49










  • Because setromanfont is the outdated equivalent of setmainfont and you override your roman font by making Fira Sans the main font. Alternatively you can do newfontfamilymyfont{Times-Roman} in the preamble and do {myfontLaTeX}.
    – TeXnician
    Sep 20 at 6:02










  • doesn't that mean that i can not exchange this part of text because its depending on a self declared fontname 'myfont' that somebody else needs to declare first? Is it possible to make that exchangeable?
    – novski
    Sep 20 at 6:04













up vote
0
down vote

favorite









up vote
0
down vote

favorite











for sure nothing that not has been answered already but i can't find it.



How to get roman and sansserif fonts in one document?



I need the LATEX Roman while my document is sans serif.



documentclass[11pt]{article}
usepackage{fontspec}
setromanfont{Times-Roman}
setmonofont{FiraMono-Regular.otf}
setmainfont{FiraSans}[
Ligatures=TeX,
Path = /Users/novski/Library/Fonts/,
BoldFont = *-Regular,
BoldItalicFont = *-Italic,
ItalicFont = *-Italic,
UprightFont = *-UltraLight,
]
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt} \ [4mm]
Large{textsc{this Document is Typset with}} \ [3mm]
textrm{ Huge{LaTeX{}} }\ [1mm]
noindentrule{textwidth}{1pt}\
vspace*{fill}
end{center}
end{document}


sansserif Latex instead of roman










share|improve this question













for sure nothing that not has been answered already but i can't find it.



How to get roman and sansserif fonts in one document?



I need the LATEX Roman while my document is sans serif.



documentclass[11pt]{article}
usepackage{fontspec}
setromanfont{Times-Roman}
setmonofont{FiraMono-Regular.otf}
setmainfont{FiraSans}[
Ligatures=TeX,
Path = /Users/novski/Library/Fonts/,
BoldFont = *-Regular,
BoldItalicFont = *-Italic,
ItalicFont = *-Italic,
UprightFont = *-UltraLight,
]
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt} \ [4mm]
Large{textsc{this Document is Typset with}} \ [3mm]
textrm{ Huge{LaTeX{}} }\ [1mm]
noindentrule{textwidth}{1pt}\
vspace*{fill}
end{center}
end{document}


sansserif Latex instead of roman







fonts fontspec






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 19 at 17:02









novski

48039




48039












  • I should have mentioned that i have a full document that i like to be set in sans serif. This is the last page of that document...
    – novski
    Sep 19 at 19:04










  • {setmainfont{Times-Roman}LaTeX}?
    – TeXnician
    Sep 19 at 19:26












  • This works. Can you explain why the font set by 'setromanfont{Times-Roman}' can not be called? To set the main font seams to me as a workaround but not a solution. I wold expect to call the special font and leave the main font for the document untouched...
    – novski
    Sep 20 at 4:49










  • Because setromanfont is the outdated equivalent of setmainfont and you override your roman font by making Fira Sans the main font. Alternatively you can do newfontfamilymyfont{Times-Roman} in the preamble and do {myfontLaTeX}.
    – TeXnician
    Sep 20 at 6:02










  • doesn't that mean that i can not exchange this part of text because its depending on a self declared fontname 'myfont' that somebody else needs to declare first? Is it possible to make that exchangeable?
    – novski
    Sep 20 at 6:04


















  • I should have mentioned that i have a full document that i like to be set in sans serif. This is the last page of that document...
    – novski
    Sep 19 at 19:04










  • {setmainfont{Times-Roman}LaTeX}?
    – TeXnician
    Sep 19 at 19:26












  • This works. Can you explain why the font set by 'setromanfont{Times-Roman}' can not be called? To set the main font seams to me as a workaround but not a solution. I wold expect to call the special font and leave the main font for the document untouched...
    – novski
    Sep 20 at 4:49










  • Because setromanfont is the outdated equivalent of setmainfont and you override your roman font by making Fira Sans the main font. Alternatively you can do newfontfamilymyfont{Times-Roman} in the preamble and do {myfontLaTeX}.
    – TeXnician
    Sep 20 at 6:02










  • doesn't that mean that i can not exchange this part of text because its depending on a self declared fontname 'myfont' that somebody else needs to declare first? Is it possible to make that exchangeable?
    – novski
    Sep 20 at 6:04
















I should have mentioned that i have a full document that i like to be set in sans serif. This is the last page of that document...
– novski
Sep 19 at 19:04




I should have mentioned that i have a full document that i like to be set in sans serif. This is the last page of that document...
– novski
Sep 19 at 19:04












{setmainfont{Times-Roman}LaTeX}?
– TeXnician
Sep 19 at 19:26






{setmainfont{Times-Roman}LaTeX}?
– TeXnician
Sep 19 at 19:26














This works. Can you explain why the font set by 'setromanfont{Times-Roman}' can not be called? To set the main font seams to me as a workaround but not a solution. I wold expect to call the special font and leave the main font for the document untouched...
– novski
Sep 20 at 4:49




This works. Can you explain why the font set by 'setromanfont{Times-Roman}' can not be called? To set the main font seams to me as a workaround but not a solution. I wold expect to call the special font and leave the main font for the document untouched...
– novski
Sep 20 at 4:49












Because setromanfont is the outdated equivalent of setmainfont and you override your roman font by making Fira Sans the main font. Alternatively you can do newfontfamilymyfont{Times-Roman} in the preamble and do {myfontLaTeX}.
– TeXnician
Sep 20 at 6:02




Because setromanfont is the outdated equivalent of setmainfont and you override your roman font by making Fira Sans the main font. Alternatively you can do newfontfamilymyfont{Times-Roman} in the preamble and do {myfontLaTeX}.
– TeXnician
Sep 20 at 6:02












doesn't that mean that i can not exchange this part of text because its depending on a self declared fontname 'myfont' that somebody else needs to declare first? Is it possible to make that exchangeable?
– novski
Sep 20 at 6:04




doesn't that mean that i can not exchange this part of text because its depending on a self declared fontname 'myfont' that somebody else needs to declare first? Is it possible to make that exchangeable?
– novski
Sep 20 at 6:04










3 Answers
3






active

oldest

votes

















up vote
5
down vote



accepted










Okay, so let's start with a few problems in your code:




  • You set setromanfont and setmainfont where the former is an outdated synonym for the latter. So basically Fira Sans overwrites Times Roman.

  • You use size commands like Huge as if they were commands with arguments. Either use them properly in groups ({Huge Test}) or use DeclareTextFontCommand{textHuge}{Huge} and then textHuge{Text}.

  • Should you ever have more than one line in one of these lines with changed font size consider adding a paragraph break, so that the inter-line-spacing adjusts.


Regarding your problem: You decided to typeset your document in sans serif font. That's fine, but as you use it as main font you might want to disregard the command names and simply use your roman font family as "sans font" as you swapped meanings either way.



Then you are able to use textsf or sffamily on your example and it will work. Btw: LaTeX might not look good in fonts other than Computer/Latin Modern because of kerning issues, so if you really want to emphasize the "Typeset with LaTeX" aspect you might want to adjust the kerning to your font.



For illustration purposes, I have used the Fira fonts included in TeX Live (removed your paths) and Libertinus Serif which is also part of TeX Live.



typeset with LaTeX



documentclass[11pt]{article}
usepackage{fontspec}
setmainfont{Fira Sans}
setsansfont{Libertinus Serif}
setmonofont{Fira Mono}
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt}par
vspace*{2mm}
{Largetextsc{This Document is typeset with}par}
{HugesffamilyLaTeXpar}
vspace*{2mm}
noindentrule{textwidth}{1pt}par
vspace*{fill}
end{center}
end{document}





share|improve this answer






























    up vote
    2
    down vote













    One thing you could do is to load your serif font as a named font family, say libertine, which most font packages support, then set your sans serif font as your main font (In many packages, this is the [sfdefault] package option).



    You can then declare the new commands



    newcommandseriffamily{libertine}
    DeclareTextFontCommandtextserif{seriffamily}


    Thus allows you to write seriffamily in place of rmfamily and textserif{...} in place of textrm{...}.






    share|improve this answer





















    • +1, unfortunately the OP does not like the solution (see here).
      – TeXnician
      Sep 21 at 7:14










    • @TeXnician I think the objection is that it makes it hard to change the font, because it depends on a family name. But that's what seriffamily and textserif let you do! Besides, you can always declare the family yourself with newfontfamily or use a documented package interface.
      – Davislor
      Sep 21 at 18:17










    • I think the objection was that it is not possible to simply copy the code to another document irrespective of possible settings in the preamble. But as I said, I second your solution (that's why I wrote +1) and leave it to the OP what he wants to do.
      – TeXnician
      Sep 21 at 19:55










    • @TeXnician If the OP wants that, the right approach might be to stick a bunch of sffamily and rmfamily commands all over the place.
      – Davislor
      Sep 21 at 20:03










    • That's what I suggested in my answer ;)
      – TeXnician
      Sep 21 at 20:43


















    up vote
    1
    down vote













    I'm a bit late to the party, but if you just want to make sure the LaTeX command expands correctly without kerning adjustments (which you can do with the metafont package), you can force the command to use the Computer Modern font family.



    To achieve this, you redefine the command from where you want to apply it:



    letmyLaTeXLaTeX
    defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX}


    You can as easily revert this back to normal by doing:



    letLaTeXmyLaTeX


    after the LaTeX you need to typeset occurs.



    so the following:



        % .... %
    vspace*{2mm}
    letmyLaTeXLaTeX % <- Copy LaTeX here
    defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX} % <- Redefine here
    {Largemdseriestextsc{The logo with Computer Modern:}par}
    {HugeLaTeXpar}
    letLaTeXmyLaTeX % <- Revert changes
    {Largemdseriestextsc{The logo with default font:}par}
    {HugeLaTeXpar}
    vspace*{2mm}
    % .... %


    Will produce something like this:



    result of suggestion above





    Explanation




    1. The letmyLaTeXLaTeX command will copy LaTeX into myLaTeX, we do this to avoid overwriting the command LaTeX in the next step. Think of it as "let this be the same as that"


    2. defLaTeX{...} redefines the LaTeX command sequence with whatever is entered inside the brackets {...} (know as a group).


    3. {fontfamily{cmr}rmfamilyselectfontmyLaTeX} sets the font cmr on what follows, in our case, the previously let (or copied) command sequence myLaTeX. Note: I've specifically set rmfamily here to avoid warnings of undefined shapes in some fonts.


    This can also be done with some of TeX and friends in the same way.





    For the entire document



    If you want to use this for every macro, you can put the definition in the preamble of your main *.tex file, as in the MWE below:



    documentclass[11pt]{article}
    usepackage[light, default]{sourcesanspro} % <- Using this sans serif
    usepackage[T1]{fontenc}
    letmyLaTeXLaTeX
    defLaTeX{fontfamily{cmr}rmfamilyselectfontmy@LaTeX}
    begin{document}
    thispagestyle{empty}
    begin{center}
    vspace*{fill}
    noindentrule{textwidth}{1pt}par
    vspace*{2mm}
    {Largemdseriestextsc{This Document is typeset with}par}
    {HugeLaTeXpar}
    vspace*{2mm}
    noindentrule{textwidth}{1pt}par
    vspace*{fill}
    end{center}
    end{document}


    I generally recommend doing this over making inline changes to fonts. And since LaTeX traditionally is typeset with roman font, I think it should be eaten as intended. Even so, I've added a few options further down.





    Result



    To illustrate how this works, I use the Source Sans Pro font family as the document font (like I did in the example above). This font does not expand LaTeX well (in my opinion), as shown below:



    image illustrating the use of only Source Sans Pro as default font family



    And here is how it will look once you force the font for LaTeX:



    The much better representation





    Other options



    If you want to use the same font type for consistency, you can use a font that LaTeX expands well with:



    For Typewriter fonts, try pcr (Courier), which looks like this:



    logo typeset with courier



    For Sans Serif fonts, try phv (Helvet), which looks like this:



    logo typeset with Helvetica



    For Serif fonts, you can also try ppl (Palatino), which looks like this:



    logo typeset with Palatino



    Further reading




    1. How to typeset every TeX related logo

    2. The difference between local and global scope

    3. Changing the font of specific words or paragraphs (LaTeX), (XeLaTeX & LuaTeX)






    share|improve this answer





















      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%2f451572%2ffont-families-side-by-side%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
      5
      down vote



      accepted










      Okay, so let's start with a few problems in your code:




      • You set setromanfont and setmainfont where the former is an outdated synonym for the latter. So basically Fira Sans overwrites Times Roman.

      • You use size commands like Huge as if they were commands with arguments. Either use them properly in groups ({Huge Test}) or use DeclareTextFontCommand{textHuge}{Huge} and then textHuge{Text}.

      • Should you ever have more than one line in one of these lines with changed font size consider adding a paragraph break, so that the inter-line-spacing adjusts.


      Regarding your problem: You decided to typeset your document in sans serif font. That's fine, but as you use it as main font you might want to disregard the command names and simply use your roman font family as "sans font" as you swapped meanings either way.



      Then you are able to use textsf or sffamily on your example and it will work. Btw: LaTeX might not look good in fonts other than Computer/Latin Modern because of kerning issues, so if you really want to emphasize the "Typeset with LaTeX" aspect you might want to adjust the kerning to your font.



      For illustration purposes, I have used the Fira fonts included in TeX Live (removed your paths) and Libertinus Serif which is also part of TeX Live.



      typeset with LaTeX



      documentclass[11pt]{article}
      usepackage{fontspec}
      setmainfont{Fira Sans}
      setsansfont{Libertinus Serif}
      setmonofont{Fira Mono}
      begin{document}
      thispagestyle{empty}
      begin{center}
      vspace*{fill}
      noindentrule{textwidth}{1pt}par
      vspace*{2mm}
      {Largetextsc{This Document is typeset with}par}
      {HugesffamilyLaTeXpar}
      vspace*{2mm}
      noindentrule{textwidth}{1pt}par
      vspace*{fill}
      end{center}
      end{document}





      share|improve this answer



























        up vote
        5
        down vote



        accepted










        Okay, so let's start with a few problems in your code:




        • You set setromanfont and setmainfont where the former is an outdated synonym for the latter. So basically Fira Sans overwrites Times Roman.

        • You use size commands like Huge as if they were commands with arguments. Either use them properly in groups ({Huge Test}) or use DeclareTextFontCommand{textHuge}{Huge} and then textHuge{Text}.

        • Should you ever have more than one line in one of these lines with changed font size consider adding a paragraph break, so that the inter-line-spacing adjusts.


        Regarding your problem: You decided to typeset your document in sans serif font. That's fine, but as you use it as main font you might want to disregard the command names and simply use your roman font family as "sans font" as you swapped meanings either way.



        Then you are able to use textsf or sffamily on your example and it will work. Btw: LaTeX might not look good in fonts other than Computer/Latin Modern because of kerning issues, so if you really want to emphasize the "Typeset with LaTeX" aspect you might want to adjust the kerning to your font.



        For illustration purposes, I have used the Fira fonts included in TeX Live (removed your paths) and Libertinus Serif which is also part of TeX Live.



        typeset with LaTeX



        documentclass[11pt]{article}
        usepackage{fontspec}
        setmainfont{Fira Sans}
        setsansfont{Libertinus Serif}
        setmonofont{Fira Mono}
        begin{document}
        thispagestyle{empty}
        begin{center}
        vspace*{fill}
        noindentrule{textwidth}{1pt}par
        vspace*{2mm}
        {Largetextsc{This Document is typeset with}par}
        {HugesffamilyLaTeXpar}
        vspace*{2mm}
        noindentrule{textwidth}{1pt}par
        vspace*{fill}
        end{center}
        end{document}





        share|improve this answer

























          up vote
          5
          down vote



          accepted







          up vote
          5
          down vote



          accepted






          Okay, so let's start with a few problems in your code:




          • You set setromanfont and setmainfont where the former is an outdated synonym for the latter. So basically Fira Sans overwrites Times Roman.

          • You use size commands like Huge as if they were commands with arguments. Either use them properly in groups ({Huge Test}) or use DeclareTextFontCommand{textHuge}{Huge} and then textHuge{Text}.

          • Should you ever have more than one line in one of these lines with changed font size consider adding a paragraph break, so that the inter-line-spacing adjusts.


          Regarding your problem: You decided to typeset your document in sans serif font. That's fine, but as you use it as main font you might want to disregard the command names and simply use your roman font family as "sans font" as you swapped meanings either way.



          Then you are able to use textsf or sffamily on your example and it will work. Btw: LaTeX might not look good in fonts other than Computer/Latin Modern because of kerning issues, so if you really want to emphasize the "Typeset with LaTeX" aspect you might want to adjust the kerning to your font.



          For illustration purposes, I have used the Fira fonts included in TeX Live (removed your paths) and Libertinus Serif which is also part of TeX Live.



          typeset with LaTeX



          documentclass[11pt]{article}
          usepackage{fontspec}
          setmainfont{Fira Sans}
          setsansfont{Libertinus Serif}
          setmonofont{Fira Mono}
          begin{document}
          thispagestyle{empty}
          begin{center}
          vspace*{fill}
          noindentrule{textwidth}{1pt}par
          vspace*{2mm}
          {Largetextsc{This Document is typeset with}par}
          {HugesffamilyLaTeXpar}
          vspace*{2mm}
          noindentrule{textwidth}{1pt}par
          vspace*{fill}
          end{center}
          end{document}





          share|improve this answer














          Okay, so let's start with a few problems in your code:




          • You set setromanfont and setmainfont where the former is an outdated synonym for the latter. So basically Fira Sans overwrites Times Roman.

          • You use size commands like Huge as if they were commands with arguments. Either use them properly in groups ({Huge Test}) or use DeclareTextFontCommand{textHuge}{Huge} and then textHuge{Text}.

          • Should you ever have more than one line in one of these lines with changed font size consider adding a paragraph break, so that the inter-line-spacing adjusts.


          Regarding your problem: You decided to typeset your document in sans serif font. That's fine, but as you use it as main font you might want to disregard the command names and simply use your roman font family as "sans font" as you swapped meanings either way.



          Then you are able to use textsf or sffamily on your example and it will work. Btw: LaTeX might not look good in fonts other than Computer/Latin Modern because of kerning issues, so if you really want to emphasize the "Typeset with LaTeX" aspect you might want to adjust the kerning to your font.



          For illustration purposes, I have used the Fira fonts included in TeX Live (removed your paths) and Libertinus Serif which is also part of TeX Live.



          typeset with LaTeX



          documentclass[11pt]{article}
          usepackage{fontspec}
          setmainfont{Fira Sans}
          setsansfont{Libertinus Serif}
          setmonofont{Fira Mono}
          begin{document}
          thispagestyle{empty}
          begin{center}
          vspace*{fill}
          noindentrule{textwidth}{1pt}par
          vspace*{2mm}
          {Largetextsc{This Document is typeset with}par}
          {HugesffamilyLaTeXpar}
          vspace*{2mm}
          noindentrule{textwidth}{1pt}par
          vspace*{fill}
          end{center}
          end{document}






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 20 at 6:24

























          answered Sep 20 at 6:17









          TeXnician

          23.9k62984




          23.9k62984






















              up vote
              2
              down vote













              One thing you could do is to load your serif font as a named font family, say libertine, which most font packages support, then set your sans serif font as your main font (In many packages, this is the [sfdefault] package option).



              You can then declare the new commands



              newcommandseriffamily{libertine}
              DeclareTextFontCommandtextserif{seriffamily}


              Thus allows you to write seriffamily in place of rmfamily and textserif{...} in place of textrm{...}.






              share|improve this answer





















              • +1, unfortunately the OP does not like the solution (see here).
                – TeXnician
                Sep 21 at 7:14










              • @TeXnician I think the objection is that it makes it hard to change the font, because it depends on a family name. But that's what seriffamily and textserif let you do! Besides, you can always declare the family yourself with newfontfamily or use a documented package interface.
                – Davislor
                Sep 21 at 18:17










              • I think the objection was that it is not possible to simply copy the code to another document irrespective of possible settings in the preamble. But as I said, I second your solution (that's why I wrote +1) and leave it to the OP what he wants to do.
                – TeXnician
                Sep 21 at 19:55










              • @TeXnician If the OP wants that, the right approach might be to stick a bunch of sffamily and rmfamily commands all over the place.
                – Davislor
                Sep 21 at 20:03










              • That's what I suggested in my answer ;)
                – TeXnician
                Sep 21 at 20:43















              up vote
              2
              down vote













              One thing you could do is to load your serif font as a named font family, say libertine, which most font packages support, then set your sans serif font as your main font (In many packages, this is the [sfdefault] package option).



              You can then declare the new commands



              newcommandseriffamily{libertine}
              DeclareTextFontCommandtextserif{seriffamily}


              Thus allows you to write seriffamily in place of rmfamily and textserif{...} in place of textrm{...}.






              share|improve this answer





















              • +1, unfortunately the OP does not like the solution (see here).
                – TeXnician
                Sep 21 at 7:14










              • @TeXnician I think the objection is that it makes it hard to change the font, because it depends on a family name. But that's what seriffamily and textserif let you do! Besides, you can always declare the family yourself with newfontfamily or use a documented package interface.
                – Davislor
                Sep 21 at 18:17










              • I think the objection was that it is not possible to simply copy the code to another document irrespective of possible settings in the preamble. But as I said, I second your solution (that's why I wrote +1) and leave it to the OP what he wants to do.
                – TeXnician
                Sep 21 at 19:55










              • @TeXnician If the OP wants that, the right approach might be to stick a bunch of sffamily and rmfamily commands all over the place.
                – Davislor
                Sep 21 at 20:03










              • That's what I suggested in my answer ;)
                – TeXnician
                Sep 21 at 20:43













              up vote
              2
              down vote










              up vote
              2
              down vote









              One thing you could do is to load your serif font as a named font family, say libertine, which most font packages support, then set your sans serif font as your main font (In many packages, this is the [sfdefault] package option).



              You can then declare the new commands



              newcommandseriffamily{libertine}
              DeclareTextFontCommandtextserif{seriffamily}


              Thus allows you to write seriffamily in place of rmfamily and textserif{...} in place of textrm{...}.






              share|improve this answer












              One thing you could do is to load your serif font as a named font family, say libertine, which most font packages support, then set your sans serif font as your main font (In many packages, this is the [sfdefault] package option).



              You can then declare the new commands



              newcommandseriffamily{libertine}
              DeclareTextFontCommandtextserif{seriffamily}


              Thus allows you to write seriffamily in place of rmfamily and textserif{...} in place of textrm{...}.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Sep 20 at 20:21









              Davislor

              4,272821




              4,272821












              • +1, unfortunately the OP does not like the solution (see here).
                – TeXnician
                Sep 21 at 7:14










              • @TeXnician I think the objection is that it makes it hard to change the font, because it depends on a family name. But that's what seriffamily and textserif let you do! Besides, you can always declare the family yourself with newfontfamily or use a documented package interface.
                – Davislor
                Sep 21 at 18:17










              • I think the objection was that it is not possible to simply copy the code to another document irrespective of possible settings in the preamble. But as I said, I second your solution (that's why I wrote +1) and leave it to the OP what he wants to do.
                – TeXnician
                Sep 21 at 19:55










              • @TeXnician If the OP wants that, the right approach might be to stick a bunch of sffamily and rmfamily commands all over the place.
                – Davislor
                Sep 21 at 20:03










              • That's what I suggested in my answer ;)
                – TeXnician
                Sep 21 at 20:43


















              • +1, unfortunately the OP does not like the solution (see here).
                – TeXnician
                Sep 21 at 7:14










              • @TeXnician I think the objection is that it makes it hard to change the font, because it depends on a family name. But that's what seriffamily and textserif let you do! Besides, you can always declare the family yourself with newfontfamily or use a documented package interface.
                – Davislor
                Sep 21 at 18:17










              • I think the objection was that it is not possible to simply copy the code to another document irrespective of possible settings in the preamble. But as I said, I second your solution (that's why I wrote +1) and leave it to the OP what he wants to do.
                – TeXnician
                Sep 21 at 19:55










              • @TeXnician If the OP wants that, the right approach might be to stick a bunch of sffamily and rmfamily commands all over the place.
                – Davislor
                Sep 21 at 20:03










              • That's what I suggested in my answer ;)
                – TeXnician
                Sep 21 at 20:43
















              +1, unfortunately the OP does not like the solution (see here).
              – TeXnician
              Sep 21 at 7:14




              +1, unfortunately the OP does not like the solution (see here).
              – TeXnician
              Sep 21 at 7:14












              @TeXnician I think the objection is that it makes it hard to change the font, because it depends on a family name. But that's what seriffamily and textserif let you do! Besides, you can always declare the family yourself with newfontfamily or use a documented package interface.
              – Davislor
              Sep 21 at 18:17




              @TeXnician I think the objection is that it makes it hard to change the font, because it depends on a family name. But that's what seriffamily and textserif let you do! Besides, you can always declare the family yourself with newfontfamily or use a documented package interface.
              – Davislor
              Sep 21 at 18:17












              I think the objection was that it is not possible to simply copy the code to another document irrespective of possible settings in the preamble. But as I said, I second your solution (that's why I wrote +1) and leave it to the OP what he wants to do.
              – TeXnician
              Sep 21 at 19:55




              I think the objection was that it is not possible to simply copy the code to another document irrespective of possible settings in the preamble. But as I said, I second your solution (that's why I wrote +1) and leave it to the OP what he wants to do.
              – TeXnician
              Sep 21 at 19:55












              @TeXnician If the OP wants that, the right approach might be to stick a bunch of sffamily and rmfamily commands all over the place.
              – Davislor
              Sep 21 at 20:03




              @TeXnician If the OP wants that, the right approach might be to stick a bunch of sffamily and rmfamily commands all over the place.
              – Davislor
              Sep 21 at 20:03












              That's what I suggested in my answer ;)
              – TeXnician
              Sep 21 at 20:43




              That's what I suggested in my answer ;)
              – TeXnician
              Sep 21 at 20:43










              up vote
              1
              down vote













              I'm a bit late to the party, but if you just want to make sure the LaTeX command expands correctly without kerning adjustments (which you can do with the metafont package), you can force the command to use the Computer Modern font family.



              To achieve this, you redefine the command from where you want to apply it:



              letmyLaTeXLaTeX
              defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX}


              You can as easily revert this back to normal by doing:



              letLaTeXmyLaTeX


              after the LaTeX you need to typeset occurs.



              so the following:



                  % .... %
              vspace*{2mm}
              letmyLaTeXLaTeX % <- Copy LaTeX here
              defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX} % <- Redefine here
              {Largemdseriestextsc{The logo with Computer Modern:}par}
              {HugeLaTeXpar}
              letLaTeXmyLaTeX % <- Revert changes
              {Largemdseriestextsc{The logo with default font:}par}
              {HugeLaTeXpar}
              vspace*{2mm}
              % .... %


              Will produce something like this:



              result of suggestion above





              Explanation




              1. The letmyLaTeXLaTeX command will copy LaTeX into myLaTeX, we do this to avoid overwriting the command LaTeX in the next step. Think of it as "let this be the same as that"


              2. defLaTeX{...} redefines the LaTeX command sequence with whatever is entered inside the brackets {...} (know as a group).


              3. {fontfamily{cmr}rmfamilyselectfontmyLaTeX} sets the font cmr on what follows, in our case, the previously let (or copied) command sequence myLaTeX. Note: I've specifically set rmfamily here to avoid warnings of undefined shapes in some fonts.


              This can also be done with some of TeX and friends in the same way.





              For the entire document



              If you want to use this for every macro, you can put the definition in the preamble of your main *.tex file, as in the MWE below:



              documentclass[11pt]{article}
              usepackage[light, default]{sourcesanspro} % <- Using this sans serif
              usepackage[T1]{fontenc}
              letmyLaTeXLaTeX
              defLaTeX{fontfamily{cmr}rmfamilyselectfontmy@LaTeX}
              begin{document}
              thispagestyle{empty}
              begin{center}
              vspace*{fill}
              noindentrule{textwidth}{1pt}par
              vspace*{2mm}
              {Largemdseriestextsc{This Document is typeset with}par}
              {HugeLaTeXpar}
              vspace*{2mm}
              noindentrule{textwidth}{1pt}par
              vspace*{fill}
              end{center}
              end{document}


              I generally recommend doing this over making inline changes to fonts. And since LaTeX traditionally is typeset with roman font, I think it should be eaten as intended. Even so, I've added a few options further down.





              Result



              To illustrate how this works, I use the Source Sans Pro font family as the document font (like I did in the example above). This font does not expand LaTeX well (in my opinion), as shown below:



              image illustrating the use of only Source Sans Pro as default font family



              And here is how it will look once you force the font for LaTeX:



              The much better representation





              Other options



              If you want to use the same font type for consistency, you can use a font that LaTeX expands well with:



              For Typewriter fonts, try pcr (Courier), which looks like this:



              logo typeset with courier



              For Sans Serif fonts, try phv (Helvet), which looks like this:



              logo typeset with Helvetica



              For Serif fonts, you can also try ppl (Palatino), which looks like this:



              logo typeset with Palatino



              Further reading




              1. How to typeset every TeX related logo

              2. The difference between local and global scope

              3. Changing the font of specific words or paragraphs (LaTeX), (XeLaTeX & LuaTeX)






              share|improve this answer

























                up vote
                1
                down vote













                I'm a bit late to the party, but if you just want to make sure the LaTeX command expands correctly without kerning adjustments (which you can do with the metafont package), you can force the command to use the Computer Modern font family.



                To achieve this, you redefine the command from where you want to apply it:



                letmyLaTeXLaTeX
                defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX}


                You can as easily revert this back to normal by doing:



                letLaTeXmyLaTeX


                after the LaTeX you need to typeset occurs.



                so the following:



                    % .... %
                vspace*{2mm}
                letmyLaTeXLaTeX % <- Copy LaTeX here
                defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX} % <- Redefine here
                {Largemdseriestextsc{The logo with Computer Modern:}par}
                {HugeLaTeXpar}
                letLaTeXmyLaTeX % <- Revert changes
                {Largemdseriestextsc{The logo with default font:}par}
                {HugeLaTeXpar}
                vspace*{2mm}
                % .... %


                Will produce something like this:



                result of suggestion above





                Explanation




                1. The letmyLaTeXLaTeX command will copy LaTeX into myLaTeX, we do this to avoid overwriting the command LaTeX in the next step. Think of it as "let this be the same as that"


                2. defLaTeX{...} redefines the LaTeX command sequence with whatever is entered inside the brackets {...} (know as a group).


                3. {fontfamily{cmr}rmfamilyselectfontmyLaTeX} sets the font cmr on what follows, in our case, the previously let (or copied) command sequence myLaTeX. Note: I've specifically set rmfamily here to avoid warnings of undefined shapes in some fonts.


                This can also be done with some of TeX and friends in the same way.





                For the entire document



                If you want to use this for every macro, you can put the definition in the preamble of your main *.tex file, as in the MWE below:



                documentclass[11pt]{article}
                usepackage[light, default]{sourcesanspro} % <- Using this sans serif
                usepackage[T1]{fontenc}
                letmyLaTeXLaTeX
                defLaTeX{fontfamily{cmr}rmfamilyselectfontmy@LaTeX}
                begin{document}
                thispagestyle{empty}
                begin{center}
                vspace*{fill}
                noindentrule{textwidth}{1pt}par
                vspace*{2mm}
                {Largemdseriestextsc{This Document is typeset with}par}
                {HugeLaTeXpar}
                vspace*{2mm}
                noindentrule{textwidth}{1pt}par
                vspace*{fill}
                end{center}
                end{document}


                I generally recommend doing this over making inline changes to fonts. And since LaTeX traditionally is typeset with roman font, I think it should be eaten as intended. Even so, I've added a few options further down.





                Result



                To illustrate how this works, I use the Source Sans Pro font family as the document font (like I did in the example above). This font does not expand LaTeX well (in my opinion), as shown below:



                image illustrating the use of only Source Sans Pro as default font family



                And here is how it will look once you force the font for LaTeX:



                The much better representation





                Other options



                If you want to use the same font type for consistency, you can use a font that LaTeX expands well with:



                For Typewriter fonts, try pcr (Courier), which looks like this:



                logo typeset with courier



                For Sans Serif fonts, try phv (Helvet), which looks like this:



                logo typeset with Helvetica



                For Serif fonts, you can also try ppl (Palatino), which looks like this:



                logo typeset with Palatino



                Further reading




                1. How to typeset every TeX related logo

                2. The difference between local and global scope

                3. Changing the font of specific words or paragraphs (LaTeX), (XeLaTeX & LuaTeX)






                share|improve this answer























                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  I'm a bit late to the party, but if you just want to make sure the LaTeX command expands correctly without kerning adjustments (which you can do with the metafont package), you can force the command to use the Computer Modern font family.



                  To achieve this, you redefine the command from where you want to apply it:



                  letmyLaTeXLaTeX
                  defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX}


                  You can as easily revert this back to normal by doing:



                  letLaTeXmyLaTeX


                  after the LaTeX you need to typeset occurs.



                  so the following:



                      % .... %
                  vspace*{2mm}
                  letmyLaTeXLaTeX % <- Copy LaTeX here
                  defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX} % <- Redefine here
                  {Largemdseriestextsc{The logo with Computer Modern:}par}
                  {HugeLaTeXpar}
                  letLaTeXmyLaTeX % <- Revert changes
                  {Largemdseriestextsc{The logo with default font:}par}
                  {HugeLaTeXpar}
                  vspace*{2mm}
                  % .... %


                  Will produce something like this:



                  result of suggestion above





                  Explanation




                  1. The letmyLaTeXLaTeX command will copy LaTeX into myLaTeX, we do this to avoid overwriting the command LaTeX in the next step. Think of it as "let this be the same as that"


                  2. defLaTeX{...} redefines the LaTeX command sequence with whatever is entered inside the brackets {...} (know as a group).


                  3. {fontfamily{cmr}rmfamilyselectfontmyLaTeX} sets the font cmr on what follows, in our case, the previously let (or copied) command sequence myLaTeX. Note: I've specifically set rmfamily here to avoid warnings of undefined shapes in some fonts.


                  This can also be done with some of TeX and friends in the same way.





                  For the entire document



                  If you want to use this for every macro, you can put the definition in the preamble of your main *.tex file, as in the MWE below:



                  documentclass[11pt]{article}
                  usepackage[light, default]{sourcesanspro} % <- Using this sans serif
                  usepackage[T1]{fontenc}
                  letmyLaTeXLaTeX
                  defLaTeX{fontfamily{cmr}rmfamilyselectfontmy@LaTeX}
                  begin{document}
                  thispagestyle{empty}
                  begin{center}
                  vspace*{fill}
                  noindentrule{textwidth}{1pt}par
                  vspace*{2mm}
                  {Largemdseriestextsc{This Document is typeset with}par}
                  {HugeLaTeXpar}
                  vspace*{2mm}
                  noindentrule{textwidth}{1pt}par
                  vspace*{fill}
                  end{center}
                  end{document}


                  I generally recommend doing this over making inline changes to fonts. And since LaTeX traditionally is typeset with roman font, I think it should be eaten as intended. Even so, I've added a few options further down.





                  Result



                  To illustrate how this works, I use the Source Sans Pro font family as the document font (like I did in the example above). This font does not expand LaTeX well (in my opinion), as shown below:



                  image illustrating the use of only Source Sans Pro as default font family



                  And here is how it will look once you force the font for LaTeX:



                  The much better representation





                  Other options



                  If you want to use the same font type for consistency, you can use a font that LaTeX expands well with:



                  For Typewriter fonts, try pcr (Courier), which looks like this:



                  logo typeset with courier



                  For Sans Serif fonts, try phv (Helvet), which looks like this:



                  logo typeset with Helvetica



                  For Serif fonts, you can also try ppl (Palatino), which looks like this:



                  logo typeset with Palatino



                  Further reading




                  1. How to typeset every TeX related logo

                  2. The difference between local and global scope

                  3. Changing the font of specific words or paragraphs (LaTeX), (XeLaTeX & LuaTeX)






                  share|improve this answer












                  I'm a bit late to the party, but if you just want to make sure the LaTeX command expands correctly without kerning adjustments (which you can do with the metafont package), you can force the command to use the Computer Modern font family.



                  To achieve this, you redefine the command from where you want to apply it:



                  letmyLaTeXLaTeX
                  defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX}


                  You can as easily revert this back to normal by doing:



                  letLaTeXmyLaTeX


                  after the LaTeX you need to typeset occurs.



                  so the following:



                      % .... %
                  vspace*{2mm}
                  letmyLaTeXLaTeX % <- Copy LaTeX here
                  defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX} % <- Redefine here
                  {Largemdseriestextsc{The logo with Computer Modern:}par}
                  {HugeLaTeXpar}
                  letLaTeXmyLaTeX % <- Revert changes
                  {Largemdseriestextsc{The logo with default font:}par}
                  {HugeLaTeXpar}
                  vspace*{2mm}
                  % .... %


                  Will produce something like this:



                  result of suggestion above





                  Explanation




                  1. The letmyLaTeXLaTeX command will copy LaTeX into myLaTeX, we do this to avoid overwriting the command LaTeX in the next step. Think of it as "let this be the same as that"


                  2. defLaTeX{...} redefines the LaTeX command sequence with whatever is entered inside the brackets {...} (know as a group).


                  3. {fontfamily{cmr}rmfamilyselectfontmyLaTeX} sets the font cmr on what follows, in our case, the previously let (or copied) command sequence myLaTeX. Note: I've specifically set rmfamily here to avoid warnings of undefined shapes in some fonts.


                  This can also be done with some of TeX and friends in the same way.





                  For the entire document



                  If you want to use this for every macro, you can put the definition in the preamble of your main *.tex file, as in the MWE below:



                  documentclass[11pt]{article}
                  usepackage[light, default]{sourcesanspro} % <- Using this sans serif
                  usepackage[T1]{fontenc}
                  letmyLaTeXLaTeX
                  defLaTeX{fontfamily{cmr}rmfamilyselectfontmy@LaTeX}
                  begin{document}
                  thispagestyle{empty}
                  begin{center}
                  vspace*{fill}
                  noindentrule{textwidth}{1pt}par
                  vspace*{2mm}
                  {Largemdseriestextsc{This Document is typeset with}par}
                  {HugeLaTeXpar}
                  vspace*{2mm}
                  noindentrule{textwidth}{1pt}par
                  vspace*{fill}
                  end{center}
                  end{document}


                  I generally recommend doing this over making inline changes to fonts. And since LaTeX traditionally is typeset with roman font, I think it should be eaten as intended. Even so, I've added a few options further down.





                  Result



                  To illustrate how this works, I use the Source Sans Pro font family as the document font (like I did in the example above). This font does not expand LaTeX well (in my opinion), as shown below:



                  image illustrating the use of only Source Sans Pro as default font family



                  And here is how it will look once you force the font for LaTeX:



                  The much better representation





                  Other options



                  If you want to use the same font type for consistency, you can use a font that LaTeX expands well with:



                  For Typewriter fonts, try pcr (Courier), which looks like this:



                  logo typeset with courier



                  For Sans Serif fonts, try phv (Helvet), which looks like this:



                  logo typeset with Helvetica



                  For Serif fonts, you can also try ppl (Palatino), which looks like this:



                  logo typeset with Palatino



                  Further reading




                  1. How to typeset every TeX related logo

                  2. The difference between local and global scope

                  3. Changing the font of specific words or paragraphs (LaTeX), (XeLaTeX & LuaTeX)







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 3 hours ago









                  Ole Anders

                  326112




                  326112






























                      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.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • 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%2f451572%2ffont-families-side-by-side%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

                      Futebolista

                      F# list compare

                      Jornalista