5

Why can't my Latex editor convert these equations below?

  1. (x,−2x,x)+(y,−2y,y)=(x+y,−2(x+y),x+y) ∈ E

  2. {(x,−2x,x)∣x∈R}

These are the codes I tried:

  1. $(x,−2x,x)+(y,−2y,y)=(x+y,−2(x+y),x+y) \in E$
  2. $ \ {(x,−2x,x) \mid x \in R \ }$
user267208
  • 51
  • 3

2 Answers2

21

LaTeX does not silently fail, if there is an error it is reported on the terminal and log file.

\documentclass{article}

\usepackage{amsmath}

\begin{document}

$(x,−2x,x)+(y,−2y,y)=(x+y,−2(x+y),x+y) \in E$

\end{document}

has terminal output

LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2022-02-24>
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/article.cls
Document Class: article 2021/10/04 v1.4n Standard LaTeX document class
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/home/davidc/texmf/tex/latex/l3backend/l3backend-pdftex.def)
No file cc134.aux.

! LaTeX Error: Unicode character − (U+2212) not set up for use with LaTeX.

See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ...

l.7 $(x,− 2x,x)+(y,−2y,y)=(x+y,−2(x+y),x+y) \in E$ ?

Where the linebreak highlights the location of the error, and the message explains the problem that − is not known.

You could retype the expression with a normal ascii - character or declare the Unicode − to act like - with \DeclareUnicodeCharacter{2212}{-}

\documentclass{article}

\usepackage{amsmath} \DeclareUnicodeCharacter{2212}{-} \begin{document}

$(x,−2x,x)+(y,−2y,y)=(x+y,−2(x+y),x+y) \in E$

\end{document}

runs with no error and produces

enter image description here

David Carlisle
  • 757,742
6

When we are using Unicode math then we have no problem, because your character is Unicode minus. For example in OpTeX:

\fontfam[lm]

$(x,−2x,x)+(y,−2y,y)=(x+y,−2(x+y),x+y) \in E$ \bye

gives expected result. Moreower, you can use the directly, if you know how to type it on your keyboard:

\fontfam[lm]

$(x,−2x,x)+(y,−2y,y)=(x+y,−2(x+y),x+y) ∈ E$ \bye

wipet
  • 74,238
  • 1
    +1 I just "borrowed" this answer here https://tex.stackexchange.com/a/638701/1090 (I trust you to be a reliable source for optex syntax:-) – David Carlisle Mar 28 '22 at 13:26