Latex quetion "Missing $ inserted" [closed] - latex

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I want to write this simple equation in latex
2/|w|
In which |w| is the norm of w,,
I tried with
\frac{2}{\|w\|}
And get error "Missing $ inserted"
then I use this
\frac{2}{$\|w\|$}
And still get same error..
Does someone know how to solve this problem??

You are getting that error because LaTeX recognized this as being part of an equation and tried to correct it automagically. Unfortunately that rarely works well. You need to tell LaTeX that this is an equation.
To round out #nicoguaro's answer, use this form for equations that will be numbered and stand alone in the text:
\begin{equation}
\frac{2}{\left| w \right|}
\end{equation}
Or, use this form for equations that form part of a sentence:
blah blah $\frac{2}{\left| w \right|}$ blah blah.

Are this expression inside a mathematical environment like
\begin{equation}
...
\end{equation}
or $ $, \( \), \[ \] ?
The expression can be written as (using \[ \])
\[\frac{2}{\vert w \vert}\]
or just
\[\frac{2}{| w |}\]
You can see this book in Wikibooks. You need to specify that the whole expression is a mathematical expression enclosing it in its delimiters.

Related

LaTeX text goes out of page boundaries [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 5 years ago.
Improve this question
I'm a super beginner with latex, so please be patient and don't assume I know anything, thanks!
Using Overleaf.com I'm trying to create a CV based on this template:
https://www.latextemplates.com/template/awesome-resume-cv
However, the "skills" section does not behave the way I expected it: if I write a long list of skills, the words go beyond the page limit on the right instead of starting a new line. How do I fix this?
I tried by using \\ to end the line, but that gives a syntax error.
Thank you!
I just tried to follow the problem you describe. In order to do that I created to sample lists of skills:
\cvskill
{Sample} % Category
{Sample A, Sample B, Sample C, Sample D, Sample E, Sample F, Sample G, Sample H, Sample I, Sample J, Sample K, Sample L, Sample M, Sample N, Sample O} % Skills
\cvskill
{Sample 2} % Category
{Averylongskillnamethatmayexceedthepage A, Averylongskillnamethatmayexceedthepage B, Averylongskillnamethatmayexceedthepage C, Averylongskillnamethatmayexceedthepage D, Averylongskillnamethatmayexceedthepage E, } % Skills
After compiling the skills section looks as follows:
So according to my view line breaks are added correctly. In case you are annoyed by slightly overarching text items like "Sample K" you can add a \newline before the corresponding item to force a manual line break.
The \ command is no 'line ending' symbol and even the command \\ which does exactly this should not work, as the cvskill command internally uses a tabular environment, which accepts the \newline command but not \\.
In case I missed to solve your problem please provide a more extensive problem description including a valid and recreateable example! Otherwise it's very complicated to narrow down the exact issue you have.

Error: missing \begin{document} in LaTeX [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
I have error in my LaTeX document, when run my file, have a error
! LaTeX Error: Missing \begin{document}.
and this tag \begin{document} exists in my code
\documentclass[12pt‎, ‎a4paper]{article}‎
\usepackage{graphicx} % inserting images
\usepackage[top=3cm,right=3cm,bottom=2.5cm,left=2.5cm]{geometry}
\usepackage[colorlinks,linkcolor=blue,citecolor=red]{hyperref}
\usepackage{multirow}
\usepackage{subfig}
\usepackage{algorithm}
\usepackage{algorithmic}
%\usepackage[utf8]{inputenc}
%\usepackage{color, pdfcolmk}
%\usepackage{sweave}
% setting the margins of page
\usepackage{xepersian}
\usepackage{setspace}
\settextfont[Scale=1.2]{XB Zar}
\setlatintextfont[Scale=1.1]{XB Zar}
\setdigitfont{XB Zar}
\setcounter{secnumdepth}{3}
\SepMark{-}
\DefaultMathsDigits
%-----------------------list-------------------------------------
\renewcommand{\listfigurename}{فهرست شکل ها}
\renewcommand{\listtablename}{فهرست جدول‌ها}
\renewcommand{\refname}{\rl{{مرجع‌ها}\hfill}}
%---------------------end list-------------------------------------
%\usepackage{geometry}\geometry{left=35mm,right=35mm, top=30mm,bottom=30mm}
\begin{document}
\pagenumbering{gobble}
\clearpage
\thispagestyle{empty}
When I copy the code you have shown here into Notepad++ with UTF-8 input encoding, I get the following result for the first line:
\documentclass[12pt?, ?a4paper]{article}?
From that I assume that you have non-UTF-8 characters which aren't recognized by LaTeX and thus it throws an error. Try to replace that line by
\documentclass[12pt, a4paper]{article}
As #nowox remarked in a comment, the \end{document} is missing. Make sure that you have that in your file.

How can I get a cedilla within an equation block? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I'm writing a document in latex and I can't get the cedilla character working within an equation block. My current charset is utf8, \c{c} don't work as stated in many LaTeX documents.
I'm trying the following:
\begin{equation}
\label{eq:accuracy}
confiança = \frac{tp + tn}{tp + fp + fn + tn}
\end{equation}
The workaround given here don't work.
There are two issues here. First, \c{c} does not work in math mode. You need to switch back to text mode (\textit preserves the italics and does not require amsmath):
\begin{equation}
\label{eq:accuracy}
confian\textit{\c{c}}a = \frac{tp + tn}{tp + fp + fn + tn}
\end{equation}
The second is that writing a full word in math mode will give you terrible kerning. Compare with this:
\begin{equation}
\label{eq:accuracy}
\textit{confian\c{c}a} = \frac{tp + tn}{tp + fp + fn + tn}
\end{equation}

Implicit linebreaks in LaTeX equations

I wonder if there is any way to invert the way the LaTeX interprets linebreaks in equations? E.g., I dont want to insert them explicitly like,
\begin{gather}
x = y \\
a = c
\end{gather}
, but implicitly like,
\begin{gather}
x = y
a = c
\end{gather}
Thanks.
This is against the intention of TeX’s author, who believed that math must be typeset by hand. I tried obeylines, but to no avail. I guess it’s possible by making new line active, but you should ask the cracks over at Stack Exchange, a branch of Stack Overflow for TeX and LaTeX.
The breqn package will automatically insert linebreaks in equations when the line is full. I don't know of anything that will do break as you ask. If it is a big deal you could use perltex to define a macro that would do it for you. I will try to mock one up as an example.

How to strike out inside LaTeX equations? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Please see the snippet below and tell me how can I achieve the same strike-out effect as in the main text. I am using the version of LaTeX from the latest Ubuntu repositories.
\documentclass{article}
\usepackage{ulem}
\begin{document}
The sout tag works perfect in the \sout{main text area} but not inside the equations.
$$
list = [1, \sout{2}, 3, \sout{4}, 5, \sout{6}, 7, \sout{8}, 9, \sout{10}]
$$
Any clue?
\end{document}
Here is LaTeX output
It looks like the \sout doesn't work inside a math env.
You can try doing something like this, which works:
\documentclass{article}
\usepackage{ulem}
\begin{document}
The sout tag works perfect in the \sout{main text area} but not inside the equations.
$list = $[1, \sout{2}, 3, \sout{4}, 5, \sout{6}, 7, \sout{8}, 9, \sout{10}$]$
Any clue?
\end{document}
If anyone's still interested, I just found out about the cancel package, which allows you to strike your text in math mode in a few different ways. It's not horizontal, though -- only diagonal, which in my case is much better.
If you need to keep the strikeout in Math mode (e.g., to keep Math fonts) try:
\newcommand{\msout}[1]{\text{\sout{\ensuremath{#1}}}}
then
$\msout{\mathsf{stuckout}}$
you need amsmath and ulem.
(Solution from here.)
Pretty much any non-math-mode command can be used inside mathmode by putting it within a \text{} environment, e.g.:
\documentclass{article}
\usepackage{ulem}
\begin{document}
The sout tag works perfect in the \sout{main text area} but not inside the equations.
\[ list = [1, \text{\sout{2}}, 3, \text{\sout{4}}, 5, \text{\sout{6}}, 7, \text{\sout{8}}, 9, \text{\sout{10}}] \]
Any clue?
\end{document}
And if you'd like to be able to use strike-out without having ulem redefine how \emph{} works, use \usepackage[normalem]{ulem}.

Resources