8

I am a novice in using Linux systems.

I was given an assignment of writing a document using LaTeX and converting the file into a pdf file to submit. So I tried using my CentOS to do so. The version of my Linux system is RedHat. I've looked up ways to convert .tex file into .pdf on the web, which told me to install texlive. So I did so.

[csi2102@localhost]$ yum install -y texlive
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
  * base: data.nicehosting.co.kr
  * extras: data.nicehosting.co.kr
  * updates: data.nicehosting.co.kr
Setting up Install Process
Package texlive-2007-57.e.16_2.i686 already installed and latest version
Nothing to do

So I looked up for ways to solve this problem and one of the websites suggested of using rpm -qa | grep tex command. But nowhere could I find the pdflatex file.

[csi2102@localhost]$ rpm -qa | grep tex
texlive-texmf-errata-dvips-2007.7.1.e16.noarch
texlive-2007.57.e16_2.i686
texlive-texmf-errata-fonts-2007.7.1e16.noarch
texlive-texmf-2007-38.e16.noarch
texlive-texmf-fonts-2007-38.e16.noarch
texlive-texmf-errata-2007-7.1.e16.noarch
texlive-texmf-dvips-2007-38.e16.noarch
[csi2102@localhost]$ 

This is what I saw when I typed the command.

When I try to use pdflatex, latex, or pdftex command, this is what I get.

[csi2102@localhost]$ latex homework
bash: latex: command not found
[csi2102@localhost]$ pdflatex homework
bash: pdflatex: command not found
[csi2102@localhost]$ pdftex homework
This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)
 %&-line parsing enabled.
entering extended mode
(./homework1.tex
!Undefined control sequence.
1.7 \documentclass
                   [pdftex,11pt] {article}
?

I don't see why my system would not recognize unlike how other people have been saying.

P.S. Oh, and just in case, I wanted to attach my .tex file wondering if what I have written in my file was creating the problem.

\documentclass[pdftex,11pt] {article}
\usepackage[utf8] {inputenc}

\usepackage{geometry}
\gemoetry{a4paper}

\usepackage[dvips]{graphicx}
\usepackage{pslatex}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\lhead{}\chead{}\rhead{Introduction to Engineering Design}
\lfoot{}\cfoot{\thepage}\rfoot{}

\usepacakge{sectsty}
\allsectionsfont{\sffamily\mdseries\upshape}

\title{What is \LaTex ?}
\author{2013147549 Geun Ho Lee}
\date{}

\begin{document}
\maketitle

 LaTex is a document preparation system that is most often used for medium-to-large technical or scientific documents. It is not, however, a word processor. It is based on the idea that it would be more efficient for the authors to write their documents and let the document designers to worry about the document design. LaTex consists of several features ranging from typesetting journal articles, technical reports, books, and slide presentations to automatically generating bibliographies and indexes.

 LaTex is based on the TeX typesetting language or certain extensions of it. LaTex was first developed in 1985 by Leslie Lamport and is now maintained and developed by the LaTex3 Project.

 (source: http://latex-project.org/intro.html)

\end{document}
  • 5
    You might consider a user install of TeXLive, since the version your package manager provides is more than six years old and many tutorials or code snippets you might find on the web will not work with an ancient version. If you only need to write one document and don't intend to use it frequently I'd suggest to use a web application like WriteLaTeX. – Marco Sep 21 '13 at 8:19
  • You might want to accept one of the answers if it answered your question. I see you attempted to do this and then deleted what was an answer. If you don't mark one as accepted then people will think your issue is still outstanding and attempt to provide further assistance, since it's assumed it hasn't been. – slm Sep 22 '13 at 13:59
  • If you directly pasted your code, note that you have a typo : \gemoetry{a4paper} . – schaiba Sep 22 '13 at 18:30
13

You're missing some stuff. This is on Fedora but the same pattern should hold on CentOS:

> yum whatprovides latex

Loaded plugins: auto-update-debuginfo, langpacks, presto, refresh-packagekit, verify
texlive-latex-2007-70.fc17.x86_64 : The LaTeX front end for the TeX text formatting system
Repo        : fedora
Matched from:
Filename    : /usr/bin/latex

I don't see texlive-latex anywhere in your list. The same package is mentioned for yum whatprovides pdflatex, so...

> yum install texlive-latex
5

Here are some solutions:

1. Double-check your latex

The latex is showing errors with your first line:

\documentclass[pdftex,11pt]{article}

Are you sure that pdftex is a valid option there? Usually these options have to do with paper size and layout. Try removing it.

2. Try 'pdflatex'

I don't know the difference between pdflatex and pdftex but from my experience, pdflatex is much, much more commonly used. Try yum whatprovides \*pdflatex to see which package provides that binary (hint: it's texlive-latex) and install that. Then, try running your paper with pdflatex instead.

3. Try another SE site

If you still get latex errors after running pdflatex homework.tex, maybe head over to tex.stackexchange.com to seek latex-related help.

1

There is a big difference between a TeX document and a LaTeX document even though they are both typically given .tex extensions. . You document starts with \documentclass[pdftex,11pt] {article} which is a LaTeX macro and is therefore a LaTeX document and must be processed with a TeX engine that has the LaTeX format loaded. Typically pdftex loads the TeX format and pdflatex loads the LaTeX format. For deb based distros (and others) the texlive package loads both the TeX and LaTeX formats (i.e., pdftex and pdflatex), but rpm based distros (like CentOS) TeX and LaTeX support is split. You need to load the texlive-latex package in CentOS to get the LaTeX format. Once it is loaded you should be able to do pdflatex homework without any problems.

It is worth noting that the version of you TeXlive is from 2007 so it may be worth installing and maintaining your own version. See for example https://tex.stackexchange.com/a/95373/10038

1

You can use either pdftex or pdflatex to generate a PDF file from your TEX file. You've already got pdftex installed. The output from the yum command was basically telling you that texlive was already installed.

Package texlive-2007-57.e.16_2.i686 already installed and latest version

I would install this package too:

$ yum install texlive-latex

You need to either be the root user or use the command sudo yum ... to run the installation above.

Usage - pdftex

If your .tex file is correctly formatted then this command should result in a PDF file.

$ pdflatex your.tex

Where your.tex is the contents you provided in your question. If you try using this command without any arguments you'll have to continuously keep hitting the enter key until each command has finished processing. Like this:

$ pdftex your.tex 
This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)
 %&-line parsing enabled.
