366

$$ is TeX primitive syntax, which, as others have commented is hard to redefine (in classic TeX there is no command name which triggers entering or leaving display math). LaTeX doesn't officially support $$. The most noticeable failure if you use the syntax is that the fleqn option will no longer affect the display of the mathematics, it will remain ...


173

The PDF format supports a feature "ActualText" that is used for copy-paste instead of the actual typeset text. However, it is not supported by all PDF viewers, but Acrobat Reader does support it. \documentclass{article} \usepackage{accsupp} \newcommand*{\copyable}[1]{% \BeginAccSupp{% ActualText=\detokenize{#1},% method=escape, }% #1% \...


112

You can use multline or split provided by amsmath package. Use multline to split equations without alignment (first line left, last line right) Use split to split equations with alignment Here are examples: The corresponding source code is as follows: (i).Use equation: \begin{equation} 1+2+3+4+8x+7=1+2+3+4+4x+35 \\ \Rightarrow x=7 \end{equation} (ii)....


102

Define your own environment for this; here I realize it as a two column alignment; the first column is typeset in math mode, the second one in text mode; the = is added automatically, with the correct spacing. \documentclass{article} \usepackage{array} \newenvironment{conditions} {\par\vspace{\abovedisplayskip}\noindent\begin{tabular}{>{$}l<{$} @{${...


96

Here's a sample document without the use of amsmath package: \documentclass{article} \begin{document} \[ \alpha(x)=\left\{ \begin{array}{ll} x\\ \frac{1}{1+e^{-kx}}\\ \frac{e^x-e^{-x}}{e^x+e^{-x}} \end{array} \right. \] \end{document} or one with ...


88

The following illustrates font size alterations in mathmode: \documentclass[letterpaper]{article} \usepackage{graphicx} % Necessary to use \scalebox \usepackage{amsmath,amssymb} \begin{document} \noindent normal: $ x^2 + 2xy + y^2 $\\ displaystyle: $ {\displaystyle x^2 + 2xy + y^2} $\\ scriptstyle: $ {\scriptstyle x^2 + 2xy + y^2} $\\ ...


87

Some remarks about punctuation within displayed math from the practice of professional typesetting : Displayed equation usually are considered to be part of the preceding sentence, that is it will get the very same punctuation as if it was inline math: if the sentence ends in a displayed equation it gets a period, if a where … is … or something like that ...


77

The command \ref is defined in the LaTeX Kernel. The command \eqref is defined by amsmath. In the documentation of amsmath you will find the explanation in section 3.11.2 Cross references to equation numbers. \eqref puts brackets around the reference number. It's also places the references in in \upshape (or \textup), to match the equation reference exactly ...


77

You can manually add a vertical distance to each line-break. I hope, this is what you want. % arara: pdflatex \documentclass{article} \usepackage{mathtools} \begin{document} \setcounter{equation}{2} \begin{equation} \begin{aligned} T_{P} &= K_{T}. \rho . n^{2}_{p} . D^{4}_{p} \\[1pt] Q_{P} &= K_{Q}. \rho . n^{2}_{p} . D^{5}_{p} ...


74

You can also use the split environment inside the align environment, using an ampersand (&) where you want the alignment to take place. Here is a MWE: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{align} \begin{split}\label{eq:1} a ={}& b + c + d\\ & + e + f + g \end{split}\\ \begin{split}\label{eq:2} k ={...


73

I would not use the equation environment; rather, I would use flalign as such: \documentclass{article} \usepackage{amsmath} \begin{document} \noindent A \hfill Z \begin{flalign} a_{ijk} &= \frac {Pr(M_{I} =2 \& M_J=1 \& M_K =1 | I=i , J=j , K=k)}{Pr (M_I =1 \& M_J =1 \& M_K=1 | I=i , J=j)}&&\\\nonumber &= \frac {...


70

The amsmath package provides the command \numberwithin which can be used in your document as \numberwithin{equation}{section} A MWE follows \documentclass{article} \usepackage{amsmath} \numberwithin{equation}{section} \begin{document} \section{Here is a section} \begin{equation} f(x)=x^2+\sin(x) \end{equation} \end{document}


62

array is not designed for aligning equations, it is designed for arrays and matrices. The amsmath package has a host of alignment environments, I give a couple of examples: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{align} \mathcal{L}^{-1}\left\{f(d)\right\} &= \mathcal{L}^{-1}\left\{f_1(\delta).f_2(\delta)\right\} \\ & =...


62

You do not say what you expect \mathrm to do however it switches to the roman font font specified by the math version in use, which is what your images show. You will see the difference between \text (which switches to the current text font) and \textnormal (which switches to the document default font) if you test it at a point where the current text font ...


58

One way to solve this is to insert a "vertical phantom" -- an object with a certain height and depth but no width and therefore invisible, hence its name "phantom" -- in the second \underbrace expression. In the case at hand, an immediately ready argument for such a \vphantom is the tallest "math molecule" from the first \underbrace expression; this turns ...


57

Just put \small before the equation and \normalsize after it if you want to shrink the font, but it's usually better to use an ams multi-line equation environment than to change font size. It's actually easier to only do the part of a size change command that affects math without changing the baseline to avoid the problems @barabara-beeton mentions. This ...


54

You can adjust the values of \abovedisplayskip, \belowdisplayskip, \abovedisplayshortskip, \belowdisplayshortskip. The shortskip versions are used in the situation where a short text line comes before the displayed equation: if the text ends before the displayed equation starts, it's good to add less vertical space. Since document classes often define those ...


54

If you only want then occasionally, perhaps you can just roll-your-own by using a little bit of negative space, like this Maths in double brackets $[\![ e=mc^2 ]\!]$ or double parentheses $(\!( a^2 )\!)$. Note that they will not scale nicely with \left and \right because of the fixed negative space. If you'll be using them a lot, try using a package like ...


51

Here's a slightly better way to do this (IMO): Using the split environment within an align will produce one equation number, vertically centered within the split (so long as there's not a page break involved, as discussed here). Note that you can have individual labels for each equation by adding \label{} to the end of each line before the line break \\ ...


50

Instead of aligned, I would suggest an align environment; \notag can be used to suppress the tag for selected lines; the alignment for the second line can be produced with the help of a \phantom: \documentclass[10pt]{article} \usepackage[T1]{fontenc} \usepackage{amsmath, amsthm, amssymb} \usepackage[ansinew]{inputenc} \begin{document} \begin{align} \alpha &...


47

It is also possible to put the equation into the brackets and then use the \middle/ instead of the regular slash. So, for example, this equation: \int \limits_{a}^{b} \frac{x}{y} / \int \limits_c^d \frac{x}{y} would turn into this one: \left[ \int \limits_{a}^{b} \frac{x}{y} \middle/ \int \limits_c^d \frac{x}{y} \right] Or if you do not need any visible ...


46

tcolorbox also offers several options for boxed math expressions. tcbhighmath is an special box which can be used with empheq package, but it's also easy to declare new boxes to use with empheq. Some examples with the code: \documentclass{article} \usepackage{amsmath} \usepackage{empheq} \usepackage[most]{tcolorbox} \newtcbox{\mymath}[1][]{% ...


44

In the displaymath mode, you can not use any paragraph triggering commands such as blank lines or \par commands. (Not a good idea, but you can use it inside the cases environment). Also you don't need to switch to text mode and then again to math mode. You can just use text on the text and leave the rest as it is. Another point is the use of & ...


44

I tried to look for other questions with the same problem and found none. So here's an answer: load cleveref last. From the documentation: The cleveref package is loaded in the usual way, by putting the line \usepackage{cleveref} in your document’s preamble. However, care must be taken when using cleveref in conjunction with other packages that modify ...


43

Additionally to the above answers, as asked in comments, the command \allowdisplaybreaks from amsmath can be used locally do a display break by using the \begingroup and \endgroup commands: \begingroup \allowdisplaybreaks \begin{align} .... \end{align} \endgroup


42

Consider the package mathtools, which provides several corrections for and additions to amsmath. \usepackage{mathtools} It also provides a comfortable solution for your problem. You can even choose between a normal (\vdotswithin) and a short (\shortvdotswithin) distance. \begin{align*} a &= b \\ & \vdotswithin{=} \\ & = c \\ \...


42

How about: \documentclass{article} \usepackage{amsmath} % for the "align" and "align*" environments \begin{document} \begin{align*} % the "starred" equation environments produce no equation numbers a &= b\\ % if no alignment is needed, use the gather* instead of the align* env. &= c \end{align*} \end{document} If you do use the unstarred version,...


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|...


41

I've found this answer too. It gives a command that you can use to patch math environments as needed. I figure it does the same thing as presented above, but it doesn't hurt to have several solutions. I cannot see the difference in line spacing when it is included in preamble or not, but the line numbers that aren't shown before, show up after it is added. ...


Only top voted, non community-wiki answers of a minimum length are eligible