1
\textit{\textbf{Text here}}

and

\textit{Text here}

is my code.

I am using the font which can be downloaded for free from: https://sansforgetica.rmit/

However creating bold and italic text for this font in LaTeX seems to not be working, no compiler errors or anything to that effect.

Utilising

\section{Text here}

does work though with this font and highlights the section title in bold using this font.

I know it is definitely not the font because I have tried it in word and it works fine when creating bold and italic text using this font inside word.

The full version of my code, without these two attempts in can be viewed at: https://github.com/Some-T/MemorisationDocumentLaTeXTemplate

I have tried to put in between in

main.tex

file on here, \begin{flushleft} and \end{flushleft}

I have tried this with these two elements removed to no avail.

I am at a loss, how can I make bold and italics perform in LaTeX on a custom font, what am I doing wrong in my code in its entirety?

I have gone through all similar answers on here and only one that comes close is: Bold and italic command is not working but I have also tried everything here to no avail.

I have tried to compile this code in XeLatex and LuaLaTeX on overleaf.com Additional evidence relating to the font actually having bold and italics done in Microsoft word 2019: https://i.gyazo.com/1592b9659cc2851352d78d9357abc3f1.gif

Attempted fake bold:

enter image description here

  • 2
    Are you sure that the font has bold italic characters at all, i.e. is there a version of the font that has bold italic symbols? – user31729 Jan 17 at 21:45
  • Just added a gif to my question with evidence of it in word with the exact same font. – SomeT Jan 17 at 21:47
  • 1
    Ok, it seems to be bold and italic... by OMG, do you really want to use this font? ;-) – user31729 Jan 17 at 21:49
  • It actually works for me, as in being able to read the font (not my issue) I need to remember this stuff haha. Some others may not be inclined to utilise such a difficult to read font... – SomeT Jan 17 at 21:50
  • 1
    That word can slant and embolden the font doesn't proof that italic and bold glyphs exist. Such things can be faked. See e.g fakebold in the fontspec docu. – Ulrike Fischer Jan 17 at 21:54
2

Set the features by hand:

\documentclass{article}
\usepackage{fontspec}

\setmainfont{SansForgetica}[
  Path=./,
  Extension=.otf,
  UprightFont=*-Regular,
  BoldFont=*-Regular,
  BoldFeatures={FakeBold=3},
  ItalicFont=*-Regular,
  ItalicFeatures={FakeSlant=0.3},
  BoldItalicFont=*-Regular,
  BoldItalicFeatures={FakeBold=3,FakeSlant=0.3},
]

\begin{document}

Abc def

\textit{Abc def}

\textbf{Abc def}

\textit{\textbf{Abc def}}

\end{document}

enter image description here

Note: I use Path=./ in order to load the font from a working directory, as I don't want to mix the beast with my system fonts. Your setup may differ.

  • Many thanks for your answer, I learned a lot from this. The upvote does not show because I have less than 15 reputation but I still think it counts. I added one amendment to include: \setmainfont{[SansForgetica-Regular.otf]} because it would not compile on mine unless I added this with XeLaTeX – SomeT Jan 17 at 22:19
  • @SomeT I don't think that amendment is right. You should rather modify the Path or remove it altogether, if the font is installed as a system font. – egreg Jan 17 at 22:21
  • I am using overleaf.com, so I think because it is in the cloud I am not and cannot setting the Path locally, if by path you mean for example 'environment variables' in Windows 10? I mean at least its here in the comments anyway for anyone else who uses overleaf and comes across this. – SomeT Jan 17 at 22:24
  • @SomeT I don't use Overleaf, mainly because I want to control my TeX environment and not depend on other people's choices about what updates they deem worthwhile. – egreg Jan 17 at 22:26
  • Yeah, I mainly use it for studies to be honest, and I change devices day to day a lot so overleaf works better for me. I did used to have a local environment set up but when I started using more and more devices this became a pain to manage. – SomeT Jan 17 at 22:27

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.