Math & ScienceFraction in plain TeX

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
tex_eugene
Posts: 4
Joined: Sat Apr 14, 2012 11:29 am

Fraction in plain TeX

Post by tex_eugene »

Hi, I have been trying to use $\frac{abc}{xyz}$ in TeXworks, but I failed to do so. Can someone help me? the error message is:

Code: Select all

This is pdfTeX, Version 3.1415926-1.40.11 (MiKTeX 2.9)
entering extended mode
(C:\Users\Eugene\Desktop\untitled-2.tex
! Undefined control sequence.
<recently read> \frac 
                      
l.2 $\frac
          {a}{b}$
? 
Thanks!!!
Last edited by localghost on Mon Apr 16, 2012 9:11 am, edited 3 times 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.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Fraction in plain TeX

Post by Stefan Kottwitz »

Hi,

welcome to the board!

\frac is a LaTeX command and available by default. I guess you are typesetting with pdfTeX, not pdfLaTeX. Choose the latter, in the TeXworks menu:
pdflatex.png
pdflatex.png (21.53 KiB) Viewed 5824 times
Stefan
LaTeX.org admin
tex_eugene
Posts: 4
Joined: Sat Apr 14, 2012 11:29 am

Re: Fraction in plain TeX

Post by tex_eugene »

Thanks Stefan,I wonder if I can use it in pdfTex?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Fraction in plain TeX

Post by Stefan Kottwitz »

You could define it yourself:

Code: Select all

\def\frac#1#2{{\begingroup#1\endgroup\over#2}}
$\frac{abc}{xyz}$
\end
Stefan
LaTeX.org admin
tex_eugene
Posts: 4
Joined: Sat Apr 14, 2012 11:29 am

Re: Fraction in plain TeX

Post by tex_eugene »

It's done, Thanks very much Stefan!! :D
Post Reply