# How can I create bold text within Latex? (\textbf not working)

I see the following errors:

LaTeX Font Info:    Overwriting symbol font operators' in version bold'
(Font)                  OT1/cmr/bx/n --> OT1/lmr/bx/n on input line 26.


I just want text to be bold. That's it. I am using a TrueType font (.ttf) and doing this within the file:

\usepackage{pgf}
\usepackage{mathtools}
\usepackage{amsmath, amsthm, amssymb, amsfonts}
\usepackage{exscale}
\usepackage{lmodern}
\usepackage{fontspec}
\usepackage{xcolor}
\usepackage{ushort}
\usepackage{fancyhdr}
\usepackage{setspace}
\usepackage{tcolorbox}
\usepackage[square,numbers]{natbib}
\usepackage{url}
\usepackage{geometry}
\usepackage{fancyvrb}
\usepackage{tikz}
\usepackage[english]{babel}
\usepackage{smartdiagram}
\usetikzlibrary{shapes.callouts}

\setmainfont{[Roboto-Condensed.ttf]}
\setsansfont{[Roboto-Condensed.ttf]}
\setmonofont{[Roboto-Condensed.ttf]}


And this does not work:

\textbf{how they need to act}


Could someone help me out, please?

Am using this template btw: https://www.overleaf.com/15745069kdtbdbjnwcxz

• When you \setmainfont using a specific file name (with extension), then fontspec uses ONLY that one file for all variants. Thus, no bold. Solution: Either set the main font by its font family name (no file extension), OR specify exactly which font file is bold. The fontspec documentation shows you how to do this. – user139954 Apr 25 '18 at 17:02
• Okay, so I removed the extension, but still nothing happens.... So I did: \setmainfont{[Roboto-Condensed]} without the .ttf, but still nothing... – Siyah Apr 25 '18 at 17:10
• Especially for ttf, you may need to use the second method, where you specify each font to be used. Sometimes the font family name is not what you think it is. Other times, the wrong font is found, or not found at all. – user139954 Apr 25 '18 at 17:12
• Try it without the hyphen in the name, and you don't need the brackets around it: \setmainfont{Roboto Condensed}. If that doesn't work look into your system's font folder how that font is named there and read the fontspec documentation. If you are working in Overleaf, maybe they don't even have that font available? – lblb Apr 25 '18 at 17:13
• Top of page 11 in current fontspec docs. – user139954 Apr 25 '18 at 17:14

If you don't have installed RobotoCondensed as system font, you can do

\documentclass{article}
\usepackage{fontspec}

\setmainfont{RobotoCondensed}[
Extension=.ttf,
UprightFont=*-Regular,
ItalicFont=*-RegularItalic,
BoldFont=*-Bold,
BoldItalicFont=*-BoldItalic,
]

\begin{document}

Roboto

\textit{Roboto}

\textbf{Roboto}

\textbf{\textit{Roboto}}

\end{document}


If you have installed the font in the system, then

\setmainfont{Roboto Condensed}


will produce the same output.

• You're taking all the fun out of this. I was hoping to persuade the OP to read the fontspec docs. Not that I read many docs myself. – user139954 Apr 25 '18 at 17:19
• Thank you! I actually managed to do it myself by indeed reading the fontspec doc. Nevertheless, I will accept and upvote this answer as it's probably solving my problem. – Siyah Apr 25 '18 at 17:20
• \usepackage{fontspec} and \textbf{Roboto} works on XeTeX 3.14159265-2.6-0.99999 (TeX Live 2018), fedora 29 x86_64 workstation – Nick Dong Jul 26 at 15:58

I have managed to answer my own question and I wanted to share what I've did.

1) I red the fontspec document, which I found here: https://mirror.hmc.edu/ctan/macros/latex/contrib/fontspec/fontspec.pdf

2) I installed the necessary Roboto fonts

3) I used the example they gave on page 11:

\setmainfont{texgyrepagella-regular.otf}[
BoldFont = texgyrepagella-bold.otf ,
ItalicFont = texgyrepagella-italic.otf ,
BoldItalicFont = texgyrepagella-bolditalic.otf ]


And tailored it to my needs.

Thanks all for helping me out!