5

I know the font has support for the greek language. Are those characters accessible in pdfLateX?


MWE

\documentclass{article}
\usepackage[utf8]{inputenx}
\usepackage[english,greek]{babel}
\usepackage[default]{sourcesanspro}
\usepackage[T1]{fontenc}
\begin{document}
α a $\alpha$
\end{document}

gives me the following error (caused by the greek option for babel):

miktex-makemf: The grtm source file could not be found.

Running hbf2gf.exe...


hbf2gf (CJK ver. 4.8.3)



Couldn't find `grtm.cfg'

miktex-maketfm: No creation rule for font grtm10.

! Font LGR/ptm/m/n/10=grtm10 at 10.0pt not loadable: Metric (TFM) file not foun
d.
<to be read again> 
                   relax 
l.2 \select@language{greek}

EDIT:

Errata corrige: the following code does not print any letter in Source Sans.
I've mistaken upright greek CM for Source Sans...

Note that

\documentclass{article}
\usepackage[utf8]{inputenx}
\usepackage[default]{sourcesanspro}
\usepackage[LGR]{fontenc}% changed the encoding
\begin{document}
α a $\alpha$
\end{document}

prints the greek letters (the first two in Source Sans, the third one in CM), but the "a" is now an alpha, too.

  • Is this a free font? If not, you will have to use Xe- or LuaLaTeX. If yes, we (or you) will have to check, if there is some package containing it. What characters do you need? Just a couple or do you want to change the whole font? Please give an MWE showing what you are about to do and where you got stuck. – LaRiFaRi Jun 9 '15 at 15:02
  • 1
    There's support for Greek with the font only under XeLaTeX or LuaLaTeX and fontspec, as far as I know. Generating the font metric files for Greek, together with the .fd files for Greek support is not conceptually difficult, but requires time and expertise in usage of otftotfm. – egreg Jun 9 '15 at 15:08
  • Yep it's free. I've added a MWE. I just want to be able to write those characters. For math mode then I'll try using sansmath. I've been able to write them by using \usepackage[LGR]{fontenc}, but this causes the "a" to be read as an alpha. – Arch Stanton Jun 9 '15 at 15:09
4

The problem

Currently, Source Sans Pro does not come with the LGR encoding. This means that when you run your second MWE, the following errors are shown:

LaTeX Font Warning: Font shape `LGR/SourceSansPro-LF/m/n' undefined
(Font)              using `LGR/cmr/m/n' instead on input line 6.

LaTeX Font Warning: Some font shapes were not available, defaults substituted.

Solution: LGR for Source Sans Pro

I've built the font with the LGR encoding. Your MWE now results in the following:

three alphas

What you see here is the correct behaviour: the LGR encoding only includes Greek symbols.

This really needs more testing, for which I have created a branch. From there you can also download Source Sans Pro with LGR support.

Finally, to get the result you want, you need to switch font encoding halfway:

\documentclass{article}
\usepackage[utf8]{inputenx}
\usepackage[default]{sourcesanspro}
\usepackage[OT1,LGR]{fontenc}% changed the encoding
\begin{document}
α {\fontencoding{OT1}\selectfont a} $\alpha$
\end{document}

alpha a alpha

Alternate solution: XeLaTeX

Running this with XeLaTeX does result in the expected behaviour:

\documentclass{article}
\usepackage[greek,english]{babel}
\usepackage[default]{sourcesanspro}
\begin{document}
α a $\alpha$
\end{document}

alpha a alpha

You can also change the Math font with mathspec:

\documentclass{article}
\usepackage{mathspec}
\usepackage[default]{sourcesanspro}
\defaultfontfeatures
    { Ligatures      = TeX ,
      Numbers        = Proportional ,
      Extension      = .otf ,
      UprightFont    = *-Regular ,
      ItalicFont     = *-RegularIt ,
      BoldFont       = *-Bold , 
      BoldItalicFont = *-BoldIt }
\setmathfont(Digits,Latin){SourceSansPro}
\setmathfont(Greek)[Lowercase = Regular]{SourceSansPro}
\defaultfontfeatures{}
\begin{document}
α a $\alpha$
\end{document}

Greek has been set to regular (ie: not italic) because Source Sans Pro lacks Greek italics.

alpa a better alpha

  • I'm very sorry! The naming of the files brought me to think they were Bob's. – egreg Jun 10 '15 at 11:38
  • egreg: Don't worry about it! Bob's packages are quite similar to mine (or the other way round) and he has a lot of font packages. – Silke Jun 10 '15 at 11:51
2

Short answer

There's currently no support for Greek letters from SourceSans Pro in pdflatex.

Longer answer

If I compile your example (the one in the errata-corrige section), I get the warning

LaTeX Font Warning: Font shape `LGR/SourceSansPro-LF/m/n' undefined
(Font)              using `LGR/cmr/m/n' instead on input line 5.

which means that the LGR+cmr family fonts are used, and not the unavailable LGR+SourceSansPro-LF family.

SourceSans Pro is released as an OpenType font family (twelve font files); Silke, also the maintainer of other font packages for pdflatex, has prepared font metric and PFB files for use with pdflatex, but only provides the fonts for the OT1, T1, TS1 and LY1 encodings. The LGR encoding necessary for Greek is not provided.

It's not conceptually difficult to prepare the required files (TFM, VF and PFB) also for the LGR encoding, but it requires expertise in usage of otftotfm and time.

As far as I know, Silke is very keen on feature requests and bug reports; however releasing LGR support for his font families might reveal too burdensome.

At the moment, only XeLaTeX can provide support for what you're asking, via mathspec and hard work.

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.