6

I'm trying to write the following but in bold: $M_s$ so that the "s" becomes next to "M" but low and i have the following code:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{tikz}
\title{Fundamentals of informatics A4}
\author{some name}
\date{January 2018}

\setlength{\parindent}{0pt}
\begin{document}
% some text

into a new Turing machine \textbf{$M_s$} with the following behavior:

%some more text

\end{document}

The problem is that the M_s wouldn't appear bold no matter what i try

edit1: \textbf{} works perfectly with just text but when using the dollar signs, it doesn't.

2
  • 6
    Well, \textbf is meant for text mode, not for content in math mode. You can try {\boldmath $M_s$}
    – user31729
    Commented Jan 11, 2018 at 8:28
  • 6
    Use $\mathbf{M_s}$ for upright M or \boldmath $M_s$\unboldmath
    – user2478
    Commented Jan 11, 2018 at 8:32

3 Answers 3

9

Use the bm package and type $\bm{M_s}$ to get what you want. The command \textbf is for ordinary text, not for mathematical text.

1

You could define a command that automatically bolds text and math:

\newcommand{\textmathbf}[1]{\textbf{\boldmath#1}}

However, your question seems like you just want to have the s as an index to M and don't necessarily want them in math mode, so you might want to use:

\textbf{$\text{M}_\text{s}$} %% requires \usepackage{amsmath}
0

If it's in text mode, use \textbf{}.
If it's in math mode, use \mathbf{}.

Here's the distinction:

into a \textbf{new} Turing machine $\mathbf{M_s}$ with the following behavior:

You must log in to answer this question.