7

I want to know the meaning of the triple $ in my document.

\documentclass[12pt]{article}

\usepackage[letterpaper]{geometry} 
\geometry{top=1.5cm, bottom=2.5cm, left=3cm, right=3cm}
\usepackage{amsmath}
\usepackage{multicol}
\usepackage[usenames]{color}


\begin{document}
\section*{Solucionario}
%\begin{multicols}{2} 
\begin{enumerate}

\item  $\displaystyle \int_{-1}^{2} x^3-2x\:dx $ 
\begin{equation}
$$$
\notag \displaystyle\int_{-1}^{2} x^3\:dx-\displaystyle \int_{-1}^{2} 2x\:dx  \\ \\ \\
\notag \displaystyle \left. \frac{x^4}{4}\right|_{-1}^{2}-\left.\frac{2x^2}{2}\right|_{-1}^{2} \\ \\ \\ 
\notag \displaystyle \left. \frac{x^4}{4}\right|_{-1}^{2}-\left.x^2\right|_{-1}^{2}\\ \\ \\
\left(4-\frac{1}{4}\right)-(4-1)\\ \\ \\
\frac{15}{4}-3 \ = \ \textcolor{red}{\frac{3}{4}}
$$$
\end{equation}

\item $\displaystyle \int_{0}^{1} x^{4/5}\:dx $
\begin{equation}
$$$
\notag \displaystyle \left.\frac{x^{9/5}}{\frac{9}{5}}\right|_{0}^{1} \\ \\ \\
\notag \displaystyle \left.\frac{5x^{9/5}}{9}\right|_{0}^{1} \: = \: \textcolor{red}{\frac{5}{9}}
$$$
\end{equation}

\item $\displaystyle \int_{0}^{1} \frac{4}{t^2+1}\:dt $
\begin{equation}
$$$
\notag 4\displaystyle \int_{0}^{1} \frac{1}{t^2+1}\:dt \\ \\ \\
\notag \left.4 \tan^{-1} t\:\right|_{0}^{1}\\ \\ 
\notag \textcolor{red}{180\: =\:\pi}
$$$
\end{equation}

\end{enumerate}
%\end{multicols}
\end{document}
Mico
  • 506,678
  • 3
    Your equations are very strange and $$$ doesn't make sense at all. The question i am asking right now: Why do you use it, where did you find that? – Johannes_B Jun 16 '16 at 04:44
  • I use that because ShareLatex show me an error when I use one or two $. Pd:The equations are the solution of an integral. – PlusCode X Jun 16 '16 at 05:06
  • 19
    You shall not use one $, nor two $, nor three $ in an equation environment. – Johannes_B Jun 16 '16 at 05:20
  • 3
    @PlusCodeX: Use only \begin{equation}...\end{equation} without $$$. – Werner Jun 16 '16 at 05:20
  • What you are probably looking for is gather*. – Johannes_B Jun 16 '16 at 05:21
  • I've taken the liberty of copying and pasting the code from the linked page to the body of your posting. – Mico Jun 16 '16 at 05:33
  • 7
    @Johannes_B - Or, "Thou shalt not ..." -- an Eleventh Commandment! :-) – Mico Jun 16 '16 at 06:10
  • 5
    @Johannes_B --- five is right out! – Ian Thompson Jun 16 '16 at 08:06
  • @IanThompson I was thinking exactly the same :) – cgnieder Jun 16 '16 at 16:07
  • 1
    So you made up your own symbol sequence in order to avoid an error, and now you are asking what your symbol means? – MCMastery Jun 16 '16 at 17:10
  • 3
    I've said it before and I'll say it again. Getting hands on and getting stuck in and learning by doing is a great way to learn LaTeX and it's very fulfilling and probably more immediately productive, and who wants to page through a long dry manual anyway? But you've got to get a decent introduction and learn the very basics before diving right on in there and when you want to use a new environment you should look up how to do so. At the very least, if you encounter a problem, don't just hack your way around it, but look up what the error means and how to solve it – Au101 Jun 16 '16 at 22:41
  • 2
    Which is basically a long way of saying, please consider looking at a good beginner's guide, it will help in the long run! And by all means, get hands on, please, you don't need to read a manual cover to cover before you type your first backslash, but a little theory would go a long way – Au101 Jun 16 '16 at 22:44
  • 1
    Thanks to everybody. I never thought that my question would be so popular. I am going to look a good beginner´s guide and practice a lot about the differents environments. – PlusCode X Jun 17 '16 at 01:10

2 Answers2

42

The markup is completely wrong and should be removed, but to answer the question of what it means

\begin{equation}
$$$
\notag \displaystyle\int_{-1}^{2} x^3\:dx-\displaystyle \int_{-1}^{2} 2x\:dx  \\ \\ \\
\notag \displaystyle \left. \frac{x^4}{4}\right|_{-1}^{2}-\left.\frac{2x^2}{2}\right|_{-1}^{2} \\ \\ \\ 
\notag \displaystyle \left. \frac{x^4}{4}\right|_{-1}^{2}-\left.x^2\right|_{-1}^{2}\\ \\ \\
\left(4-\frac{1}{4}\right)-(4-1)\\ \\ \\
\frac{15}{4}-3 \ = \ \textcolor{red}{\frac{3}{4}}
$$$
\end{equation}

