From charlesreid1

No edit summary
Line 8: Line 8:


=Usage=
=Usage=
To use the cancel package in a LaTeX document, you have to include the following in your preamble:
<source lang="latex">
\usepackage{cancel}
</source>


There are two handy functions available from the cancel package: <code>cancel</code> and <code>cancelto</code>.   
There are two handy functions available from the cancel package: <code>cancel</code> and <code>cancelto</code>.   
To use cancel:
<pre>
\cancel{ a }
</pre>
To use cancelto:
<pre>
\cancel{ \infty }{ a }
</pre>
An example of using the cancel commands is given here:


{|
{|
Line 70: Line 90:


|}
|}
==Using Cancel Package in LyX==
You can use the cancel package from LyX by including the following in your preamble:
<source lang="latex">
\usepackage{cancel}
</source>
You can do this by opening your LyX document and clicking <code>Document > Settings...</code>, then picking the "Preamble" item from the sidebar.  You can then add the line to your preamble.
[[Image:LyxDocumentSettings.png|350px]]
To use it in the document, you have to type <code>\cancel{</code>.  The "cancel" and the "{" bracket should both appear in red, and a matching brace "}" should automatically appear.  If it doesn't, you probably forgot to add the above <code>\usepackage</code> to your preamble.
To use the <code>\cancelto{}{}</code> command, first type <code>\cancelto{</code>, and the matching brackets should appear.  Next, copy this pair of brackets, and choose paste after the first pair.
[[Image:LyxCancelUsage.png|350px]]

Revision as of 22:41, 19 April 2011

Installation

Download the cancel package here: ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/cancel.html

Mac OS X

You can install the cancel package on Mac by downloading cancel.zip, unzipping, and moving cancel.sty to ~/Library/texmf/tex/latex.

Usage

To use the cancel package in a LaTeX document, you have to include the following in your preamble:

\usepackage{cancel}

There are two handy functions available from the cancel package: cancel and cancelto.

To use cancel:

\cancel{ a }

To use cancelto:

\cancel{ \infty }{ a }

An example of using the cancel commands is given here:

Latex Source Result
\dfrac{\partial\phi}{\partial t}

+\dfrac{\partial\left(u_{i}\phi\right)}{\partial x_{i}}

= \dfrac{\partial}{\partial x_{i}}\left(
D_{\phi}\dfrac{\partial\phi}{\partial x_{i}}
\right)
CancelEqn1.png
\cancel{ \dfrac{\partial\phi}{\partial t} }

+\dfrac{\partial\left(u_{i}\phi\right)}{\partial x_{i}}

= \dfrac{\partial}{\partial x_{i}}\left(
D_{\phi}\dfrac{\partial\phi}{\partial x_{i}}
\right)
CancelEqn2.png
\dfrac{\partial\phi}{\partial t}

+\dfrac{\partial\left(u_{i}\phi\right)}{\partial x_{i}}

= \cancelto{0}{
\dfrac{\partial}{\partial x_{i}}\left(
D_{\phi}\dfrac{\partial\phi}{\partial x_{i}}
\right)
}
CancelEqn3.png
\dfrac{\partial\phi}{\partial t}

+\dfrac{\partial\left(u_{i}\phi\right)}{\partial x_{i}}

=\cancelto{0}{
\dfrac{\partial}{\partial x_{i}}\left(
\dfrac{1}{  \cancelto{\infty}{Pr}  }
\,\,\,\,\,\,\,\,\dfrac{\partial\phi}{\partial x_{i}}
\right)
}
CancelEqn4.png

Using Cancel Package in LyX

You can use the cancel package from LyX by including the following in your preamble:

\usepackage{cancel}

You can do this by opening your LyX document and clicking Document > Settings..., then picking the "Preamble" item from the sidebar. You can then add the line to your preamble.

LyxDocumentSettings.png

To use it in the document, you have to type \cancel{. The "cancel" and the "{" bracket should both appear in red, and a matching brace "}" should automatically appear. If it doesn't, you probably forgot to add the above \usepackage to your preamble.

To use the \cancelto{}{} command, first type \cancelto{, and the matching brackets should appear. Next, copy this pair of brackets, and choose paste after the first pair.

LyxCancelUsage.png