4

I'd like to change the font of the entire document to Helvetica. However, as the title says, \renewcommand{\familydefault}{\sfdefault} only changes the font in bold. The rest remains as is. What should be done to fix this partial change and have the whole document to be in Helvetica? Thanks in advance.

  • 1
    Show an complete example document that demonstrates the problem. – Ulrike Fischer Jan 25 '16 at 18:01
  • 2
    it will not change the font at that point, only from the next font change. add \normalfont if you want the font to change at the point that you make this declaration. – David Carlisle Jan 25 '16 at 18:14
  • @David Carlisle, that seems to work but you have to have it interspersed randomly here and there in the text, where needed. Also, math isn't changing font. – ganzewoort Jan 25 '16 at 18:41
  • @ganzewoort sorry it is impossible to guess what you have done if you do not show any example. helvetica is not a math font and in any case changing the default text font will not affect math at all. – David Carlisle Jan 25 '16 at 18:44
  • note that \sfdefault is not helvetica (unless you have other commands that you have not shown to make it helvetica) it is computer modern sans serif with its initial definition. – David Carlisle Jan 25 '16 at 18:46
5

It will not change the font at that point, only from the next font change. add \normalfont if you want the font to change at the point that you make this declaration.

| improve this answer | |
  • What do you mean at the point of declaration? In the preamble? I added \usepackage{helvet} and \renewcommand{\familydefault}{\sfdefault} like Hugh said below and it seems to work. Is that ok? How would I change the Jupyter code cell font? And what kind of fonts are recommended for notebook typography? – TokyoToo May 28 at 9:18
  • I want to change this imgur.com/TvqB5Mc – TokyoToo May 28 at 9:36
5

Write

\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

In your preamble.

| improve this answer | |
  • OMG I've been looking for these posts for days. Nothing on StackOverflow in detail about customizing the PDF fonts and styling for Jupyter Notebook and nbconvert when exporting to PDF. So I followed your directions and now all is beautiful with sfdefault. Next....This did not change the super ugly fonts in the code cells. Especially the python comments. The PDF is using the horrendous cursive fonts. Please tell me how to change that. I am in the same article.tplx file now. Is it easy? Please add it to your answer. Many people are looking for this. Thanks! – TokyoToo May 28 at 9:13
  • I want to change this atrocity. imgur.com/TvqB5Mc – TokyoToo May 28 at 9:36

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.