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 have a problem using my own OTF fonts within a LaTeX document. I read I should compile the document with xelatex which I have installed on my Mac with MacPorts (package texlive-xetex)

My minimal document looks like this:

\documentclass{article}

\usepackage{fontspec}
\setmainfont{Arial}

\begin{document}
    Lorem ipsum
\end{document} 

Compiling it via xelatex test.tex I get the following errors:

This is XeTeX, Version 3.1415926-2.4-0.9998 (TeX Live 2012/MacPorts 2012_5)
 restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, lo
aded.
(/opt/local/share/texmf-texlive-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/opt/local/share/texmf-texlive-dist/tex/latex/base/size10.clo))
(/opt/local/share/texmf-texlive-dist/tex/latex/fontspec/fontspec.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/expl3.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3names.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3bootstrap.sty))
(/opt/local/share/texmf-texlive-dist/tex/latex/etex-pkg/etex.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/graphics/color.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/latexconfig/color.cfg)
(/opt/local/share/texmf-texlive-dist/tex/xelatex/xetex-def/xetex.def))
(/opt/local/share/texmf-texlive-dist/tex/latex/graphics/graphics.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/graphics/trig.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/latexconfig/graphics.cfg))
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3basics.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3expan.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3tl.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3seq.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3int.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3quark.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3prg.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3clist.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3token.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3prop.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3msg.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3file.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3skip.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3keys.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3fp.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3box.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3coffins.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3color.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/l3kernel/l3luatex.sty))
(/opt/local/share/texmf-texlive-dist/tex/latex/l3packages/xparse/xparse.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/fontspec/fontspec-patches.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/base/fixltx2e.sty)
*************************************************
* LaTeX warning: "xparse/redefine-command"
* 
* Redefining document command \oldstylenums with arg. spec. 'm' on line 107.
*************************************************
) (/opt/local/share/texmf-texlive-dist/tex/latex/fontspec/fontspec-xetex.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/base/fontenc.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/euenc/eu1enc.def)
(/opt/local/share/texmf-texlive-dist/tex/latex/euenc/eu1lmr.fd)kpathsea: Invalid fontname `[lmroman10-regular]', contains '['

! Font EU1/lmr/m/n/10=[lmroman10-regular]:mapping=tex-text at 10.0pt not loadab
le: Metric (TFM) file or installed font not found.
<to be read again> 
                   relax 
l.100 \fontencoding\encodingdefault\selectfont

What am I doing wrong? I also tried to specify the whole path to my font with \setmainfont[Path=/Absolute/Path/To/My/OTF/Font/]{file.otf} in the preamble.

Although I would prefer using pdftex instead of xelatex because I read that xelatex comes with some disadvantages and I do not want to install it on every computer I use it. Is there a good solution for using OTF fonts with pdftex?

share|improve this question
    
An answer to your question was submitted some time ago, please consider marking the answer as ‘Accepted’ (see How do you accept an answer?) or explain why the answer given did not answer your question. –  Silex Jan 26 '13 at 14:22
add comment

1 Answer 1

up vote 3 down vote accepted

What am I doing wrong?

The Minimum Working Example you provided is the correct way to use OpenType fonts with LaTeX. However, you're probably missing some part of TeX Live.

The solution would be one of the following:

  • Install MacTeX.
  • Install the following MacPorts packages: texlive-basic, texlive-fonts-extra and texlive-fonts-recommended.

I recommend the first option, but the second one should also work (if you really want to do this through MacPorts).

Is there a good solution for using OTF fonts with pdftex?

Unless you want to convert them to Type 1 fonts, I'm afraid not. Luckily there are a lot of people doing the converting for you. You can find a lot of fonts that can be used for pdfLaTeX in The LaTeX Font Catalogue.

share|improve this answer
    
I second this advice. I'm not quite sure why you've installed the MacPorts version of TeX; you'll probably have far fewer headaches with the regular MacTeX distribution. That being said, XeTeX assumes that your fonts are in the usual place for fonts on the Mac: either /Library/Fonts or ~/Library/Fonts. But the error you're getting is because you're missing fonts in your distribution as Silex notes in the second bullet point. –  Alan Munn Jan 16 '13 at 1:42
    
You were right, I really was missing one of the packages you listed above. Thank you! :) –  Jan Mar 13 '13 at 14:38
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.