Typesetting Long Division in LaTeX: Tips and Tricks for Accurate Equations

In summary, the person is trying to input a graphics file from Mathematica, but is having an error. They have three possible solutions: 1) use pdfLaTeX to typeset the graphics file into a pdf; 2) convert the exported eps file to a pdf using something like PNG; or 3) use (e)ps2pdf to convert the eps file into a pdf. None of these solutions are particularly easy, but they all work.
  • #1
DivGradCurl
372
0
Does anyone know a way to typeset a long division in LaTeX? I'm particularly interested in:

[tex] \frac{1}{\cos x} = \frac{1}{1-\frac{x^2}{2!}+\frac{x^4}{4!}-\cdots} [/tex]

Thanks
 
Physics news on Phys.org
  • #2
Hi thiago,
Use the following code. Use pdflatex for making the pdf file.

documentclass{article}
\begin{document}
\Huge
${1\over{cosx}}= {1\over{1-{x^2\over{2!}}+{x^4\over{4!}}-...}} $\\
\end{document}

Gulumal
o:)
 
  • #3
I tried that... but it gives exactly what I put down initially:

[tex] \frac{1}{\cos x} = \frac{1}{1-\frac{x^2}{2!}+\frac{x^4}{4!}-\cdots} [/tex]

In fact, I've just figured it out. This goes in the preamble:

Code:
\usepackage{array}
\setlength{\extrarowheight}{0.12cm}

and this is the final code:

Code:
\begin{equation*}
\begin{array}{rc@{}c}
& \multicolumn{2}{l}{\, \, \, 1+\frac{1}{2}x^2 +\frac{5}{24}x^4-\dotsb} \vspace*{0.12cm} \\ \cline{2-3}
\multicolumn{1}{r}{1-\frac{1}{2!}x^2+\frac{1}{4!}x^4-\dotsb \hspace*{-4.8pt}} & \multicolumn{1}{l}{ \hspace*{-5.6pt} \Big) \hspace*{4.6pt} 1} \\
& \multicolumn{2}{l}{\, \, \, 1-\frac{1}{2!}x^2+\frac{1}{4!}x^4-\dotsb} \vspace*{0.12cm} \\ \cline{2-3}
& \multicolumn{2}{l}{\, \, \, \phantom{1{}-{}} \frac{1}{2!}x^2-\frac{1}{4!}x^4+\dotsb} \\
& \multicolumn{2}{l}{\, \, \, \phantom{1{}-{}} \frac{1}{2!}x^2-\frac{1}{\left(2!\right)^2}x^4+\dotsb} \vspace*{0.12cm} \\ \cline{2-3}
& \multicolumn{2}{l}{\, \, \, \phantom{1{}-{}\frac{1}{2!}x^2{}-{}} \frac{5}{24}x^4-\dotsb}
\end{array}
\end{equation*}

Thanks, anyway. If there is a simpler way to do this, please let me know. :smile:
 
  • #4
I'm trying to input a graphics file from Mathematica, but I'm having an error which says: unknown graphics extension: .eps Can anyone help me?
 
  • #5
.eps doesn't work with \usepackage[pdftex]{graphicx}

Hi.

You cannot use .eps files with

\usepackage[pdftex]{graphicx}

but instead you need to use

\usepackage[dvips]{graphicx}

However, with this you cannot use .png or .jpg files.

I usually take a screenshot (usally GeoGebra or Mathematica), save it as .png file and use the pdftex-graphicx package. Tell me if you have a better solution. I always make the conversion to pdf because couldn't make the .dvi file.
 
  • #6
thank you for your reply. I am using latex and I'm using a feature called {gsm-l} which changes the format of the first page of every chapter. The problem is that the pdf document I'm writing starts from the 3rd page not from 1st page. Please can you help me with this??
 
  • #7
Probably not, I'm not sure if I understand the problem...

If the problem if with page numbering, you can set it by \setcounter{page}{3}so the current page gets the number 3.

If you want your {gsm-l} "be in effect" only from page 3 on, or you have 2 blank pages in the beginning, I don't know how to help.
 
  • #8
camillerinadia said:
I'm trying to input a graphics file from Mathematica, but I'm having an error which says: unknown graphics extension: .eps Can anyone help me?

I had this problem in the past with eps files generated by Mathematica 5.2 but the new Mathematica 6.0 does a much better job and import and export of all kinds. Back when I had the same problem, I would load the eps from Mathematica into Adobe Illustrator, and then export it again and it would work in my LaTeX document!
 
  • #9
thiago_j said:
Does anyone know a way to typeset a long division in LaTeX? I'm particularly interested in:

[tex] \frac{1}{\cos x} = \frac{1}{1-\frac{x^2}{2!}+\frac{x^4}{4!}-\cdots} [/tex]

Thanks
In cases like this, when placing a fraction would become really ugly, I'd usually resort to something like
[tex]\left( 1-\frac{x^2}{2!}+\frac{x^4}{4!}-\cdots \right)^{-1}[/tex]
or the uglier
[tex]1 / \left( 1-\frac{x^2}{2!}+\frac{x^4}{4!}-\cdots \right)[/tex]


camillerinadia said:
I'm trying to input a graphics file from Mathematica, but I'm having an error which says: unknown graphics extension: .eps Can anyone help me?
Which version of Mathematica do you have? Mathematica 6.0 can now export in PDF format, which pdfLaTeX can handle very well. Otherwise, you'd have to use something like PNG or use (e)ps2pdf (should be included in your LaTeX distribution) to convert the exported (e)ps to a pdf (but problems may occur, in particular watch out with the bounding boxes).
 

What is LaTeX and why is it used for typesetting long division?

LaTeX is a typesetting system designed for producing technical and scientific documents. It is widely used in the academic and scientific community for its ability to produce high-quality and professional-looking equations, including long division. Its precise and flexible formatting features make it ideal for accurately typesetting complex equations.

How do I format long division in LaTeX?

To format long division in LaTeX, you can use the \longdiv command from the package "xlop". This command takes two arguments, the dividend and the divisor, and automatically formats the equation with the correct division symbol, alignment, and spacing.

What are some tips for ensuring accuracy when typesetting long division in LaTeX?

One tip is to use the \usepackage{amsmath} package to access the \frac command, which allows you to easily divide numbers and add them to your long division equation. It is also important to carefully check the alignment and spacing of each digit to ensure the equation is accurately represented.

How can I adjust the size and spacing of the numbers in my long division equation?

You can adjust the size and spacing of the numbers in your long division equation by using the \displaystyle command before the equation. This will make the numbers larger and increase the spacing between them for better readability.

Can I include long division equations in a larger document in LaTeX?

Yes, you can include long division equations in a larger document in LaTeX. You can use the \begin{equation} and \end{equation} tags to create a numbered equation or the \begin{align} and \end{align} tags to create a series of aligned equations. You can also use the \input command to include a separate LaTeX file containing your long division equation into your main document.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
905
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
541
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
944
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
272
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
Back
Top