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 Linux. I'd discovered that is possible to run lualatex and use my system fonts. Well, I'm trying to see how they look like.

Here is my sample:

\documentclass[11pt,a4paper]{amsart}
\usepackage[math]{fontspec}
\usepackage{unicode-math}
\setmathfont{Asana-Math.otf}
\usepackage{fontenc}
\setmainfont{Droid Serif}
\begin{document}
\[(D_e\Phi_{\gamma(s)})^{-1}(\gamma'(s))=\varphi'(s)(D_e\Phi_{\alpha(\varphi(s))})^{-1}(\alpha'(\varphi(s)))\]
\end{document}

After running fc-list I just copy some font name and use it on \setmainfont, like above.

My question is: how to be sure that I'm doing this for text and math fonts? When I change as above does the math fonts change accordingly? How to test the math fonts also? How to list all the other otf fonts to use in \setmathfont?

share|improve this question
5  
do not use fontenc and fontspec together. with LuaLaTeX and XeLaTeX use fontspec, with anything else, use fontenc –  ArTourter Dec 22 '12 at 1:13
1  
read "texdoc fontspec" there are a lot examples. And also "texdoc unicode-math" for the math fonts –  Herbert Dec 22 '12 at 7:48
1  
Read texdoc lualatex-doc. –  Martin Schröder Dec 22 '12 at 12:32
    
@ArTourter Please write a short answer. –  lockstep Dec 23 '12 at 12:33

1 Answer 1

up vote 6 down vote accepted

As I mentioned in my comment, you should only use one of fontspec or fontenc. Basically fontspec is to be used with LuaLaTeX and XeLaTeX, whereas fontenc is to be used with the other engines (LaTeX, pdfLaTeX,...).

Regarding which font are available on your system, fc-list only gives you the list of the font that fontconfig knows about (those in /usr/share/fonts/ and ~/.fonts/), that is the one your Linux distribution can see. However it will not list the font that came with your LaTeX distribution as usually , the TeX distribution does not add these fonts to the system path. This is why fc-list will not show you Asana Math.

There is however a command that LuaLaTeX runs to scan your system and find out which font are accessible: mkluatexfontdb. You can run this command yourself and it will create a file in: ~/.texlive2012/texmf-var/luatex-cache/generic/names/otfl-names.lua which list all the fonts (system or not) which LuaLaTeX can see. (LuaLaTeX will run this command automatically the first time you run it and every time you try to use a font it doesn't know about (in case you added it since).

With LuaLaTeX, it is also possibly best not to use the font file name and rather use the actual font name. This is because in most cases, the different shapes and series are located in a different file. Although this is not the case with Asana Math it is I think a good habit to take. (A note here though is that if you want to use font that are provided by the TeX distribution currently have to be called via their filename when using XeLaTeX, which is not the case with LuaLaTeX)

In your case, you can easily call

\usepackage{unicode-math} %as noted in the comments this will load fontspec as well
\setmathfont{Asana Math}
\setmainfont{Droid Serif}

note that the [math] option to the fontspec package is not necessary at it is the default. However since you are using unicode-math you may want to use the [no-math] option. Indeed the fontspec documentation says

By default, fontspec adjusts LATEX’s default maths setup in order to maintain the correct Computer Modern symbols when the roman font changes. However, it will attempt to avoid doing this if another maths font package is loaded (such as mathpazo or the unicode-math package). If you find that fontspec is incorrectly changing the maths font when it should be leaving well enough alone, apply the [no-math] package option to manually suppress its maths font.

Although I do find that unicode-math is very good and simplifies nicely the use of OTF/TTF for typesetting maths, I should also mention that it is not actually necessary since fontspec also has the \setmathrm, \setmathsf, \setmathtt and \setboldmathrm commands. But since the font you are planning on using contains all this, using \setmathfont is a better solution.

share|improve this answer
    
loading unicode.math is enough, it loads fontspec itself. –  Herbert Dec 23 '12 at 17:32
    
Thanks @Herbert for this, I had not realised that. These days I tend to use lualatex exclusively so by default I will load fontspec. but I don't always use unicode-math so I got in the habit of adding it to my default setup when needed. Looking as the unicode-math source, fontspec is loaded without options so if one need to use the [no-math] option, one need to make sure that fontspec is loaded before unicode-math, or one use the \PassOptionsToPackage{}{} command instead. –  ArTourter Dec 23 '12 at 18:36

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.