How to write something top another math symbol latex

For many people the most useful part of LaTeX is the ability to typeset complex mathematical formulas. for the sake of simplicity, LaTeX separates the tasks of typesetting mathematics and typesetting normal text. This is achieved by the use of two operating modes, paragraph and math mode. There is also a third mode called LR mode, however, this is rarely used by beginners and furthermore, is usually implicitly entered with other commands. It will not be covered here. Paragraph mode is the default mode for the document environment and does not need to be called explicitly.

There are a few ways to enter math mode, however the most common is $....$, where the text within the dollar signs is in the math mode environment. You have already been using math mode unknowingly by using the \begin{equation} and \end{equation} commands.

The following table lists three methods and their usage of declaring math mode.

Method Special Characteristics Usage$....$ None In-line math\begin{equation} \end{equation} Goes to a newline and center equation with label Equations\[ ....\] Goes to a newline and center equation Equations with no label

There are equivalent ways of entering math mode for each of these methods, for example, $$....$$ is equivalent to \[ ....\], however, the latter is now strongly preferred. I almost always use the first two methods for typesetting basic math.

Now try the following LaTeX code.

\documentclass{article} \begin{document} \begin{equation} \int_\alpha^\beta f'(x) \, dx=f(\beta)-f(\alpha). \end{equation} We can use the fundamental theorem of calculus to say that $\int_2^3 x^2 \, dx=\frac{3^3}{3}-\frac{2^3}{3}=\frac{19}{3}$. Also note that $\displaystyle \int_2^3 x^2 \, dx=\frac{3^3}{3}-\frac{2^3}{3}=\frac{19}{3}$. We can also give this equation its own line [ \int_2^3 x^2 \, dx=\frac{3^3}{3}-\frac{2^3}{3}=\frac{19}{3}. ] \end{document} Note that math mode ignores whitespace, in fact, this whole code could have been put on one line and still would have compiled correctly. Another thing to notice is the effect of the \displaystyle command. This command forces LaTeX to give an equation the full height it needs to display as if it were on its own line. Be careful in using it as it can make a document due to variable line height.

In LaTeX it is straightforward to include mathematical equations and notation in your document. Often you will want to do this using one of the maths environments, such as the equation`environment, i.e. you will use \begin{equation}...\end{equation}`. Everything inside this environment uses a "maths mode", which defines a large number of useful commands and symbols.

Every equation environment contains a single equation, and this is usually numbered. You can use \label{} to reference it in your text just like any other object. If you don't want your equation to be numbered then there's an equivalent non-numbered environment called displaymath (NB not equation*).

If you want to write several equations together then you can use the eqnarray environment. At the end of each equation you start a new line using \ as usual. The eqnarray environment lets you align equations so that, for example, all of the equals signs "=" line up. To do this, put ampersand "&" signs around the text you want LaTeX to align, e.g. \begin{eqnarray} F &=& ma\ V &=& IR \end{eqnarray}

Each equation can be labelled separately, just put the label command after the relevant equation. You can also suppress the numbering for any particular equations by adding the command `equation`0 after the equation; if you don't want any of the equations to be numbered then use the `equation`1 environment instead.

6.2 Maths Commands and Symbols

