# Using math mode?

A MWE:

\documentclass[12pt]{book}
\usepackage{imakeidx}
\usepackage{xcolor}
\usepackage{setspace}
\usepackage{lipsum}
\usepackage[margin=.5in]{geometry}
\usepackage{parskip}
\usepackage{bookmark}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{float}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{accents}
\usepackage{bm}
\usepackage{amsfonts}
\usepackage{enumitem}
\usepackage{fancyvrb}
\usepackage[bottom]{footmisc}
\makeindex
\usepackage{hyperref}

\begin{document}

We know that the \textbf{dual} of $\mathbf{a_1}$ is ${\mathbf{a_1}^\perp}$

We know that the \textbf{dual} of $\mathbf{a_1}$ is {${\mathbf{a_1}}^\perp$}

\end{document}


Having just learnt to use math mode I have the following problem:

We know that the \textbf{dual} of $\mathbf{a_1}$ is ${\mathbf{a_1}^\perp}$


Results in an error "Mathbf only allowed in math mode". I have tried some variations that give me the error "insert } missing" as follows:

We know that the \textbf{dual} of $\mathbf{a_1}$ is {${\mathbf{a_1}}^\perp$}


I definitely do not understand the placement of the $signs around math symbols. Any pointers? • Neither of these generates an error (though some of the braces are unnecessary). The key pointer: post a small example code that reproduces the problem! – Ian Thompson Apr 21 '16 at 20:46 • The posted example is neither minimal nor working ;-) And if mathtools is loaded, amsmath is not needed .. and other things to frown – user31729 Apr 21 '16 at 20:52 • No, the code you posted 5 minutes ago does not reproduce the error. – GuM Apr 21 '16 at 21:01 • @Tom - If you copy-paste the MWE above, do you still have the same errors? It works with me without any erros! – AboAmmar Apr 21 '16 at 21:02 • regarding placement of $ signs around math: the first $ enters math mode. provided that any braced groups within the math are closed (i.e., every open brace is matched by a closing brace) the next $ will terminate the math. no additional braces are needed, either inside or outside the $ signs to delineate the math. – barbara beeton Apr 21 '16 at 21:08 ## 1 Answer (too long for a comment, hence posted as an answer) Some comments and observations: • Not even one of the packages loaded in your preamble is needed to compile the body of the document. Do take some time to figure which packages are really needed to compile your full document. • The body of the document you've posted actually compiles without errors. • You may want to give special thought as to whether the subscript term should also appear in bold. The following screenshot displays the results of both types of input for the subscript term. \documentclass[12pt]{book} \begin{document} We know that the \emph{dual} of$\mathbf{a}_1^{}$is$\mathbf{a}_1^\perp$. \medskip We know that the \emph{dual} of$\mathbf{a_1^{}}$is$\mathbf{a}_{\mathbf{1}}^\perp\$.
\end{document}

• Thanks ... I have tons of figures and all in color and then I have the need for vector symbols and double arrows etc so I think some of the preamble addressed those needs. As you and others point out I will have to eventually figure out which of those packages I really need etc. – Tom Apr 21 '16 at 21:17
• How about making a macro for the \mathbf{a}_1^\perp? – user31729 Apr 21 '16 at 21:25
• @Tom You may indeed need most of those packages - but when posting a question here with a particular problem here please try to make a MWE really minimal by deleting stuff until only the problem remains. Sometimes you can even solve the problem yourself that way. – Ethan Bolker Apr 21 '16 at 21:26
• @Ethan ... thanks, I panicked but I do take direction well :). I will have to look into how to make a macro ... it would definitely be time saving I think ... thanks for the suggestion. – Tom Apr 21 '16 at 21:31
• @ChristianHupfer - Thanks. Mostly, I was trying to get the OP to think whether the subscript 1 should be in bold or not. :-) – Mico Apr 21 '16 at 21:38