Math & ScienceProblems with the cancel package

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Jonny Boy
Posts: 7
Joined: Mon Feb 05, 2007 4:54 pm

Problems with the cancel package

Post by Jonny Boy »

I having problems with the \cancelto command in the cancel package, in that if you close a bracket immediately after the command, the cancelled to value and the brackets merge into one.

The documentation makes reference to a makeroom package option, but can't seem to find how to use said option, so either instructions on the makeroom option, or another solution to the problem would be greatly appreciated.

Code: Select all

\documentclass[11pt]{amsart}
\usepackage{amssymb,a4wide,cancel}
\newcommand{\lb}{\left(}
\newcommand{\rb}{\right)}
\newcommand{\lsb}{\left[}
\newcommand{\rsb}{\right]}
\newcommand{\brac}[1]{\lb #1\rb}
\newcommand{\sqbrac}[1]{\lsb #1\rsb}
\newcommand{\intx}[3]{\int_{#2}^{#3} #1 \ dx}
\newcommand{\fpi}[2]{\frac{#1\pi}{#2}}

\begin{document}
\begin{align*}
\text{Volume}&=\pi\intx{\brac{\frac{3}{\sqrt{1+4x}}}^2}{0}{2} \\
&=\pi\intx{\frac{9}{1+4x}}{0}{2} \\
&=\fpi{9}{4}\intx{\frac{4}{1+4x}}{0}{2} \\
&=\fpi{9}{4}\sqbrac{\ln\brac{1+4x}}^2_0 \\
&=\fpi{9}{4}\sqbrac{\ln9-\cancelto{0}{\ln 1}}=\fpi{9}{4}\ln9
\end{align*}
\end{document}
Last edited by Jonny Boy on Fri Apr 23, 2010 11:18 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Problems with the cancel package

Post by frabjous »

Seems to work just fine for me with the makeroom option, used as so:

Code: Select all

\documentclass[11pt]{amsart}
\usepackage{amssymb,a4wide}
\usepackage[makeroom]{cancel}
\newcommand{\lb}{\left(}
\newcommand{\rb}{\right)}
\newcommand{\lsb}{\left[}
\newcommand{\rsb}{\right]}
\newcommand{\brac}[1]{\lb #1\rb}
\newcommand{\sqbrac}[1]{\lsb #1\rsb}
\newcommand{\intx}[3]{\int_{#2}^{#3} #1 \ dx}
\newcommand{\fpi}[2]{\frac{#1\pi}{#2}}

\begin{document}
\begin{align*}
\text{Volume}&=\pi\intx{\brac{\frac{3}{\sqrt{1+4x}}}^2}{0}{2} \\
&=\pi\intx{\frac{9}{1+4x}}{0}{2} \\
&=\fpi{9}{4}\intx{\frac{4}{1+4x}}{0}{2} \\
&=\fpi{9}{4}\sqbrac{\ln\brac{1+4x}}^2_0 \\
&=\fpi{9}{4}\sqbrac{\ln9-\cancelto{0}{\ln 1}}=\fpi{9}{4}\ln9
\end{align*}
\end{document}
Jonny Boy
Posts: 7
Joined: Mon Feb 05, 2007 4:54 pm

Re: Problems with the cancel package

Post by Jonny Boy »

Thanks, that's great!
Post Reply