Fonts & Character SetsSelecting font does not work

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
alex2747
Posts: 18
Joined: Mon Apr 05, 2010 10:39 pm

Selecting font does not work

Post by alex2747 »

Hi,

I tried to select a different font in a Latex document the way it is described in the following document:

http://mirror.ctan.org/macros/latex/doc/fntguide.pdf

So I inserted the following two lines in my latex document:


\fontfamily{cmm}
\selectfont

in which I replaced cmm with phv, or pcr, as given as examples in the described document. But the font of the text in the created pdf document looks exactly the same.

Maybe I am missing something? Maybe I need to install different fonts? Or any other idea how I can select a different font in Latex?

Thanks
Alex

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Selecting font does not work

Post by frabjous »

Could you post a fully compiliable, short, sample code (or try mine below)?

cmm would not be noticeable, but personally if I do:

Code: Select all

\documentclass{article}
\begin{document}
\fontfamily{phv}
\selectfont
This is Helvetica.
\end{document}
I do get Helvetica.

But I really don't think you should need to use such low level font commands very often, but rather use the packages as described in the LaTeX font catalogue.

I know you're having trouble using those packages from your other thread (not sure why you started a new one), but most likely it's the same problem in both cases. Use your distro's package manager to install the necessary packages.

Or else switch to XeLaTeX. E.g.:

Code: Select all

\documentclass{article}
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}

\defaultfontfeatures{Mapping=tex-text}

\setmainfont{Linux Libertine O}
\setsansfont{Linux Biolinum O}
\setmonofont{DejaVu Sans Mono}

\begin{document}

This text is Linux Libertine.

\textsf{This text is Linux Biolinum.}

\texttt{This is DejaVu Sans Mono.}

{\fontspec{URW Gothic L} This is URW Gothic L.}

\end{document}
(Use font names installed on your system.)

compile with xelatex rather than pdflatex.
alex2747
Posts: 18
Joined: Mon Apr 05, 2010 10:39 pm

Re: Selecting font does not work

Post by alex2747 »

Never mind,

I think I will use openoffice when I am going to use a choice of fonts.

I really did not anticipate that choosing a font in latex is significantly more complicated than installing a new operating system on a laptop...


Alex
alex2747
Posts: 18
Joined: Mon Apr 05, 2010 10:39 pm

Re: Selecting font does not work

Post by alex2747 »

BTW,

the simple example on choosing Helvetica worked! (And was the most useful reply so far to my question of how to select a font in Latex).

But is Helvetica the only font I can chose? Are there more? What do they look like? Is there a list? Can I create my own list? Does this depend on the installation..?


Cheers
Alex
magicmoose
Posts: 90
Joined: Fri Nov 06, 2009 7:29 am

Selecting font does not work

Post by magicmoose »

There is a list -- see The LaTeX Font Catalogue.

Did using XeLaTeX and Fontspec work for you? I use it quite often and it works really well for me.
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Selecting font does not work

Post by frabjous »

Actually, if you're not using the newest version of OpenOffice, you may find trouble using opentype fonts with it too. I doubt it's upstreamed to fedora yet.

Anyway, if what I did with Helvetica worked, chances are you could use any of the core ps fonts. There's a list in this PDF (page 9), though the document also describes using the appropriate packages for these fonts, which is appropriate, if available.

I know you've already seen the LaTeX font catalogue. It should be as easy as following the instructions given there for any font you want to use. If that's not working for you, the problem is more serious than just a font problem. It means that your TeX installation is woefully incomplete, in which case font usage is going to be the least of your problems.

If you installed TeX through the package manager for your linux distribution, you need to check if they've bundled together extra plug-in packages for adding on to it. (I think I saw a fedora package called texlive-texmf which may be a start...) If they haven't you'll need to switch to installing a full TeX system manually, as I described in your other thread.

So long as you use fonts for which there are already packages, font selection is not really any harder than anything is in LaTeX, or at least it shouldn't be. And it's even easier with XeLaTeX, but you haven't mentioned trying that.
Post Reply