0

TeX is showing the error message missing $ inserted from typesetting

\sqrt{I} = \{a \in R \mid $a^n$ \in I, \exists n\in \mathbb{N}\}

The outcome is attached.

enter image description here

2
  • 2
    in general always put whole expressions in math mode, not $ just around individual letters. Oct 11, 2023 at 21:51
  • 1
    It's also a good idea to provide a complete example. Your whole expression is math, so should have been surrounded by a set of $. TeX would have given an error before the \sqrt or before the ^ depending on if you had the outer $ that you don't show or didn't use. Overleaf echos the error, but can make it a bit hard to see the exact error message, which would have indicated one of those places in the line of text.
    – Teepeemm
    Oct 12, 2023 at 1:51

1 Answer 1

3

use this code

\documentclass[]{article}
\usepackage{mathtools, amsfonts}

\begin{document}
    $\sqrt{I} = \{a \in R \mid \, a^n \, \in I, \exists n\in \mathbb{N}\}$          
\end{document}
7
  • 4
    Note, that the \mathbb command requires loading the amsfonts or amssymb package. Oct 11, 2023 at 21:36
  • 2
    What's the purpose of the thinspace (\,) between a^n and \in?
    – Mico
    Oct 11, 2023 at 22:06
  • It is a small separation between the symbols, you can remove it if you wish.✌🏽 Oct 11, 2023 at 22:15
  • 1
    @AlejandroMunozOssa the question about \, was probably rhetorical. Normally one does not add a space before \in
    – daleif
    Oct 12, 2023 at 4:23
  • 1
    @AlejandroMunozOssa I see no reason at all for those \, commands. Actually I see several reasons for not adding them.
    – egreg
    Oct 12, 2023 at 7:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .