0

UPDATE

Not sure when it started working, but the steps I did were to 1.) fc-cache -v(r) and then add the path ...../texmf-dist/fonts/, 2.) then luaotfload-tool --update --verbose=. Not sure it was necessary but I then ran texhash and updmap -sys.


I am using Linux Mint, with new TeXLive (installed in special location) to try and compile this template I found. I've tried using the discussion in both, http://mirrors.concertpass.com/tex-archive/macros/latex/contrib/fontspec/fontspec.pdf and `How do I use a particular font for a small section of text in my document?'.

\documentclass{scrartcl}
\usepackage[nochapters]{classicthesis}
\usepackage[LabelsAligned,NoDate]{currvita}
  \renewcommand{\cvheadingfont}{\LARGE\color{Maroon}}
\usepackage{hyperref}
  \hypersetup{colorlinks,breaklinks,urlcolor=Maroon,linkcolor=Maroon}

\reversemarginpar

\newdimen\datebox
\newdimen\tempdima \tempdima0pt
\newdimen\maxdatedimen \maxdatedimen30pt%default value

\newcommand{\NewEntry}[2]{%
  \settowidth\tempdima{#1}%
  \ifdim\tempdima>\maxdatedimen%
   \global\maxdatedimen\the\tempdima\fi%
    \par\addvspace{0.5em}
    \noindent\hspace*{2em}%
    \parbox[t]{\datebox}{\strut\small\itshape #1}%
    \hspace*{1.5em}%
    \parbox[t]{\dimexpr\textwidth-2em-\datebox-1.5em+0em}{\strut #2}%
    \par\addvspace{0.5em}%
}

\newcommand{\MarginText}[1]{\marginpar{\raggedleft\itshape\small#1}}
\newcommand{\Description}[1]{%
  \par\noindent\hangindent=0em\hangafter=0
%  \par\noindent\hangindent=2em\hangafter=0
  {\noindent\ignorespaces\footnotesize #1\par}
%  {\raggedright\footnotesize #1\par}
  \vspace{1em}
  \par}

\usepackage{atveryend}

\makeatletter
\AtBeginDocument{%
  \settowidth{\datebox}{\hbox to \the\maxdatedimen{\hfil}}
  \maxdatedimen0pt}
\AfterLastShipout{%
  \if@filesw
    \immediate\write\@mainaux{%
      \global\string\maxdatedimen=\the\maxdatedimen\relax
    }%
  \fi}
\makeatother

\usepackage{fontspec}

% font file in same directory as .tex file
\newfontfamily\myfontt[]{FoglihtenPCS-068.otf}
\newenvironment{myfont}{\myfontt}{\par}

\usepackage{CormorantGaramond}
\newfontfamily\fMy[]{Cormorant Garamond Light}
\newcommand\fontMy[1]{{\fMy #1}}

\begin{document}

\begin{cv}{My name}\vspace{1.5em}

{\fontMy
Dear Human Resources,
}

\pagestyle{scrheadings}% using scrheadings page style

\section*{Personal Information}

\NewEntry{address}{XXXXX} 

\section*{Education}

\NewEntry{2015-2017}{{\myfontt \textbf{School of Data Analysis, Yandex}}}

\end{cv}

\end{document}

The template works fine but I wanted to use different fonts in various places. So, despite these two links being different ways to implement this (at least with syntax), I still couldn't get them to work - using for example Cormorant Garmond. I did add the extension and had fontspec so I can use the file name.

Perhaps I need to specify a search path explicitly? Or can I include an absolute path name to the file?

Here is the root of my TeXLive installation - /home/user/SW/TeXLive and the file I was looking for was found by;

X@X ~/SW/TeXLive/here/texmf-dist/fonts $ find . -name 'CormorantGaramond*.otf' -exec ls -Alrt {} \;
-rw-r--r-- 1 X X 775548 Nov 25  2016 ./opentype/catharsis/cormorantgaramond/CormorantGaramond-MediumItalic.otf
-rw-r--r-- 1 X X 780596 Nov 25  2016 ./opentype/catharsis/cormorantgaramond/CormorantGaramond-LightItalic.otf
-rw-r--r-- 1 X X 1129176 Nov 25  2016 ./opentype/catharsis/cormorantgaramond/CormorantGaramond-Regular.otf
-rw-r--r-- 1 X X 1135248 Nov 25  2016 ./opentype/catharsis/cormorantgaramond/CormorantGaramond-SemiBold.otf
-rw-r--r-- 1 X X 1119544 Nov 25  2016 ./opentype/catharsis/cormorantgaramond/CormorantGaramond-Bold.otf
-rw-r--r-- 1 X X 782440 Nov 25  2016 ./opentype/catharsis/cormorantgaramond/CormorantGaramond-RegularItalic.otf
-rw-r--r-- 1 X X 782208 Nov 25  2016 ./opentype/catharsis/cormorantgaramond/CormorantGaramond-SemiBoldItalic.otf
-rw-r--r-- 1 X X 1113548 Nov 25  2016 ./opentype/catharsis/cormorantgaramond/CormorantGaramond-Medium.otf
-rw-r--r-- 1 X X 760204 Nov 25  2016 ./opentype/catharsis/cormorantgaramond/CormorantGaramond-BoldItalic.otf
-rw-r--r-- 1 X X 1126740 Nov 25  2016 ./opentype/catharsis/cormorantgaramond/CormorantGaramond-Light.otf

The part of the MWE I'm trying to use is the stuff related to the Garamond font, just before the beginning of the document. I've had no real problems (despite some weird errors) using the other font, FoglihentPCS-068.otf, but that is because it is in the same directory - I'd rather use an absolute path.

I'm fine using either approach - an environment with \begin{myfont} \lipsum[3] \end{myfont} or just a {\fMy lipsum[3]} method, though I'd prefer the latter.

  • I don't know how LuaLaTeX handles the fonts, but are you sure it is included in your systems font cache? Can you use that font in another program (e.g., LibreOffice Writer)? – Skillmon Jan 13 '18 at 23:48
  • had to install Libre... it wasn't available... So maybe I have to do something like sym link the fonts to a cache location?... e.g community.linuxmint.com/tutorial/view/29 – nate Jan 13 '18 at 23:55
  • 1
    To get the font name, use the following in your shell: fc-query <otf file name>, this should give you a list of meta data, including the names (look for fullname). – Skillmon Jan 14 '18 at 0:07
  • 1
    To find names, use otfinto -a myfontfilename.otf. Or look under Element → FontInfo in FontForge. Or search through texmf-var/luatex-cache/generic/names/luaotfload-names.lua.gz. Usually it’s straightforward, but if something is buggy, one of these three methods will suggest something useful. – Thérèse Jan 14 '18 at 0:08
  • 1
    1. Use fontspec not fontenc. 2. `\newfontfamily{filename.otf} picks that one font file for ALL variations, such as italics and bold, but that's not what you want, is it? But \newfontfamily{font name} does the trick. 3. If LibreOffice can find the font, compiling with LuaLaTeX should also find it. Not sure why it hasn't found it. 4. It does not hurt to empty the folder luatex-cache, which will force new cache. Might not help, won't hurt. – user139954 Jan 14 '18 at 0:26
1

This is useful general information that will help you with fontspec syntax. It won't solve problems about finding fonts. For that, you can always make copies of the font files, and place them in a suitable location in your texmf-local directory (then update file name database and luatex-cache).

In the HTML documentation for my novel document class, I assumed that the user was relatively unfamiliar with the technology. So, there is an elaborate discussion of how to use fontspec, along with example code and images of the result. See Appendix E. You do not need to use this document class. The HTML documentation comes with the package, or can be read online at CTAN where the package is located, or here is a direct link to one of the mirrors.

EDIT: The Appendix E refers to some command internal to novel class. For example, SetParentFont and so forth; many of the names are in camel case. Ignore that. For your purposes, just think in terms of the fontspec primitive: \newfontfamily and newfontface.

  • Your appendix was good at explaining several things I was confused about - thanks. I also think my main issue is using classicthesis and currvita and wanting different things. Hope your class gets adopted btw :) – nate Jan 14 '18 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.