# latex - bold not bold enough in math

I tried to get characters in math-environment bold such that they look like this (picture taken from a book - pdf-sample: link):

However, neither \mathbf{xyz} nor \boldsymbol{\mathrm{xyz}} work in order to get the characters bold enough. In fact it is hard to distinguish bold from non-bold characters. This is the code I tried:

\documentclass[english]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{textcomp}
\usepackage{amstext}
\usepackage{babel}
\begin{document}
As an application of these results, consider the case in which $\mathbf{X}_{1}$
is $\mathbf{i}$, a constant term that is a column of 1s in the first
column of $\mathbf{X}$. The solution for $b_{2}$ in this case will
then be the slopes in a regression that contains a constant term.
Using Theorem 3.2 the vector of residuals for any variable in $\mathbf{X}_{2}$
in this case will be

$\mathbf{x\text{\textasteriskcentered}}=\mathbf{x}-\mathbf{X}_{1}(\mathbf{X}_{1}'\mathbf{X}_{1})^{-1}\mathbf{X}_{1}\mathbf{x}$

$\textrm{x\text{\textasteriskcentered}}=\textrm{x}-\textrm{X}_{1}(\textrm{X}_{1}'\textrm{X}_{1})^{-1}\textrm{X}_{1}\textrm{x}$
\end{document}


Is there a trick how one can get "extra-bold" characters?

BR Fabian

PS: I've tried pretty much all proposals on how to get characters bold that I've found on the internet.

• Welcome to TeX.SX! I'm not sure I understand what you mean; the characters do seem bold enough to be distinguished from the n and 1, for instance. Use \mathbf{x}{*} instead of that complicated construction; also ^{'} should simply be '. Aug 19, 2014 at 21:32
• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. It would be particularly useful to know which font you use. However, a full MWE is the best thing.
– yo'
Aug 19, 2014 at 21:57
• Sorry, your MWE gives significantly different output than what your picture shows. The fonts don't match. With which font do you have the issue? Because in all honesty, I can't imagine better bold/medium distinction than what Computer Modern (the LaTeX's default) provides.
– yo'
Aug 19, 2014 at 22:25
• @tohecz The picture above shows how I want it to be, not what I get. Sorry, maybe I was not precise on this. Aug 19, 2014 at 22:31
• I'm therefore lost in what is your true question. (and good night, btw)
– yo'
Aug 19, 2014 at 22:32

The following method only works in pdflatex. I use a pdf special to embolden the font, calling it \mathbbf[]{}. The optional argument allows an optional embolding factor to be specified (default 0.2).

In the MWE, the top line is \mathbbf, the next \mathbf, and the final is \textrm.

\documentclass[english]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{textcomp}
\usepackage{amstext}
\usepackage{babel}
%%%%%
\usepackage{scalerel,lmodern}
\input pdf-trans
\newbox\qbox
\def\usecolor#1{\csname\string\color@#1\endcsname\space}
\newcommand\outline[1]{\leavevmode%
\def\maltext{#1}%
\setbox\qbox=\hbox{\maltext}%
\boxgs{Q q 2 Tr \thickness\space w 0 0 0 rg 0 G}{}%
\copy\qbox%
}
\newcommand\mathbbf[2][.2]{%
\def\thickness{#1}%
\ThisStyle{\outline{$\mathbf{\SavedStyle#2}$}}%
}
%%%%%
\begin{document}
$\mathbbf{x\text{\textasteriskcentered}}=\mathbbf{x}-\mathbbf{X}_{1}(\mathbbf{X}_{1}'\mathbbf{X}_{1})^{-1}\mathbbf{X}_{1}\mathbbf{x}$

$\mathbf{x\text{\textasteriskcentered}}=\mathbf{x}-\mathbf{X}_{1}(\mathbf{X}_{1}'\mathbf{X}_{1})^{-1}\mathbf{X}_{1}\mathbf{x}$

$\textrm{x\text{\textasteriskcentered}}=\textrm{x}-\textrm{X}_{1}(\textrm{X}_{1}'\textrm{X}_{1})^{-1}\textrm{X}_{1}\textrm{x}$
\end{document}


• See packages pdfrender for a higher level interface of the thickening. Mar 18, 2018 at 3:16
• To add to @HeikoOberdiek's suggestion: after loading \usepackage{pdfrender}, a new macro such as \newcommand*{\textxbf}[1]{\textpdfrender{TextRenderingMode=2}{#1}} seems to do the job. Jan 29 at 18:03

How much contrast exists between the bold and medium font is an aspect of the font design. You haven't given an example document. the default Computer modern has reasonable contrast between the bold and medium weight (which is easy as the medium weight cm is very light)

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$\mathbf{x}\text{\textasteriskcentered}=\mathbf{x}-\mathbf{X}_{1}(\mathbf{X}_{1}^{'}\mathbf{X}_{2}')^{-1}\mathbf{X}'_{1}\mathbf{x}$

$\mathrm{x}\text{\textasteriskcentered}=\mathrm{x}-\mathrm{X}_{1}(\mathrm{X}_{1}^{'}\mathrm{X}_{2}')^{-1}\mathrm{X}'_{1}\mathrm{x}$

\end{document}

• I left the markup as in the question , although ^{'} is very dubious markup Aug 19, 2014 at 21:40
• Thank you for your answer. Unless I increase pdf size to some 150% it is hard for me to see the difference. However, the important thing for me is, that in the picture I posted above, the bold characters are "more" bold compared to normal text than in the file I created. Generally, the characters in the picture-text seem to be horizontally compressed a bit. Aug 19, 2014 at 22:12
• @Fabian hard to tell from an image but if you have a pdf of that document you can easily tell which fonts it is using Aug 19, 2014 at 22:20
• I just added a link to a pdf-file to the original question. Aug 19, 2014 at 22:36

A "dirty" way, which can work if you're using latex outside pdf settings and therefore @Steven's answer can't be directly applied, is to use \pmb{} from the AMSLatex package, on top of the boldface command, possibly nested multiple times.

Below you see v, \bm{v}, \pmb{\bm{v}}, and \pmb{\pmb{\bm{v}}} for the Latex output of LibreOffice's TexMaths extension, with the Palatino-like font from the newpxtext` package: