5

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!

1
  • 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. Sep 26, 2012 at 16:41

3 Answers 3

3

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

1
  • 1
    \( ...\) is robust if you load fixltx2e.
    – Joseph Wright
    Sep 26, 2012 at 17:24
7

\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}
0

Why you use \emph{} for math?

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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