Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am new to LaTeX and have a problem with the line

The difference is that the signing key \emph{x} is split into two pieces, \begin{math}
\emph{x_{L}}\end{math} and \begin{math}\emph{x_{R}}\end{math} and are both elements of the 
\begin{math}\textbf{Z}_{q}\end{math}.

I get the error

! Missing $ inserted.
<inserted text> 

I am a little confused why I am getting this error since I have put the _ in a math section. Any help would be great. Thanks!

share|improve this question
6  
Welcome to TeX.sx! \emph is a text-mode command, so even though it's within a math-mode environment, a _ will be recognized as text. in fact, unless you've done something unusual, the math will be set automatically in italic, so there should be no need for the \emph. also, a shorter way to input in-line math is \( x_L \) and you don't need to bury single-letter subscripts in braces. these things will come with time. –  barbara beeton Sep 26 '12 at 16:41

3 Answers 3

up vote 2 down vote accepted

For inline math you should use $ your equation $ or \( your equation \). But \(...\) is fragile. loading fixltx2e makes it robust. For display equation without number, use \[ equation \] or

\begin{equation*}
.
.
.
\end{equation*}

For numbered equations, use

\begin{equation}
.
.
.
\end{equation}

A MWE:

\documentclass{article}
\usepackage{amsmath} 

\begin{document}
The difference is that the signing key $x$ is split into two pieces, 
$x_{L}$ and \(x_{R}\) and are both elements of the $x_{L}$

\[\mathbf{Z}_{q}.\]

\begin{equation}
    \mathbf{Z}_{q}
\end{equation}

\begin{equation*}
    \mathbf{Z}_{q}
\end{equation*}

\end{document}

enter image description here

share|improve this answer
1  
\( ...\) is robust if you load fixltx2e. –  Joseph Wright Sep 26 '12 at 17:24
    
@egreg Thank you. –  Harish Kumar Sep 26 '12 at 22:57
    
@JosephWright Thanks. –  Harish Kumar Sep 26 '12 at 22:57

\emph{} starts in text mode, so its parameter must be text, not math. So you need to go into math mode again within the \emph{}, as in \emph{$x_{L}$}.

enter image description here

Notes:

  • I usually just use $...$ for inline math constructs (See References below).
  • Also I am not sure why you want to use \emph{} within math mode, unless you have a special definition of \emph{}.
  • I have also replaced \textbf{} with \mathbf{}.

References:

Code:

\documentclass{article}

\begin{document}
  The difference is that the signing key $x$ is split into two pieces, 
  $x_{L}$ and $x_{R}$ and are both elements of the $\mathbf{Z}_{q}$.
\end{document}
share|improve this answer

Why you use \emph{} for math?

$x_L$ and $\mathbf{Z}_q$ will do the same in simplest form without error.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.