LaTeX forum ⇒ Math & Science[solved] Why \overrightarrow is not working for me? Topic is solved

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
dedec0
Posts: 12
Joined: Wed Nov 06, 2019 1:14 am

[solved] Why \overrightarrow is not working for me?

Postby dedec0 » Wed Nov 06, 2019 1:45 am

I am using LaTeX in a Debian computer, with a good number of things installed beyound the basic. To compile my tex files, i use the command 'pdflatex'.

This code compiles without error:

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass[12pt]{article}
  2. \usepackage{amssymb}
  3.  
  4. \usepackage{amsmath}
  5. \usepackage[T1]{fontenc}
  6. \usepackage[utf8]{inputenc}
  7. \usepackage[portuguese]{babel}
  8.  
  9. \usepackage{hyphenat}
  10. \hyphenation{mate-mática recu-perar}
  11.  
  12. \begin{document}
  13. \pagestyle{empty}
  14. \paragraph
  15. {
  16. \textbf{10.13.} aaaaaa, aaaaaa aaaaaaaaaaa,
  17. aaa aa $\textit{aa} \equiv \textit{aa}$ a $\textit{EF} \equiv
  18. \textit{GH}$ sãa aaaa aaaaa aa aaaaaaaaa aaaaa
  19. aaaaaaa, a $\textit{M}$, $\textit{N}$, $\textit{P}$ e
  20. $\textit{Q}$ sãa aa aaaaaa aéaaaa aaa aaaaaaaaa
  21. $\textit{AE}$, $\textit{BF}$, $\textit{CG}$ e
  22. $\textit{DH}$, raaaaaaaaaaaaaa, aaaãa $\textit{aa}
  23. \equiv \textit{aa}$.
  24. }
  25.  
  26. \paragraph
  27. {
  28. \textbf{09.15.} Aa aaaaaa aaa aaaa aaaaa aaaaa
  29. aaaaa aa aaaaaa aaa, aaaaaaaaa:
  30. }
  31. \subparagraph
  32. {
  33. %\overrightarrow{AB}%(a) $\overrightarrow{AE}$
  34. %- \overrightarrow{\textit{ED}} + \overrightarrow{\textit{EB}} $;
  35. a
  36. }
  37.  
  38. \end{document}


with pdflatex giving this output:
Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) (preloaded format=pdflatex)
  2. restricted \write18 enabled.
  3. entering extended mode
  4. (./x.tex
  5. LaTeX2e <2017/01/01> patch level 3
  6. Babel <3.9r> and hyphenation patterns for 4 language(s) loaded.
  7. (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
  8. Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
  9. (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo))
  10. (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty
  11. (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty))
  12. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
  13. For additional information on amsmath, use the `?' option.
  14. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
  15. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))
  16. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty)
  17. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty))
  18. (/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
  19. (/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.def))
  20. (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
  21. (/usr/share/texlive/texmf-dist/tex/latex/base/utf8.def
  22. (/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.dfu)
  23. (/usr/share/texlive/texmf-dist/tex/latex/base/ot1enc.dfu)
  24. (/usr/share/texlive/texmf-dist/tex/latex/base/omsenc.dfu)))
  25. (/usr/share/texlive/texmf-dist/tex/generic/babel/babel.sty
  26. (/usr/share/texlive/texmf-dist/tex/generic/babel-portuges/portuges.ldf
  27. (/usr/share/texlive/texmf-dist/tex/generic/babel/babel.def)))
  28. (/usr/share/texlive/texmf-dist/tex/latex/hyphenat/hyphenat.sty) (./x.aux)
  29. (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd)
  30. (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd) [1{/var/lib/texmf/fo
  31. nts/map/pdftex/updmap/pdftex.map}] (./x.aux) ) </home/user/.texlive2016/texmf-v
  32. ar/fonts/pk/ljfour/jknappen/ec/ecbi1200.600pk> </home/user/.texlive2016/texmf-v
  33. ar/fonts/pk/ljfour/jknappen/ec/ecbx1200.600pk></usr/share/texlive/texmf-dist/fo
  34. nts/type1/public/amsfonts/cm/cmsy10.pfb>
  35. Output written on x.pdf (1 page, 18699 bytes).
  36. Transcript written on x.log.


But when i uncomment the last part of the above file, just adding a simple "\overrightarrow{AB}" to it (note the rest of the line is a comment), transforming it in:

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass[12pt]{article}
  2. \usepackage{amssymb}
  3.  
  4. \usepackage{amsmath}
  5. \usepackage[T1]{fontenc}
  6. \usepackage[utf8]{inputenc}
  7. \usepackage[portuguese]{babel}
  8.  
  9. \usepackage{hyphenat}
  10. \hyphenation{mate-mática recu-perar}
  11.  
  12. \begin{document}
  13. \pagestyle{empty}
  14. \paragraph
  15. {
  16. \textbf{10.13.} aaaaaa, aaaaaa aaaaaaaaaaa, aaa aa $\textit{aa} \equiv \textit{aa}$ a $\textit{EF} \equiv \textit{GH}$ sãa aaaa aaaaa aa aaaaaaaaa aaaaaaaaaaaa, a $\textit{M}$, $\textit{N}$, $\textit{P}$ e $\textit{Q}$ sãa aa aaaaaa aéaaaa aaa aaaaaaaaa $\textit{AE}$, $\textit{BF}$, $\textit{CG}$ e $\textit{DH}$, raaaaaaaaaaaaaa, aaaãa $\textit{aa} \equiv \textit{aa}$.
  17. }
  18.  
  19. \paragraph
  20. {
  21. \textbf{09.15.} Aa aaaaaa aaa aaaa aaaaa aaaaaaaaaa aa aaaaaa aaa, aaaaaaaaa:
  22. }
  23. \subparagraph
  24. {
  25. \overrightarrow{AB}%(a) $\overrightarrow{AE}$ %- \overrightarrow{\textit{ED}} + \overrightarrow{\textit{EB}} $;
  26. a
  27. }
  28.  
  29. \end{document}


pdflatex will give this output, with an error prompt:

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. $ pdflatex x.tex
  2. This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) (preloaded format=pdflatex)
  3. restricted \write18 enabled.
  4. entering extended mode
  5. (./x.tex
  6. LaTeX2e <2017/01/01> patch level 3
  7. Babel <3.9r> and hyphenation patterns for 4 language(s) loaded.
  8. (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
  9. Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
  10. (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo))
  11. (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty
  12. (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty))
  13. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
  14. For additional information on amsmath, use the `?' option.
  15. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
  16. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))
  17. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty)
  18. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty))
  19. (/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
  20. (/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.def))
  21. (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
  22. (/usr/share/texlive/texmf-dist/tex/latex/base/utf8.def
  23. (/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.dfu)
  24. (/usr/share/texlive/texmf-dist/tex/latex/base/ot1enc.dfu)
  25. (/usr/share/texlive/texmf-dist/tex/latex/base/omsenc.dfu)))
  26. (/usr/share/texlive/texmf-dist/tex/generic/babel/babel.sty
  27. (/usr/share/texlive/texmf-dist/tex/generic/babel-portuges/portuges.ldf
  28. (/usr/share/texlive/texmf-dist/tex/generic/babel/babel.def)))
  29. (/usr/share/texlive/texmf-dist/tex/latex/hyphenat/hyphenat.sty) (./x.aux)
  30. (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd)
  31. (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd)
  32. ! Missing $ inserted.
  33. <inserted text>
  34. $
  35. l.29 \end{document}
  36.  
  37. ?


