1

I am getting the following error message:

Missing $ inserted. ...bord, le premier phaseur U1 est égal à Ue^

… but I cannot find my mistake. I would therefore appreciate your help !

% !TeX program = lualatex
\documentclass{article}%

\usepackage[utf8x]{inputenc}%
\usepackage{lmodern}%
\usepackage{textcomp}%
\usepackage{lastpage}%
\usepackage[head=1pt,margin=0.3in,bottom=0.3in,includeheadfoot=    False]{geometry}%
\usepackage{hyperref}%
\usepackage{bm}
%
\usepackage{needspace}%
\usepackage{textcomp}%
\usepackage{graphicx, array}%
\usepackage{textalpha} % <--- Greek letters in text
%
\usepackage{geometry}
\usepackage{babel}
\usepackage{fontspec}
\usepackage{amssymb} % <----  for real number symbol (R)
\setmainfont{DejaVu Serif}
\setsansfont{DejaVu Sans}
\setmonofont{DejaVu Sans Mono}




\begin{document}%


 Ue^{(j$\alpha$ )}. Je laisse volontairement l'angle $\alpha$      

\end{document}

EDIT:

I have this:

Ue^(jα)

And I want to automatically transcribe it to Latex code... so I replace all greec letters with their math mode equivalent (i.e. $\alpha$)

12
  • 2
    Ue^(j$\alpha$ ) is not allowed, try $Ue^{(j\alpha )}$ instead. There is some room for further improvement.
    – user121799
    Commented May 2, 2019 at 19:40
  • \dots should be in math mode, isn't it?
    – manooooh
    Commented May 2, 2019 at 19:40
  • @marmot It's actually like that in my text ? Ue^(j$\alpha$ )
    – henry
    Commented May 2, 2019 at 19:41
  • @manooooh I tried to add $ but it does not change it.
    – henry
    Commented May 2, 2019 at 19:42
  • 1
    Then load amsmath and do $\text{Ue}^{(\text{j}\alpha )}$.
    – user121799
    Commented May 2, 2019 at 19:42

1 Answer 1

3

Most likely this is a duplicate of something but since you explicitly asked to write an answer, here it is. ^ is not allowed in text mode, but \textsuperscript is. So you could (with your preamble) either do

 Ue\textsuperscript{(j$\alpha$ )}. Je laisse volontairement l'angle $\alpha$  

enter image description here

or, since you load textgreek, avoid math mode altogether

Ue\textsuperscript{(j\textalpha )}. Je laisse volontairement l'angle \textalpha       

enter image description here

1
  • Very nice answer ! Thank you for also mentioning textgreek.
    – henry
    Commented May 2, 2019 at 20:01

You must log in to answer this question.

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