GeneralViewing pdf from latex

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
oneplussix
Posts: 1
Joined: Sun Jun 10, 2012 7:35 am

Viewing pdf from latex

Post by oneplussix »

I am using Texworks on a mac. Whenever i press the green play button, I get this message:

Code: Select all

This is pdfTeX, Version 3.1415926-1.40.11 (TeX Live 2010)
 restricted \write18 enabled.
entering extended mode
(./Fobonacci Numbers and Their Applications.doc.tex
! Undefined control sequence.
l.1 \documentclass
                  {article}
I am trying to view the tex file in pdf form. can anyone help me pls the methods I search on google are all useless.
thnks in advance
Last edited by Stefan Kottwitz on Sun Jun 10, 2012 11:27 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.

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

Viewing pdf from latex

Post by Stefan Kottwitz »

Hi,

welcome to the board!

As I wrote in the topic: Input File not found in working Directory, it seems that you compile with pdfTeX, but not with pdfLaTeX. (pdf)TeX doesn't know \documentclass because it's a (pdf)LaTeX command. In TeXworks, change the typesetting engine/format to pdfLaTeX. Either do it in the main menu, Edit/ Preferences/ Typesetting and choose pdfLaTeX as the default, or choose it in the drop down list next to the green typesetting button at the top left.

Stefan
LaTeX.org admin
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Viewing pdf from latex

Post by localghost »

To avoid this in TeXworks, there are several possibilities.
  • Set the typesetting engine temporarily to "pdfLaTeX" by the pull down menu in the main window of TeXworks (see attachment).
  • Add % !TeX program = pdflatex as very first line to the source code of your document and TeXworks will choose "pdfLaTeX" automatically every time.
  • Set "pdfLateX" as default typesetting engine in the preferences of TeXworks (see attachment).
These settings apply to all possible typesetting tools available in TeXworks, not only PDFLaTeX.


Best regards and welcome to the board
Thorsten
Attachments
The main window of TeXworks with the pull down menu for the typesetting tools.
The main window of TeXworks with the pull down menu for the typesetting tools.
TeXworks-r1011-Typeset-Tools.png (125.56 KiB) Viewed 1901 times
The Preferences dialog window of TeXworks with the "Typesetting" tab.
The Preferences dialog window of TeXworks with the "Typesetting" tab.
TeXworks-r1011-Preferences-Typesettting.png (63.53 KiB) Viewed 1901 times
Post Reply