I would like to change the default font for fancyvrb in the following MWE.

    % arara: xelatex: { shell: true }
    \def\It#1{{\cEm #1}}
    \def\Bf#1{{\cBld #1}}
    \def\Br#1{{\color{IndianRed}{\cNrm #1}}}
    \def\Bl#1{{\color{CornflowerBlue}{\cNrm #1}}}
    \def\Gr#1{{\color{LimeGreen}{\cNrm #1}}}
    \begin{Verbatim}[commandchars=\\\{\}, numbers=left]
    \It{;; goff.ufm}
    \It{;; 13:00:35 11:08:2021 (MST)}
    MyGoFF \{
      z = \Br{@Z}
      \Bf{complex} zf = \Br{@ZF}
      \Bf{if} \Br{@fof} > 0
        zf = Utils.\Bl{fofz}(\Br{@inverse}, \Br{@fof}, Utils.\Bl{zFunction}(\Br{@inverse}, \Br{@fofz},  z, \Gr{\#pixel}))
        z  = Utils.\Bl{fofz}(\Br{@inverse}, \Br{@fof}, Utils.\Bl{gFunction}(\Br{@inverse}, \Br{@gofz}, zf, \Gr{\#pixel}))
        zf = Utils.\Bl{zFunction}(\Br{@inverse}, \Br{@fofz},  z, \Gr{\#pixel})
        z  = Utils.\Bl{gFunction}(\Br{@inverse}, \Br{@gofz}, zf, \Gr{\#pixel})
      \Bf{if} \Br{@const} > \Bl{0}
        \Bf{if} \Br{@op} == \Bl{0}
          z = z * Utils.\Bl{GetConstant}(\Br{@const});
        \Bf{elseif} \Br{@op} == \Bl{1}
          z = Utils.\Bl{GetConstant}(\Br{@const}) / z;
        \Bf{elseif} \Br{@op} == \Bl{2}
          z = z + Utils.\Bl{GetConstant}(\Br{@const});
        \Bf{elseif} \Br{@op} == \Bl{3}
          z = Utils.\Bl{GetConstant}(\Br{@const}) - z;
        \Bf{elseif} \Br{@op} == \Bl{4}
          z = z / Utils.\Bl{GetConstant}(\Br{@const});
        \Bf{elseif} \Br{@op} == \Bl{5}
          z = z - Utils.\Bl{GetConstant}(\Br{@const});
        \Bf{elseif} \Br{@op} == \Bl{6}
          z = z\^{}\Bl{2} + Utils.\Bl{GetConstant}(\Br{@const});
        \Bf{elseif} \Br{@op} == \Bl{7}
          z = z\^{}\Bl{2} - Utils.\Bl{GetConstant}(\Br{@const});

I have tried every work-around I could come up with but cannot get fancyvrb to use any thing but it's hard coded default or alternatives it provided for. The manual says that:

Fonts fontfamily (family name) : font family to use. tt, courier and
helvetica are predefined (Default: tt).

I have tried helvetica, but then I run into the problem of differing character sizes of one font versus another. I want to use SourceSansPro-Regular.ttf but have not determined how. In my attempts, I have tried all variants of the fonts name:

    Family:              Source Sans Pro
    Subfamily:           Regular
    Full name:           Source Sans Pro Regular
    PostScript name:     SourceSansPro-Regular

None of these make the slightest difference. I believe the clue lies in the word 'predefined.' I did not see any API to accomplish this—the methods given did not effect any change.

If I could change the font, everything else works the way I want it. This is an effort to prototype a semi-'listings' environment. The language (Ultra Fractal's formula language) in question fits no parser otherwise available.

I'm using MikTeX 2.9 under Windows 11 (bleeding edge), the font family is available at https://fonts.google.com/specimen/Source+Sans+Pro


This is described in the fontspec documentation in 4.2 Specifically choosing the NFSS family:


  • 1
    Looked at that and totally misconstrued the 'NFSSFamily' as not being applicable...silly me! Thanks again @Ulrike!
    – hsmyers
    Aug 15 at 15:43

Your Answer

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

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