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$)

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

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

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.