Getting fontspec Fonts with pdfLaTeX

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I have to make a document, which was originally written in LuaLaTeX, compatible for both pdfLaTeX and LuaLaTeX. Everything works except that the fonts differ. How can I force pdfLaTeX/fontenc to use the same fonts as fontspec?



Minimal example (omitted ifluatex to avoid clutter):



documentclass[fontsize=11pt]scrreprt
% usepackagefontspec
usepackagelmodern
usepackage[T1]fontenc
usepackage[utf8]inputenc

begindocument
chapterChapter
sectionSection
Text with some formulas: $a=1$.
enddocument


By using lmodern, the fonts of the text seem to almost coincide, but the math fonts differ:



# pdffonts output for pdflatex with lmodern, fontenc and inputenc:
name type encoding emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
ZGMFNK+LMSans10-Bold Type 1 Custom yes yes no 4 0
YIMXCY+LMRoman10-Regular Type 1 Custom yes yes no 5 0
GXEVRM+LMMathItalic10-Regular Type 1 Custom yes yes no 6 0
YIMXCY+LMRoman10-Regular Type 1 Custom yes yes no 7 0

# pdffonts output for lualatex with fontspec:
name type encoding emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
SSPBGH+LMSans10-Bold CID Type 0C Identity-H yes yes yes 4 0
XXBUAG+LMRoman10-Regular CID Type 0C Identity-H yes yes yes 5 0
EDWHGC+CMMI10 Type 1 Builtin yes yes no 6 0
HVZLMP+CMR10 Type 1 Builtin yes yes no 7 0


So, the type and encoding differs, and the math fonts.










share|improve this question

























    up vote
    1
    down vote

    favorite












    I have to make a document, which was originally written in LuaLaTeX, compatible for both pdfLaTeX and LuaLaTeX. Everything works except that the fonts differ. How can I force pdfLaTeX/fontenc to use the same fonts as fontspec?



    Minimal example (omitted ifluatex to avoid clutter):



    documentclass[fontsize=11pt]scrreprt
    % usepackagefontspec
    usepackagelmodern
    usepackage[T1]fontenc
    usepackage[utf8]inputenc

    begindocument
    chapterChapter
    sectionSection
    Text with some formulas: $a=1$.
    enddocument


    By using lmodern, the fonts of the text seem to almost coincide, but the math fonts differ:



    # pdffonts output for pdflatex with lmodern, fontenc and inputenc:
    name type encoding emb sub uni object ID
    ------------------------------------ ----------------- ---------------- --- --- --- ---------
    ZGMFNK+LMSans10-Bold Type 1 Custom yes yes no 4 0
    YIMXCY+LMRoman10-Regular Type 1 Custom yes yes no 5 0
    GXEVRM+LMMathItalic10-Regular Type 1 Custom yes yes no 6 0
    YIMXCY+LMRoman10-Regular Type 1 Custom yes yes no 7 0

    # pdffonts output for lualatex with fontspec:
    name type encoding emb sub uni object ID
    ------------------------------------ ----------------- ---------------- --- --- --- ---------
    SSPBGH+LMSans10-Bold CID Type 0C Identity-H yes yes yes 4 0
    XXBUAG+LMRoman10-Regular CID Type 0C Identity-H yes yes yes 5 0
    EDWHGC+CMMI10 Type 1 Builtin yes yes no 6 0
    HVZLMP+CMR10 Type 1 Builtin yes yes no 7 0


    So, the type and encoding differs, and the math fonts.










    share|improve this question























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have to make a document, which was originally written in LuaLaTeX, compatible for both pdfLaTeX and LuaLaTeX. Everything works except that the fonts differ. How can I force pdfLaTeX/fontenc to use the same fonts as fontspec?



      Minimal example (omitted ifluatex to avoid clutter):



      documentclass[fontsize=11pt]scrreprt
      % usepackagefontspec
      usepackagelmodern
      usepackage[T1]fontenc
      usepackage[utf8]inputenc

      begindocument
      chapterChapter
      sectionSection
      Text with some formulas: $a=1$.
      enddocument


      By using lmodern, the fonts of the text seem to almost coincide, but the math fonts differ:



      # pdffonts output for pdflatex with lmodern, fontenc and inputenc:
      name type encoding emb sub uni object ID
      ------------------------------------ ----------------- ---------------- --- --- --- ---------
      ZGMFNK+LMSans10-Bold Type 1 Custom yes yes no 4 0
      YIMXCY+LMRoman10-Regular Type 1 Custom yes yes no 5 0
      GXEVRM+LMMathItalic10-Regular Type 1 Custom yes yes no 6 0
      YIMXCY+LMRoman10-Regular Type 1 Custom yes yes no 7 0

      # pdffonts output for lualatex with fontspec:
      name type encoding emb sub uni object ID
      ------------------------------------ ----------------- ---------------- --- --- --- ---------
      SSPBGH+LMSans10-Bold CID Type 0C Identity-H yes yes yes 4 0
      XXBUAG+LMRoman10-Regular CID Type 0C Identity-H yes yes yes 5 0
      EDWHGC+CMMI10 Type 1 Builtin yes yes no 6 0
      HVZLMP+CMR10 Type 1 Builtin yes yes no 7 0


      So, the type and encoding differs, and the math fonts.










      share|improve this question













      I have to make a document, which was originally written in LuaLaTeX, compatible for both pdfLaTeX and LuaLaTeX. Everything works except that the fonts differ. How can I force pdfLaTeX/fontenc to use the same fonts as fontspec?



      Minimal example (omitted ifluatex to avoid clutter):



      documentclass[fontsize=11pt]scrreprt
      % usepackagefontspec
      usepackagelmodern
      usepackage[T1]fontenc
      usepackage[utf8]inputenc

      begindocument
      chapterChapter
      sectionSection
      Text with some formulas: $a=1$.
      enddocument


      By using lmodern, the fonts of the text seem to almost coincide, but the math fonts differ:



      # pdffonts output for pdflatex with lmodern, fontenc and inputenc:
      name type encoding emb sub uni object ID
      ------------------------------------ ----------------- ---------------- --- --- --- ---------
      ZGMFNK+LMSans10-Bold Type 1 Custom yes yes no 4 0
      YIMXCY+LMRoman10-Regular Type 1 Custom yes yes no 5 0
      GXEVRM+LMMathItalic10-Regular Type 1 Custom yes yes no 6 0
      YIMXCY+LMRoman10-Regular Type 1 Custom yes yes no 7 0

      # pdffonts output for lualatex with fontspec:
      name type encoding emb sub uni object ID
      ------------------------------------ ----------------- ---------------- --- --- --- ---------
      SSPBGH+LMSans10-Bold CID Type 0C Identity-H yes yes yes 4 0
      XXBUAG+LMRoman10-Regular CID Type 0C Identity-H yes yes yes 5 0
      EDWHGC+CMMI10 Type 1 Builtin yes yes no 6 0
      HVZLMP+CMR10 Type 1 Builtin yes yes no 7 0


      So, the type and encoding differs, and the math fonts.







      fonts pdftex luatex fontspec font-encodings






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 3 hours ago









      Cari Baur

      112116




      112116




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote













          It is not possible to get the same font encodings for LuaTeX and pdfTeX, for the simple reason that LuaTeX with fontspec uses OpenType fonts, whereas pdfTeX uses Type 1 fonts. It is possible to get the same math fonts, though, by passing the option nomath to lmodern.



          If you are using the 2018 version of LaTeX, you can remove usepackage[utf8]inputenc because UTF-8 is now the standard encoding.



          documentclass[fontsize=11pt]scrreprt
          ifdefineddirectlua
          usepackagefontspec
          else
          usepackage[T1]fontenc
          usepackage[nomath]lmodern
          fi

          begindocument
          chapterChapter
          sectionSection
          Text with some formulas: $a=1$.
          enddocument


          Run through pdflatex I get this



          $ pdflatex test.tex
          $ pdffonts test.pdf
          name type encoding emb sub uni object ID
          ------------------------------------ ----------------- ---------------- --- --- --- ---------
          ZGMFNK+LMSans10-Bold Type 1 Custom yes yes no 4 0
          KOIJYY+LMRoman10-Regular Type 1 Custom yes yes no 5 0
          EDWHGC+CMMI10 Type 1 Builtin yes yes no 6 0
          HVZLMP+CMR10 Type 1 Builtin yes yes no 7 0


          Run through lualatex I get this



          $ lualatex test.tex
          $ pdffonts test.pdf
          name type encoding emb sub uni object ID
          ------------------------------------ ----------------- ---------------- --- --- --- ---------
          SSPBGH+LMSans10-Bold CID Type 0C Identity-H yes yes yes 4 0
          HXVMKT+LMRoman10-Regular CID Type 0C Identity-H yes yes yes 5 0
          EDWHGC+CMMI10 Type 1 Builtin yes yes no 6 0
          HVZLMP+CMR10 Type 1 Builtin yes yes no 7 0





          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: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            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%2f453034%2fgetting-fontspec-fonts-with-pdflatex%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            3
            down vote













            It is not possible to get the same font encodings for LuaTeX and pdfTeX, for the simple reason that LuaTeX with fontspec uses OpenType fonts, whereas pdfTeX uses Type 1 fonts. It is possible to get the same math fonts, though, by passing the option nomath to lmodern.



            If you are using the 2018 version of LaTeX, you can remove usepackage[utf8]inputenc because UTF-8 is now the standard encoding.



            documentclass[fontsize=11pt]scrreprt
            ifdefineddirectlua
            usepackagefontspec
            else
            usepackage[T1]fontenc
            usepackage[nomath]lmodern
            fi

            begindocument
            chapterChapter
            sectionSection
            Text with some formulas: $a=1$.
            enddocument


            Run through pdflatex I get this



            $ pdflatex test.tex
            $ pdffonts test.pdf
            name type encoding emb sub uni object ID
            ------------------------------------ ----------------- ---------------- --- --- --- ---------
            ZGMFNK+LMSans10-Bold Type 1 Custom yes yes no 4 0
            KOIJYY+LMRoman10-Regular Type 1 Custom yes yes no 5 0
            EDWHGC+CMMI10 Type 1 Builtin yes yes no 6 0
            HVZLMP+CMR10 Type 1 Builtin yes yes no 7 0


            Run through lualatex I get this



            $ lualatex test.tex
            $ pdffonts test.pdf
            name type encoding emb sub uni object ID
            ------------------------------------ ----------------- ---------------- --- --- --- ---------
            SSPBGH+LMSans10-Bold CID Type 0C Identity-H yes yes yes 4 0
            HXVMKT+LMRoman10-Regular CID Type 0C Identity-H yes yes yes 5 0
            EDWHGC+CMMI10 Type 1 Builtin yes yes no 6 0
            HVZLMP+CMR10 Type 1 Builtin yes yes no 7 0





            share|improve this answer
























              up vote
              3
              down vote













              It is not possible to get the same font encodings for LuaTeX and pdfTeX, for the simple reason that LuaTeX with fontspec uses OpenType fonts, whereas pdfTeX uses Type 1 fonts. It is possible to get the same math fonts, though, by passing the option nomath to lmodern.



              If you are using the 2018 version of LaTeX, you can remove usepackage[utf8]inputenc because UTF-8 is now the standard encoding.



              documentclass[fontsize=11pt]scrreprt
              ifdefineddirectlua
              usepackagefontspec
              else
              usepackage[T1]fontenc
              usepackage[nomath]lmodern
              fi

              begindocument
              chapterChapter
              sectionSection
              Text with some formulas: $a=1$.
              enddocument


              Run through pdflatex I get this



              $ pdflatex test.tex
              $ pdffonts test.pdf
              name type encoding emb sub uni object ID
              ------------------------------------ ----------------- ---------------- --- --- --- ---------
              ZGMFNK+LMSans10-Bold Type 1 Custom yes yes no 4 0
              KOIJYY+LMRoman10-Regular Type 1 Custom yes yes no 5 0
              EDWHGC+CMMI10 Type 1 Builtin yes yes no 6 0
              HVZLMP+CMR10 Type 1 Builtin yes yes no 7 0


              Run through lualatex I get this



              $ lualatex test.tex
              $ pdffonts test.pdf
              name type encoding emb sub uni object ID
              ------------------------------------ ----------------- ---------------- --- --- --- ---------
              SSPBGH+LMSans10-Bold CID Type 0C Identity-H yes yes yes 4 0
              HXVMKT+LMRoman10-Regular CID Type 0C Identity-H yes yes yes 5 0
              EDWHGC+CMMI10 Type 1 Builtin yes yes no 6 0
              HVZLMP+CMR10 Type 1 Builtin yes yes no 7 0





              share|improve this answer






















                up vote
                3
                down vote










                up vote
                3
                down vote









                It is not possible to get the same font encodings for LuaTeX and pdfTeX, for the simple reason that LuaTeX with fontspec uses OpenType fonts, whereas pdfTeX uses Type 1 fonts. It is possible to get the same math fonts, though, by passing the option nomath to lmodern.



                If you are using the 2018 version of LaTeX, you can remove usepackage[utf8]inputenc because UTF-8 is now the standard encoding.



                documentclass[fontsize=11pt]scrreprt
                ifdefineddirectlua
                usepackagefontspec
                else
                usepackage[T1]fontenc
                usepackage[nomath]lmodern
                fi

                begindocument
                chapterChapter
                sectionSection
                Text with some formulas: $a=1$.
                enddocument


                Run through pdflatex I get this



                $ pdflatex test.tex
                $ pdffonts test.pdf
                name type encoding emb sub uni object ID
                ------------------------------------ ----------------- ---------------- --- --- --- ---------
                ZGMFNK+LMSans10-Bold Type 1 Custom yes yes no 4 0
                KOIJYY+LMRoman10-Regular Type 1 Custom yes yes no 5 0
                EDWHGC+CMMI10 Type 1 Builtin yes yes no 6 0
                HVZLMP+CMR10 Type 1 Builtin yes yes no 7 0


                Run through lualatex I get this



                $ lualatex test.tex
                $ pdffonts test.pdf
                name type encoding emb sub uni object ID
                ------------------------------------ ----------------- ---------------- --- --- --- ---------
                SSPBGH+LMSans10-Bold CID Type 0C Identity-H yes yes yes 4 0
                HXVMKT+LMRoman10-Regular CID Type 0C Identity-H yes yes yes 5 0
                EDWHGC+CMMI10 Type 1 Builtin yes yes no 6 0
                HVZLMP+CMR10 Type 1 Builtin yes yes no 7 0





                share|improve this answer












                It is not possible to get the same font encodings for LuaTeX and pdfTeX, for the simple reason that LuaTeX with fontspec uses OpenType fonts, whereas pdfTeX uses Type 1 fonts. It is possible to get the same math fonts, though, by passing the option nomath to lmodern.



                If you are using the 2018 version of LaTeX, you can remove usepackage[utf8]inputenc because UTF-8 is now the standard encoding.



                documentclass[fontsize=11pt]scrreprt
                ifdefineddirectlua
                usepackagefontspec
                else
                usepackage[T1]fontenc
                usepackage[nomath]lmodern
                fi

                begindocument
                chapterChapter
                sectionSection
                Text with some formulas: $a=1$.
                enddocument


                Run through pdflatex I get this



                $ pdflatex test.tex
                $ pdffonts test.pdf
                name type encoding emb sub uni object ID
                ------------------------------------ ----------------- ---------------- --- --- --- ---------
                ZGMFNK+LMSans10-Bold Type 1 Custom yes yes no 4 0
                KOIJYY+LMRoman10-Regular Type 1 Custom yes yes no 5 0
                EDWHGC+CMMI10 Type 1 Builtin yes yes no 6 0
                HVZLMP+CMR10 Type 1 Builtin yes yes no 7 0


                Run through lualatex I get this



                $ lualatex test.tex
                $ pdffonts test.pdf
                name type encoding emb sub uni object ID
                ------------------------------------ ----------------- ---------------- --- --- --- ---------
                SSPBGH+LMSans10-Bold CID Type 0C Identity-H yes yes yes 4 0
                HXVMKT+LMRoman10-Regular CID Type 0C Identity-H yes yes yes 5 0
                EDWHGC+CMMI10 Type 1 Builtin yes yes no 6 0
                HVZLMP+CMR10 Type 1 Builtin yes yes no 7 0






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 2 hours ago









                Henri Menke

                65.1k7144253




                65.1k7144253



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f453034%2fgetting-fontspec-fonts-with-pdflatex%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Comments

                    Popular posts from this blog

                    What does second last employer means? [closed]

                    Installing NextGIS Connect into QGIS 3?

                    One-line joke