5

This is a continuation from a problem I posted a long time ago, I keep coming back to it and still can't find a solution.

I have downloaded the minion pro font. If I have the files in the directory of the document I am compiling then there is no issue. If, however, I try I put the files somewhere else and specify a path then all sorts of problems crop up.

MWE of compiling fine:

\documentclass[12pt,titlepage]{article}
\usepackage{blindtext}
\usepackage{fontspec}
\setmainfont[]{MinionPro-Regular.otf}
\begin{document}
I am writing words with my hands
\end{document}

MWE of a problem compile

\documentclass[12pt,titlepage]{article}
\usepackage{blindtext}
\usepackage{fontspec}
\setmainfont[Path=~/Documents/LaTeX-fonts/]{MinionPro-Regular.otf}
\begin{document}
I am writing words with my hands
\end{document}

This causes the errors Missing \begin{document} and font cannot be found, as do all my other efforts.

I have tried specifying with and without Extension = .otf added, also removing '.otf. from within font specification.

Running ls ~/Documents/LaTeX-fonts/ in the terminal shows the files correctly.

If I have missed a link to a solution, or if anybody has any thoughts, it would be appreciated

2
  • 2
    Possibly Path=\string~/Documents/LaTeX-fonts
    – egreg
    Jun 26, 2017 at 20:02
  • @egreg, you are outstanding. I hadn't seen or thought of that before. Thank you very much
    – N.Crouch
    Jun 26, 2017 at 20:11

2 Answers 2

5

Recall that ~ is like a macro in LaTeX; in order to pass the “stringified” version to the OS, you need to prefix it by \string:

\documentclass[12pt,titlepage]{article}
\usepackage{blindtext}
\usepackage{fontspec}
\setmainfont[Path=\string~/Documents/LaTeX-fonts/]{MinionPro-Regular.otf}
\begin{document}
I am writing words with my hands
\end{document}
1

The same problem and solved, win10

DO NOT double click to install, it will install this font for the current user.

(however, it shows the font in windows/fonts/ too)

right-click the font file, choose install for all users.

if you already installed the font:

  1. go to windows/fonts/,

  2. copy it to somewhere else,

  3. right-click on it, and install for all users.

then enjoy:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{MinionPro-Medium}
\begin{document}
    ff g fhhhhh w \\

\end{document}

Ref: Package fontspec Error: The font cannot be found on win10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .