# Change font

 x945 Sep 4, 2015 at 4:32 AM How can I change the font of the document not just a piece of text but the whole document.? daan Coordinator Sep 7, 2015 at 4:10 PM Use a metadata rule on the `body` element: At the start of the document, write: ``~Body: font-family="Verdana"`` Of course you can also use CSS directly, or for Latex some latex command. martschn Nov 26, 2015 at 8:34 AM I fail to change the font in the PDF to 'sans-serif' for the whole document. I get it for HTML with the ~Body: ... metadata rule, but this fails to work for the PDF ? Thats what I have in the preamble: ``````Title : The Title Author : martschn Document Class : [11pt] article Package : tgheros Tex Header : \renewcommand*\familydefault{\sfdefault} ~Body { font-family: 'sans-serif'; } [TITLE] # First heading And then the content of the article`````` The Tex Header gets imported into the .tex file correctly but without changing the default font to sans-serif Perhaps someone can help? martschn Nov 26, 2015 at 11:44 AM Addition to my previous post: If I compile the generated .tex file, the PDF has the correct sans-serif in the whole document. But if I compile it from within Madoko (local) with Alt+L it fails to use the sans-serif. martschn Nov 27, 2015 at 3:58 PM And another addition: The problem is solved. I added ``Package : [T1]{fontenc} `` to the header (see above) and now the PDF has the desired sans-serif. Perhaps the German Umlaute made some confusion ...? daan Coordinator Dec 2, 2015 at 7:32 PM Edited Dec 29, 2015 at 11:35 PM Ha, that is strange. I will look into it. Also, Madoko use the `fontspec` package by default so changing the main font in LaTeX should be done like: ``````Tex Header: \setmainfont{Helvetica}`````` or something. However, setting the `font-family` on the body element should do the trick -- I will look what caused the trouble. It may have to do with the particular font you selected; i.e. the `tgheros` package that still uses an old-style `T1` encoded font. You can select this font directly if you know the LaTeX font name -- in this case for `tgheros` it is `qhv`. Try: ``````body { font-family: tex-family-T1/qhv,sans-serif; }`````` This selects the right font in LaTeX. You can read more about LaTeX font specifications here.