Fonts & Character SetsHow can I use a font in latex

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

How can I use a font in latex

Post by localghost »

No, that doesn't help. The relevant information comes from the package manager of your Linux distribution. Post the output of the line below which you have to enter in a terminal. (Fedora should also rely on the RPM package management system.)

Code: Select all

rpm -qa | grep latex
The output on my machine looks like this.

Code: Select all

texlive-latex-doc-2009-38.1.noarch
texlive-bin-latex-2009-39.1.x86_64
texlive-latex-2009-38.1.noarch
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

How can I use a font in latex

Post by frabjous »

Out of curiousity, is Xe(La)TeX installed? Open a terminal and type:

xelatex -v

and see what happens. If so, you could probably use whatever system fonts you have installed with XeLaTeX and the fontspec package. (I doubt any system would come with xelatex but not fontspec.)

Another option would be to do a FULL installation of TeXlive 2009 on top (or in place of) whatever, bypassing your distro's package manager altogether, using the instructions here. This would come with all the fonts from the catalogue. The drawback is that it might create some difficulty using other fedora packages that have LaTeX as a dependency.

I think the best place to get advice on this would be in the fedora forums.
tilfaeldig
Posts: 2
Joined: Wed Jan 13, 2021 4:37 am

How can I use a font in latex

Post by tilfaeldig »

**** Premises for this post ****

As I believe I very much understand - not only - the title of this thread - but -
also the 'place' the person asking the question were at;
I now felt it might be an idea to sum up
- so that a future 'me' or others might get faster onwards ! :)


I've used LaTeXila running on a Raspberry Pi doing my 'research'


So
- I've read this thread several time
- some of the 'places' it points to
- and some other 'stuff' as well

I still have a lot to learn about how to change- & use other fonts in LaTeX


My intend here is not to recap all there is to know about how to use various fonts in LaTeX
- nor to explain the technicalities of it all -
merely giving that basic starting point were one would know enough to explore further on with ... ease ?
- or at least get starting experimenting for one self getting some output with ease

THUS this post is the post I would have liked to read knowing;
NOT _that_ much about all the glorious finer details of LaTeX

**** / ****




**** A VERY basic 'introduction' on how to 'tame' the use of fonts in LaTeX ****

The fonts(2) that works out of the hat with LaTeX have been prepared to do just so in another way than
fonts(1) that have been prepared to work with ones operating system(OS) for the computer.


Fonts (2)
As mentioned previously in this thread; here: https://tug.org/FontCatalogue/alphfonts.html is a good place to go
- I've looked at it several times and I to didn't realized that one gets information on how to use a specific font when clicking on it.

It seems that if one use a font from there that then become the default in ones document;
it only works when building the PDF output using LaTeX
- one can recognize those as they have »\normalfont« as style example like the font Bookman https://tug.org/FontCatalogue/bookman/
If one build using XeTex then apparently LatinModern ? is set as default
(I've yet not figured out if it is possible to use another font with »\normalfont« as style example when building the PDF with XeTeX - without re-defining commands !)

In contrast a font like Bbold https://tug.org/FontCatalogue/bbold/ have »\bbfamily« as style example

If one comment out all in the example below relating to XeTex - and build using LaTeX - then one can test out;
how to have Bookman, Bera or LatinModern as default font (depending which one is not commented out)
and 'mix' in Bbold when one see fit.
_obviously_ one get Bbold as default if starting out with it's switch »\bbfamily« and never change to »\normalfont«

'Native' font(S) for LaTeX I find simply searching for »texlive font« in Synaptic (a package manager for Debian based GNU/Linux)
A specific font(Bbold) I see at Tug and I like to use I search for with »texlive bbold«
So if I have installed »texlive-fonts-extra« I then have the font Bbold present in my TeX-installation
... or I could try finding out how to see it directly in my file- hierarchy ;O
(Now you try to see if you have the 4 fonts mentioned above installed ? ...)


Fonts (1)
The fonts coming with your OS or fonts you find elsewhere (outside of LaTeX) you can use if;
you enable the package »{fontspec}« and have »texlive-latex-recommended« & »texlive-xetex« installed
- I recommend to read package-documentation https://www.ctan.org/pkg/fontspec
'Obviously' you would _have_ to figure out what fonts your OS have
- AND where they're stored on your specific system in order to add fonts there you find elsewhere ...

With LaTeXila one needs to enable building PDF with XeTeX via the »Manage Build Tools« found in menu »Build«
and obviously build with XeTeX rather than LaTeX ;P

It should be clear in the below example what part(S) relate to XeTeX so you can
- try out on your own with YOUR fonts(1)
- comment it out if you like to try out fonts(2) for LaTeX instead

If not ... then you should await till you have more basic knowledge of how to work with LaTeX ? :)

**** / ****




**** Building with XeTeX on my 'system' this is the output I get
English version.pdf
(13.39 KiB) Downloaded 134 times
with the below - that isn't the down-the-shelf-Minimal-Working-Example !
- it's meant to be studied, changed and corrected in your ways so you'll learn BOTH of the 2 approaches ! :) ****


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% *compiling* of LaTeX with non-TeX fonts .otf .ttf ->

% *build* using »xetex« -> PDF
% - package {fontspec} doesn't *work* with »pdflatex«

%%%%% <- *compiling* Of LaTeX with non-TeX fonts .otf .ttf
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%




\documentclass{article}


\usepackage[utf8]{inputenc}


% This font have its 'own' switch: \bbfamily
% - and works both with »xetex« & »pdflatex«
\usepackage{bbold}

% The following fonts works as \normalfont ONLY if build with »pdflatex«
% - build with »xetex« then {lmodern} apparently is always used
%\usepackage{lmodern}
%\usepackage{bera}
\usepackage{bookman}


\usepackage[T1]{fontenc}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% *works* only with »xetex« ->

% Make it possible to use non-Tex fonts
% - with the below definitions
\usepackage{fontspec}


% Font Data70.ttf is 'installed' in
% - /usr/share/fonts/truetype
% - /home/raspi/.fonts

% Definé \SH as a switch
\newfontfamily\SH[Ligatures=TeX]{Data70.ttf}
% Definé \textSH as a text-style
\DeclareTextFontCommand{\textSH}{\SH}

%%%%% <- *works* only with »xetex«
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{document}


Here is the `normal' font.


\bbfamily

Lorem ipsum


% *works* only with »xetex«
\textSH{Så @ prøver vi tegn ff f\mbox{}f,.}

Mere Lorem ipsum


% *works* only with »xetex«
\SH

And yet another switch

{\normalfont Roman font selected here}

test


\normalfont

and then back to `normal' font.




\end{document}
Post Reply