-1

My montserrat font is working great but I'm getting the warning

Font shape `TU/Montserrat(0)/bx/n' undefined
(Font)  using `TU/Montserrat(0)/m/n' instead.

There's a similar post here but I'm not sure how to translate it to fix my warning?

Here's my minimal code

\documentclass[12pt]{memoir}
\usepackage{fontspec}
\usepackage[explicit]{titlesec}
\newfontfamily{\titlefont}{Montserrat}
\titleformat{\chapter}[display]{\bfseries\centering}
    {\huge\chapternumberfont\thechapter}
    {2em}
    {\titlefont\Huge #1}
\begin{document}
\chapter*[Introduction]{Introduction}
Hello
\end{document}

Which renders....

enter image description here

1 Answers1

2

I suggest to use the TeX Live provided Montserrat font.

\documentclass[12pt]{memoir}
\usepackage{fontspec}
\usepackage{titlesec}

\newfontfamily{\titlefont}{Montserrat}[ Extension=.otf, UprightFont=-Regular, ItalicFont=-Italic, BoldFont=-Bold, BoldItalicFont=-BoldItalic, ]

\titleformat{\chapter}[display] {\huge\bfseries\titlefont\filcenter} {\thechapter} {2em} {}

\begin{document}

\chapter{Introduction}

Hello

\end{document}

I made a few changes to the \titleformat command. You had a \chapternumberfont command that's not defined. Since at 12pt base size there's no difference between \huge and \Huge, the definition can be simplified. No need to use explicit. Better to use titlesec's \filcenter than \centering.

enter image description here

egreg
  • 1,121,712
  • Thanks! I should have posted my output. (I just edited my OP to show what I'm seeing with my code.) Your code fixes my warnings but is much bolder. I'm not sure how to change your code to produce my output. – buttonsrtoys Feb 09 '23 at 19:36
  • @buttonsrtoys Remove \bfseries. – egreg Feb 09 '23 at 20:34
  • @buttonsrtoys Anyway, the thin font was due to the issue you were describing, because you did want boldface: the warning tells exactly that regular font is substituted for boldface. – egreg Feb 09 '23 at 20:55
  • Ah. Thank you @egreg! That solved my problem. I'm now warning-free. Thanks for answer and the tips in your post. Much appreciated. – buttonsrtoys Feb 09 '23 at 21:44