Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

I'm brand new to TeX and am making my first beamerposter. I'm using XeLaTeX and I like the package pxfonts for the math and the body text. However, I'd like to have sans serif text in the block headers, and I don't like the default sans serif font that results from the pxfonts package. Can someone explain to me, in simple terms, why I cannot use the package fontspec to modify the sans serif font after I have loaded pxfonts? And what should I use instead?

Consider the code below. How can I change the font of the sans-serif part while keeping the first paragraph and the equation as they currently appear?

\documentclass[11pt]{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{pxfonts}

\begin{document}
\blindtext

\[
\int_0^1 x^2 \, dx = 1/3
\]

\sffamily \blindtext %This is the text whose font I wish to change to something already loaded on my computer.
\end{document}

mwe

share|improve this question

marked as duplicate by ChrisS, Svend Tveskæg, Sean Allred, Jesse, egreg Apr 23 at 22:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Can you add an example of code? –  egreg Apr 22 at 21:40
    
@egreg Actually the whole beamerposter context is unimportant. Really I just want to know how to switch between the serif and sans-serif font...without having to use the default sans-serif font provided by pxfonts. –  user1577636 Apr 22 at 23:20
    
The content is unimportant, but it's easier for us to have some code to play with, rather than starting from scratch. –  egreg Apr 22 at 23:22
    
@egreg Alright, does this edit help? –  user1577636 Apr 22 at 23:33
1  
That site is mistaken if you have TeX Live. I don't know about MiKTeX. If you have TeX Live, you can install it by running getnonfreefonts-sys and selecting the appropriate package. The script will handle the installation etc. Optima cannot be distributed as part of TeX Live. –  cfr Apr 23 at 2:02

1 Answer 1

You can install Optima by running getnonfreefonts-sys and selecting the appropriate package if you have TeX Live. Once the font is installed you can use this:

\documentclass[11pt]{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{pxfonts}
\renewcommand{\sfdefault}{uop}

\begin{document}
\blindtext

\[
\int_0^1 x^2 \, dx = 1/3
\]

\sffamily \blindtext %This is the text whose font I wish to change to something already loaded on my computer.
\end{document}

Palatino with Optima

share|improve this answer

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