entering extended mode
(./your.tex
! Undefined control sequence.
l.1 \documentclass
                  [pdftex,11pt] {article} \usepackage[utf8] {inputenc}
? 
! Undefined control sequence.
l.1 ...entclass[pdftex,11pt] {article} \usepackage
                                                  [utf8] {inputenc}
? 
...
...
...
! Undefined control sequence.
l.13 \begin{document} \maketitle

? 
[1{/usr/share/texmf/fonts/map/pdftex/updmap/pdftex.map}] )</usr/share/texmf/fon
ts/type1/bluesky/cm/cmr10.pfb>
Output written on your.pdf (1 page, 14865 bytes).
Transcript written on your.log.

This will result in a perfectly fine PDF file, your.pdf. At each ? prompt you need to hit the Enter key.

Sample

    ss of pdftex your.pdf

Usage - pdflatex

You can also use the tool pdflatex to generate the PDF file.

$ pdflatex your.tex 
This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)
 %&-line parsing enabled.
entering extended mode
(./your.tex
LaTeX2e <2005/12/01>
...
...
l.13 \begin{document} \maketitle

? 
(/usr/share/texmf/tex/latex/psnfss/ot1ptmcm.fd)
(/usr/share/texmf/tex/latex/psnfss/omlptmcm.fd)
(/usr/share/texmf/tex/latex/psnfss/omxpsycm.fd) [2] (./your.aux) ){/usr/share/t
exmf/fonts/enc/dvips/base/8r.enc}</usr/share/texmf/fonts/type1/bluesky/cm/cmr10
.pfb></usr/share/texmf/fonts/type1/urw/times/utmr8a.pfb>
Output written on your.pdf (2 pages, 22454 bytes).
Transcript written on your.log.

This too will results in a perfectly valid PDF file, but looks more like what you'd want from your .tex file.

Sample

         ss of pdflatex your.pdf

Your .tex file

I think your file isn't formatted quite right. If you take another file like this one, http://www.maths.manchester.ac.uk/~kd/latextut/examex.tex, and run it through pdflatex, it works fine without prompting me with the ? marks.

  • 1
    I think yum install texlive-latex should be more than just a suggestion. I think it is required to compile a LaTeX document. – StrongBad Sep 22 '13 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.