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.

I'm using XeTeX because I want to use some fonts from my system. The next should work (I think).

I have this:

\documentclass[a4paper,11pt,spanish]{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage{babel}

\font\reenie="ReenieBeanie"
\font\cuprum="Cuprum"

\renewcommand{\sffamily}{\reenie}
\renewcommand{\familydefault}{\cuprum}

\begin{document}
...
\end{document}

The compilation fails, although I get the document with the new font and some weird symbols arround it. What am I doing wrong?

share|improve this question
    
What exactly do you mean by "compilation fails"? And what weird symbols do you get? –  Jan Hlavacek Nov 7 '10 at 3:38
1  
This is an unrelated point, but you should probably use polyglossia rather than babel for XeLaTeX. –  frabjous Nov 7 '10 at 3:48
    
In addition to Jan answer below, I strongly encourage you to read fontspec manual if you want to play with fonts in XeTeX/LuaTeX. –  Khaled Hosny Nov 7 '10 at 12:07
    
When I asked this question, It was my first time playing with XeTeX. After Jan's answer I read the fontspec manual. It's a great package (and I think should be part of XeTeX). –  Tomas Nov 8 '10 at 4:38
add comment

1 Answer

up vote 3 down vote accepted

If nothing else, the use of \renewcommand* is pretty suspect. I always use the fontspec package to select font. See if this works:

 \documentclass[a4paper,11pt,spanish]{article}
 \usepackage[margin=2.5cm]{geometry}
 \usepackage{babel}
 \usepackage{fontspec}

 \setsansfont{DroidSans}
 \setmonofont{DroidSansMono}


 \begin{document} 
 \ldots
 \end{document}
share|improve this answer
    
It doesn't work. It compiles but the text is missing. Is fontspec XeTeX specific? –  Tomas Nov 7 '10 at 3:29
    
What system do you use? Which version of XeTeX/fontspec? Are there any messages you get from XeTeX during compilation that could be relevant to this problem? –  Jan Hlavacek Nov 7 '10 at 3:37
    
Yes, fontspec is XeLaTeX specific. Do make sure too that you pick fonts you actually have installed! –  frabjous Nov 7 '10 at 3:48
    
My fault. I was defining \font first when I should haven't. It does work now. –  Tomas Nov 7 '10 at 4:20
2  
@Tomas: Remember to actually try the example you post :-) –  Joseph Wright Nov 7 '10 at 7:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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