Converting from one file type to another

    How do I convert a document from ...
  1. ps to pdf
  2. pdf to ps
  3. txt to tex
  4. tex/latex to html
  5. tex/latex to pdf
  6. .dvi to .ps
  7. .ps to ascii text
  8. .ps to various formats eg .fig
  9. .dvi to plain text
  10. .dvi to .pdf
  11. dos to unix
  12. (or how to remove the ^M characters in a file)
  13. .rtf to .ps
  14. .rtf to .pdf

  1. How do I convert a document from ps to pdf
    To convert a document from ps to pdf use ps2pdf

  2. How do I convert a document from pdf to ps
    To convert a document from pdf to ps use pdf2ps. Syntax is pdf2ps input.pdf output.ps

  3. How do I convert a document from txt to tex
    To convert text to tex use txt2tex, see info about txt2tex for more information. Or see the file /usr/damtp/info/txt2tex.README on any damtp unix computer.

  4. How do I convert a document from tex/latex to html
    A simple, very fast converter is
          tth < file.tex > file.htm
    
    (an alternative to the more sophisticated latex2html).
    See man tth for more complex use, eg handling embedded graphics.

  5. How do I convert a document from tex/latex to pdf
    To convert TeX/LaTeX directly to PDF
        pdflatex file.tex  (produces file.pdf)
    
    Available on the Pentiums ie linux but not Alphas.
    Alternatively or if the file has pictures/figures in it, the below will work so long as the figures are of type eps (encapsulated postscript) since those are the only kind that dvips will really cope with. However .gif/.jpg files can usually be converted to .eps fairly easily with xv or gimp.

    If you have a latex document called fred.tex then a recipe which works
    would be:
    
    # Run latex on it
      latex fred.tex
    # 2nd, 3rd time if there are forward references which need to be right
      latex fred.tex
      latex fred.tex
    
    # Convert to postscript -t specifies the paper type (not needed
    # normally, but otherwise the ps2pdf will guess letter size), -Peel
    # sets things up for a typical printer, -o says where the output will
    # go (a file in this case).
    
      dvips -t a4 -R -Peel -o fred.ps fred.dvi
    
    # Convert postscript to pdf
      ps2pdf fred.ps fred.pdf
    
    This should result in a .pdf file fred.pdf
    

  6. How do I convert a .dvi file to a .ps file

    dvips -o filename.ps filename.dvi
    
    This will produce filename.ps from filename.dvi. The .dvi part is optional. ie
    dvips -o filename2.ps filename
    
    will work just as well.

  7. How do I convert a .ps file to a ascii text
    Use the command ps2ascii which will give you a text-only version of the dvi file ie ps2ascii file.ps will output the ascii text on the screen, while ps2ascii file.ps file will save the output to a file called file.
    Use ps2ascii --help for more options.

  8. How do I convert a .ps file to other vector formats eg graphical for further processing
    Use the command pstoedit. Example usage to convert a .ps file called house.ps to a .fig file is
    
    	pstoedit -f fig house.ps house.fig
    
    
    The pstoedit website contains a complete list of supported formats.

  9. How do I convert my .dvi file to text
    First use dvips to convert the file to postscript, then use ps2ascii to convert the postscript to ascii text. You will lose the pictures and other graphics, but maintain the text of the document. This is sometimes useful if you accidently delete the .tex file. ie to get the ascii from myfile.dvi into a file called myfile
    dvips -o myfile.ps myfile.dvi
    ps2ascii myfile.ps myfile
    

  10. How do I convert a document from .dvi format to .pdf

    Use dvipdf.

    But sometimes this produces a file in which the superscripts do not look right in acroread. Often when you magnify the file in acroread eg to 3005, the superscripts look correct, as they do when using xpdf to view the resultant .pdf file.
    A way to overcome this problem is to convert the .tex code directly to pdf with pdflatex or pdftex.

  11. dos to unix (or how to remove the ^M characters in a file)

    d2u is a very simple script which converts from DOS or Mac text formats to unix (the name is historical).

    usage is
      d2u file
    it renames that to file.old and creates a new one with the converted contents.

    It also removes Ctrl-Z which occurs at the end of some DOS files.

    mtools has a -t option to do a text transfer.

  12. .rtf to .ps

    To translate a .rft file to postscript (.ps) use the command
    	rtf2ps
    

  13. .rtf to .pdf

    To translate a .rft file to pdf format use the command
    	rtf2pdf
    

Useful Links