\begin{equation} starts a latex enviornment then does $$ to start display math.

Then you have $$ which ends display math with an empty display, but adding vertical space.

Then you have $ which starts inline math which is why you need \displaystyle everywhere.

Then you have $ which ends the inline math,

Then you have $$ which starts another display math, adding vertical space.

Then you have \end{equation} which closes the empty display math, adding more spurious vertical space and closing the latex environment.

David Carlisle
  • 757,742
16

The $$$ directives appear to be there to cope with and work around some rather questionable coding practices embedded in your code. The instances of $$$ occur in pairs. The first instance of each pair is interpreted by TeX as $$ (end of displaymath mode that was initiated by the preceding \begin{equation} environment plus a line break) followed by $ (start of inline math mode). The second instance is interpreted by TeX as $ (end of inline math mode) followed by $$ (line break followed by start of displaymath mode, to be terminated later on, by the subsequent \end{equation} instruction). This method "works", but just barely, and requires the use of lots and lots of \displaystyle directives that clutter up the code.

Since you're using multi-line equations, you shouldn't be using equation environments to begin with. Instead, you should use align* environments along the lines shown in the following example. You should also get rid of the "\:" and "\" spacing directives. (Use \, to offset the dummy variable of integration, not \:.)

enter image description here

\documentclass[12pt]{article}

\usepackage[letterpaper]{geometry} 
\geometry{top=1.5cm, bottom=2.5cm, hmargin=3cm}
\usepackage[fleqn]{amsmath}
\usepackage{xcolor}

\begin{document}
\section*{Solucionario}
\begin{enumerate}

\item  $\displaystyle \int_{-1}^{2} x^3-2x\,dx $ 
\begin{align*}
&= \int_{-1}^{2} x^3\,dx-\int_{-1}^{2} 2x\,dx \\
&= \left. \frac{x^4}{4}\right|_{-1}^{2}-\left.\frac{2x^2}{2}\right|_{-1}^{2} \\ 
&= \left. \frac{x^4}{4}\right|_{-1}^{2}-\left.x^2\right|_{-1}^{2}\\ 
&= \left(4-\frac{1}{4}\right)-(4-1)\\
&= \frac{15}{4}-3 = \textcolor{red}{\frac{3}{4}}
\end{align*}

\item $\displaystyle \int_{0}^{1} x^{4/5}\,dx $
\begin{align*}
&= \left.\frac{x^{9/5}}{9/5}\right|_{0}^{1} \\
&= \left.\frac{5}{9}x^{9/5}\right|_{0}^{1} = 
   \textcolor{red}{\frac{5}{9}}
\end{align*}

\item $\displaystyle \int_{0}^{1} \frac{4}{t^2+1}\,dt $
\begin{align*}
&= 4\int_{0}^{1} \frac{1}{t^2+1}\,dt \\
&= \left.4 \tan^{-1} t\:\right|_{0}^{1}\\
&= \textcolor{red}{180}=\textcolor{red}{\pi}
\end{align*}

\end{enumerate}
\end{document}

Addendum: Here's another attempt to fix up your code; note the use of top-aligned aligned environments to unify the multiline equations associated with each \item. If you need to allow page breaks inside the aligned environments, I suggest you add the instruction \allowdisplaybreaks in the preamble.

enter image description here

\documentclass[12pt]{article}
\usepackage[letterpaper]{geometry}
  \geometry{top=1.5cm, bottom=2.5cm, hmargin=3cm}
\usepackage{amsmath}
\usepackage{xcolor}


\begin{document}
\section*{Solucionario}
\begin{enumerate}

\item  $\!\begin{aligned}[t]
&\int_{-1}^2 (x^3-2x)\,dx \\
&\quad= \int_{-1}^2 x^3\,dx -\int_{-1}^2 2x\,dx \\
&\quad= \frac{x^4}{4} \,\bigg\vert_{-1}^2
         -\frac{2x^2}{2} \,\bigg\vert_{-1}^2 \\
&\quad= \frac{1}{4}\,x^4 \,\big\vert_{-1}^2
         -x^2 \,\big\vert_{-1}^2\\
&\quad= \frac{1}{4}(16-1)-(4-1)\\[1ex]
&\quad= \frac{15}{4}-3 = \textcolor{red}{\frac{3}{4}}
\end{aligned}$

\item $\!\begin{aligned}[t]
&\int_0^1 x^{4/5}\,dx \\
&\quad= \frac{x^{9/5}}{9/5} \,\bigg\vert_0^1 \\
&\quad= \frac{5}{9}\,x^{9/5} \,\big\vert_0^1 =
   \textcolor{red}{\frac{5}{9}}
\end{aligned}$

\item $\!\begin{aligned}[t] 
&\int_0^1 \frac{4}{t^2+1}\,dt \\
&\quad= 4 \int_0^1 \frac{1}{t^2+1}\,dt \\
&\quad= 4 \tan^{-1} t \,\big\vert_0^1\\
&\quad= 4\,\frac{\pi}{4}=\textcolor{red}{\pi} = 180^\circ
\end{aligned}$

\end{enumerate}
\end{document}
Mico
  • 506,678
  • 3
    Incidentally, I share @egreg's doubt that 180=\pi. If you must show the non-radians term, please write 180^{\circ}. – Mico Jun 16 '16 at 06:21