What is the problem here?
Last edited by dedec0 on Sun Nov 10, 2019 12:26 am, edited 2 times in total.

User avatar
Stefan Kottwitz
Site Admin
Posts: 9495
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Thu Nov 07, 2019 8:18 am

Welcome to the forum!

The problem is, that it is a math command and has to be used in math mode:

$\overrightarrow{AB}$

Stefan
Site admin

dedec0
Posts: 12
Joined: Wed Nov 06, 2019 1:14 am

Postby dedec0 » Fri Nov 08, 2019 1:34 am

But it did not work.The 'pdflatex' output for the file obtained with

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \subparagraph
  2. {
  3. $ \overrightarrow{AB} $
  4. }


in that final part of the file is:

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. $ pdflatex z.tex
  2. This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) (preloaded format=pdflatex)
  3. restricted \write18 enabled.
  4. entering extended mode
  5. (./z.tex
  6. LaTeX2e <2017/01/01> patch level 3
  7. Babel <3.9r> and hyphenation patterns for 4 language(s) loaded.
  8. (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
  9. Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
  10. (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo))
  11. (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty
  12. (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty))
  13. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
  14. For additional information on amsmath, use the `?' option.
  15. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
  16. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))
  17. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty)
  18. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty))
  19. (/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
  20. (/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.def))
  21. (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
  22. (/usr/share/texlive/texmf-dist/tex/latex/base/utf8.def
  23. (/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.dfu)
  24. (/usr/share/texlive/texmf-dist/tex/latex/base/ot1enc.dfu)
  25. (/usr/share/texlive/texmf-dist/tex/latex/base/omsenc.dfu)))
  26. (/usr/share/texlive/texmf-dist/tex/generic/babel/babel.sty
  27. (/usr/share/texlive/texmf-dist/tex/generic/babel-portuges/portuges.ldf
  28. (/usr/share/texlive/texmf-dist/tex/generic/babel/babel.def)))
  29. (/usr/share/texlive/texmf-dist/tex/latex/hyphenat/hyphenat.sty)
  30. No file z.aux.
  31. (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd)
  32. (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd)
  33. ! Illegal parameter number in definition of \reserved@a.
  34. <to be read again>
  35. \crcr
  36. l.28 \end{document}
  37.  
  38. ?

User avatar
Stefan Kottwitz
Site Admin
Posts: 9495
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Nov 08, 2019 3:22 am

That's a different issue.

The syntax is

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \subparagraph{title} Now the text comes.


Same for \paragraph, \section etc. In the code above, the whole text including paragraph breaks (empty lines) are in the title.

Stefan
Site admin

dedec0
Posts: 12
Joined: Wed Nov 06, 2019 1:14 am

Postby dedec0 » Sun Nov 10, 2019 12:25 am

Thank you for your comments. I used to make some latex files, years ago. But i have forgotten most of it. So i am practically a newbie today.

Anyway, this thread is solved. The problem was using a math command in the wrong place.


Return to “Math & Science”

Who is online

Users browsing this forum: No registered users and 2 guests