Almost every conceivable symbol and operation is defined within LaTeX, and we only have time to go into a few here. Some of the most useful for scientists are:

  • `equation`2 the text in between the brackets is a subscript, e.g. `equation`3; if the subscript is only a single character you can omit the curly brackets.
  • `equation`4 the text in between the brackets is a superscript, e.g. `equation`5; if the superscript is only a single character you can omit the curly brackets, e.g. `equation`6.
  • `equation`7 typesets the Greek letter lambda. Use `equation`8 for the capitalised form. The whole of the Greek alphabet is defined similarly.
  • equation`9 puts a "hat" on top of the text, for example you could use \begin{equation}...\end{equation}`0 for a Hamiltonian operator.
  • `\begin{equation}...\end{equation}`1 is used to typeset a fraction. The numerator is the first argument, and the denominator the second.
  • \begin{equation}...\end{equation}`2 typesets a summation; the limits can be specified as subscripts and superscripts, as in this example. There's also \begin{equation}...\end{equation}`3 for products, and
  • \begin{equation}...\end{equation}`4 the integral sign; also \begin{equation}...\end{equation}`5 for loop integrals. Limits are specified as subscripts and superscripts, as for summations.
  • \begin{equation}...\end{equation}`6 makes a small circle, most useful for doing things like \begin{equation}...\end{equation}`7 to show 180-degrees.
  • `\begin{equation}...\end{equation}`8 makes a multiplication sign
  • `\begin{equation}...\end{equation}`9 plus or minus (`equation`0 for minus or plus)
  • `equation`1 the "square-root" sign
  • `equation`2 the "equivalent" sign
  • `equation`3 the "approximately equal" sign
  • `equation`4 the "of the order of" squiggly line
  • `equation`5 the "not equal to" sign
  • `equation`6 the symbol for the vector differential operator "del"
  • `equation`7 the partial derivative "curly d"
  • `equation`8 the symbol for "for all"!
  • `equation`9 the symbol for "there exists"!
  • `\label{}`0 infinity
  • \label{}`1 special character for the imaginary number i (alternatively \label{}`2 if you use j for this number)
  • `\label{}`3 h-bar, i.e. Planck's constant over 2.pi
  • \label{}`4 gives an ellipsis "..." (also \label{}5 which puts the dots in the middle of the line, \label{}6 which has three vertical dots and \label{}`7 which puts three dots diagonally from top-left to bottom-right)
  • `\label{}`8 makes a single dot
  • `\label{}`9 the "implies" arrow
  • `displaymath`0 the sine function (also `displaymath`1, `displaymath`2, `displaymath`3 etc. as well as `displaymath`4, `displaymath`5, `displaymath`6 and the hyperbolic functions)
  • `displaymath`7 is used for the "square-root" symbol. The mandatory argument is what is to be "rooted"; there's also an optional argument (put in square brackets before the curly ones) which defines the "power" of the root. E.g. the cube-root of two would be `displaymath`8
  • `displaymath`9 gives a small vertical line
  • `eqnarray`0 puts "x" above "y"

6.3 Maths Stuff in Text

Sometimes you don't really want to put a full-blown equation in, you just want to include a snippet in your text, or use some maths "ideas" such as superscripts. To do this you can use the dollar sign "$" - anything in between two dollar signs is typeset in maths mode, so for example `eqnarray`1.

6.4 Brackets, Left and Right

There are several different types of brackets in LaTeX, from the ordinary round ones "(" and ")" to the curly "{" and "}" and the square "[" and "]". Unfortunately the curly and square ones are used by LaTeX to specify arguments, so if you want them to actually appear in your equation you need to "escape" them, as it's called, by putting a backslash in front of it, e.g. `eqnarray`2. This method works for any of the special symbols that LaTeX would normally treat as a command, e.g. "%" or "$".

When you're typing equations it's common to find that the default sizes for LaTeX's brackets are too small and they look a bit silly. To tell LaTeX to make brackets as big as a certain bit of an equation you use the `eqnarray`3 and `eqnarray`4 commands. The round bracket here can be replaced by any other bracket, or a full-stop which won't print anything but defines the start of the region. Try comparing `eqnarray`5 to `eqnarray`6 and you'll see what the `eqnarray`7 and `eqnarray`8 do!

6.5 Matrices

Writing out matrices is a little bit tricky at first, which is why I've devoted a section to it! You need to use the eqnarray`9 environment inside the maths one. It's easiest to see with an example: \`0

The argument to the array environment, \`1, means there are three centred columns (you don't need to specify the number or rows). You can use \2 or \`3 instead to align any particular column "right" or "left" respectively.

Inside the eqnarray`9 environment the columns are separated by "&", just as we used in the `eqnarray environment, and new rows are made just using the new line command \.

The eqnarray`9 environment can take an optional argument to specify that the rows should be top-aligned, e.g. \8, or use \`9 to ensure the rows are bottom-aligned.

Exercise 6

Add some equations to your document, and reference them in the text. Add a superscript or some greek letters in some of your paragraphs.

How do you put a symbol on top of a letter in LaTeX?

If you want to write a letter with a tilde on top of the letter, you can write $\tilde{x}$ . In this example the tilde will be displayed above the “x”. If you want more then one letter below the tilde you can use $\widetilde{xyz}$ .

How do you stack two symbols in LaTeX?

Putting a symbol above another.

\underset{expression below}{expression} puts an expression below another, using the subscript size below..

\overset{expression above}{expression} puts an expression above another, using the subscript size above..

What does \\ do in LaTeX?

The \\ command tells LaTeX to start a new line. It has an optional argument, extra-space , that specifies how much extra vertical space is to be inserted before the next line.

What is \mbox in LaTeX?

The \mbox command creates a box just wide enough to hold the text in its argument. The text in the box is in LR mode which prevents it from being broken across lines.