# Labeling equations and math mode

I have to write the equation shown below in Latex and I am using

{\textbf{q}=($\mu$  $_1$ $\mu$  $_2$ ... $\mu$  $_{n-2}$
$\mu$ $_n$ )\textsuperscript{T}}


and it comes OK.

However, I need to label the equation and I am using

$${\textbf{q}=(\mu _1 \mu _2 ... \mu _{n-2} \mu _n )\textsuperscript{T}} \label{2}$$


but I am getting errors stating that there is a missing } and that math mode should end with .

Also how can the equation below be written using Latex:

• In equation there mustn't be $ inside ;-) – user31729 Commented May 22, 2015 at 17:21 • please can you see the last line of the question since I have a problem with another equation Commented May 22, 2015 at 17:23 • in your first equation, you should be using \mathbf rather than \textbf. Commented May 22, 2015 at 17:24 • @user1930901 please stop adding questions to this question. if your first question(s) have been answered, mark an answer as accepted and post a new question for your matrix. you should also be aware that this community discourages "please do this for me" questions. you haven't shown any attempts to typeset the followup questions for yourself. Commented May 22, 2015 at 17:45 • @user1930901 Rather than using \mathbf{q} I would think of what is that q. If it's a vector, the logic would be to input \vec{q} and then redefine \vec to give bold letters (by default it places an small arrow above the letter). In any case, you should change your name to something more telling than user1930901 :) Commented May 22, 2015 at 18:21 ## 2 Answers Example, how this can be typeset: \documentclass[a5paper]{article} \usepackage{amsmath} \newcommand*{\transpose}{\mathrm{T}} \newcommand*{\vc}[1]{\mathhbf{#1}} % \vec and \vector are already defined \begin{document} $$\label{q-def} \vc{q} = (\mu_1, \mu_2, \dots, \mu_{n-1}, \mu_{n})^\transpose$$ Equation~\eqref{q-def} defines vector$\vc{q}$. \end{document}  Or as matrix without commas: \documentclass[a5paper]{article} \usepackage{amsmath} \newcommand*{\transpose}{\mathrm{T}} \newcommand*{\vc}[1]{\mathbf{#1}} \begin{document} $$\label{q-def} \vc{q} = \begin{pmatrix} \mu_1 & \mu_2 & \dots & \mu_{n-1} & \mu_{n} \end{pmatrix}^\transpose$$ Equation~\eqref{q-def} defines vector$\vc{q}\$.
\end{document}


## Second question

The equation can be typeset as:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
$L = \log(l) = \sum_{i=1}^{N} \bigl( \log ( \mathbf{s}(\exp \{ \mathbf{Q} t_i\}) \mathbf{q} ) \bigr)$
\end{document}


• May be \renewcommand*\vec{\mathbf} and use \vec{q}. Commented May 22, 2015 at 18:22
• @Manuel \vec and \vector are already defined, thus I have updated the answer using \vc. I have kept \mahbf for the second question, because it is not too clear, if these are vectors, matrices, or tensors. Commented May 22, 2015 at 18:39

you should really have posted these as two separate questions, instead of adding on to the first. but you could try

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$$\mathbf{q}=(\mu_1, \mu_2, \ldots ,\mu_{n-2}, \mu_n )^{\text{T}} \label{2}$$
and
$$L = \log(l) = \sum\limits_{i=1}^{\infty}\left( \log(s(\exp\left\{\mathbf{Q}_{i}^{t}\right\})\mathbf{q}) \right)$$

\end{document}


which gives

• oh, if that's not supposed to be a superscript t, then drop it inline...the picture looks a little fuzzy to me so at first i thought you wanted a superscript there. but i would encourage use of parentheses and curly braces that scale. Commented May 22, 2015 at 17:43
• yes I did that :) would it be possible to help me with the matrix I just posted? I am a beginner and really appreciate as they were taking me a lot of time! Commented May 22, 2015 at 17:45
• using \left and \right on the braces around the Q expression results in braces that are larger than the next-surrounding parentheses, which looks bad. the extra size isn't really needed though, so the answer is not to add more \left and \right. Commented May 22, 2015 at 18:26
• @barbarabeeton in the case that i (accidentally) typeset, without \left and \right creates braces that do not fully encompass the superscript and subscript. so should the answer actually have been to use \left and \right with the next-surrounding parentheses as well? Commented May 22, 2015 at 18:29
• @aeroNotAuto -- if you use \left and \right on the next pair, then you'd have to continue, and the result would be that the outermost pair would be entirely too large. better to take a little more time, use \bigl/\bigr and friends, and keep them as size-restricted as possible. there are many questions on this site with sensible guidance regarding sizing of delimiters, including when to let sub/superscripts and limits "hang out". Commented May 22, 2015 at 19:20