XeTeXBeamer, customized font control - how?

Information and discussion about XeTeX, an alternative for pdfTeX based on e-Tex
Post Reply
HeltTEXas
Posts: 3
Joined: Thu Dec 30, 2010 4:17 pm

Beamer, customized font control - how?

Post by HeltTEXas »

I have a few questions concerning font specification for the beamer-document-class using XeTeX.

I want to seperately specify fonts for title, author and the normal text used in the slides.

I'd like to know the following:
- the command used to specify the base font Is it setsansfont? setmainfont? No luck with those so far.
- Which names that identify the font I want to use, that has to be placed in between the curly braces after \usepackage{} or how to find these names on my system.
- Which names to put between the {} of the base font specifier. Till Tantau's guide to the Beamer class from CTAN speaks of families, series and so on. How do I know if I should use the name of a family, a series, and how do I know if a name is a family-name or a series-name?


Some more information:
I have created a minimal example, where I use brushscript-x-italic as the title (see attachment, or code below). I just assumed \bsifamily was what I had to enter, by looking at the entry in the LaTeX font catalogue. That worked. But for the base font, I have no clue.

I tried to change the base font by combinations of \usepackage{presumed package name} and \setsansfont{presumed name}, like in the example here, but it didn't work out. I have installed all the extra fonts packages for my linux-pc. I get the error that verdana.sty can't be found, when I specify it in \usepackage (I guess this must be due to verdana not being a part of the texlive-installation) and I receive an error when I attempt to omit \usepackage, just specifying verdana like \setsansfont{verdana} in the preamble.

\usepackage{arev} with \setsansfont{arev} doesn't work either.

Can anyone give me a pointer, preamble, faulty installation, wrong higher-order declarations?
Attachments
beamertest.tex
(316 Bytes) Downloaded 571 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
HeltTEXas
Posts: 3
Joined: Thu Dec 30, 2010 4:17 pm

Beamer, customized font control - how?

Post by HeltTEXas »

I am looking at the fontspec documentation, and as a last resort, I am attempting to load fonts by their .otf extension.

Not a "#¤% chance, XeLaTeX just gives me a lot of complaints.

What is wrong with this file???????

Code: Select all

\documentclass[13pt]{beamer}
\usepackage{fontspec}
\usepackage{pbsi}
\setbeamerfont{title}{family=\bsifamily,size=\Huge}
\setmainfont{/usr/share/texmf-texlive/fonts/opentype/public/libertine/fxbr.otf}
\title{The Best Beamer Presentation EVER}
\begin{document}

\frame{\titlepage}

\begin{frame}
I just had to write something here as well
\end{frame}
\end{document}
~                 
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Beamer, customized font control - how?

Post by frabjous »

With XeLaTeX, I'd stick to fontspec commands, and try to steer clear of other things, like loading other font packages.

Perhaps this will give you the idea.

Code: Select all

\documentclass{beamer}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}

% use main font for base text
\usefonttheme{serif}

% font for base text
\setmainfont{Verdana}

% font for title
\setbeamerfont{title}{family=\fontspec{DejaVu Sans}}

% for other elements on title page (author, date)
\setbeamerfont{title page}{family=\fontspec{Linux Libertine O}}

\title{The Best Beamer Presentation EVER}
\author{John Doe}
\begin{document}

\frame{\titlepage}

\begin{frame}
I just had to write something here as well I did
\end{frame}
\end{document}
You need to use the serif beamer fonttheme if you want fontspec's \setmainfont to affect it. Otherwise, beamer uses the sans font. (I suppose you could use \setsansfont instead.)

For the \setbeamerfont command, send a \fontspec{Name of Font} command for family=. The Name of the font should be the exact name of the font, and case is important, so you probably need to watch case. It's probably "Verdana" with a capital "V", not "verdana". (I'm not sure about this, since I don't have it installed. Trying to keep my linux PC a "Microsoft-free" zone.)

If you want a list of the font names, you can use, open a terminal and type in:

Code: Select all

fc-list | cut -d":" -f1 | tr ',' '\n' | sort | uniq
I think that should work for most linuxes.
HeltTEXas
Posts: 3
Joined: Thu Dec 30, 2010 4:17 pm

Beamer, customized font control - how?

Post by HeltTEXas »

Ok, first of all, there was a system-install glitch that almost made me tear my nuts off. I found a solution at ubuntuforums. Summarized, I had to copy the part of my fonts tree containing the opentype and truetype fonts to a local folder you have to create, named .fonts ( /home/myuser/.fonts). Then update the cache with sudo fc-cache -f -v.

I found the names having to be typed into the {curly braces} by clicking on the .otf files, up comes a window with font-example-pics and a name. NOW I managed to get linux libertine up and going, and so far, all available fonts in .otf.

Just as I was wondering how to get around the beamer commands - you came in with your EXCELLENT post, and gave me the final commands I was searching for.

There are still things I don't understand about families, series, what to enter where, but for now, I will be sticking to the xetex-syntax. Now I can make an awesome slideshow!!!

Awesome! Thanx!! :D :D (The orgasm after 7+ hours of working) =)
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Beamer, customized font control - how?

Post by frabjous »

HeltTEXas wrote:Ok, first of all, there was a system-install glitch that almost made me tear my nuts off. I found a solution at ubuntuforums. Summarized, I had to copy the part of my fonts tree containing the opentype and truetype fonts to a local folder you have to create, named .fonts ( /home/myuser/.fonts). Then update the cache with sudo fc-cache -f -v.
Placing font files in ~/.fonts or /usr/share/fonts and running sudo fc-cache -fv is the normal way of installing fonts on Linux. There are GUI programs for automating this, but they're just doing the same thing under the hood.

Or did you mean specifically the ones that came with the TeXlive install? There are instructions for this in the TeX Live Documentation here. Usually I don't bother with this unless I really need one of those, though, since there are so many and they clog up the font selection menu everywhere else.
I found the names having to be typed into the {curly braces} by clicking on the .otf files, up comes a window with font-example-pics and a name. NOW I managed to get linux libertine up and going, and so far, all available fonts in .otf.
That should be the same name that the fc-list command I showed you produces. My way is just a faster way to get a list of all of them, but this way is fine too, especially if you want a preview.
Just as I was wondering how to get around the beamer commands - you came in with your EXCELLENT post, and gave me the final commands I was searching for.
Glad to help.
There are still things I don't understand about families, series, what to enter where, but for now, I will be sticking to the xetex-syntax.
Don't be afraid to ask. That's what the forums are for. If you stick with XeLaTeX and the fontspec commands it shouldn't be too bad, but fonts with regular LaTeX and pdfLaTeX can definitely get very tricky.
Post Reply