LaTex

This will show you various ways to create a pdf with pstricks inclusions in the Western Washington University Computer Science labs. Some additional LateX resources are also listed in this page

Online LaTeX Resources

  • OverLeaf Online collaborative LaTeX editor

  • LaTeX Base Online live LaTeX editor

  • For when you can’t remember the name of the symbol, draw it! [Detextify] (http://detexify.kirelabs.org/classify.html)

Use this example file exa031.tex for the following steps to create a pdf from LaTeX.

\documentclass[12pt]{article}
\pagestyle{empty}
\usepackage{pst-plot}

\begin{document}

\begin{pspicture}(-3,-1)(3,5)
 \psaxes[linewidth=1.2pt, labels=none, ticks=none]{->}(0,0)(-3,-1)(3,5)[$x$,-90][$y$,180]
 \pscustom[fillstyle=solid,fillcolor=red!30]{%
    \parabola(2.15,3)(0,0)
    \psellipticarc(0,3)(2.15,0.5){180}{0}
 }
 \parabola{<->}(2.5,4)(0,0)
 \psellipse[linestyle=dashed,fillcolor=blue!30,fillstyle=solid](0,3)(2.15,0.5)
 \psline[linewidth=1.2pt, linecolor=white](0,2.53)(0,2.989)
 \psline[linestyle=dotted](-2,3)(2,3)\psline{->}(0,3)(0,5)
 \rput(-0.2,3){$h$}
\end{pspicture}

\end{document}

My recommendation is to use latex->dvi->ps->pdf run manually (no ide)

Windows

Manual PDF creation from Miktex

We have miktex 2.9 installed with all the packages as of the beginning of the quarter. With %ProgramFileS(x86)\miktex\bin in the path.

Creating a DVI

  • open a console (eg. cmd.exe)

  • navigate to your folder with your tex file (eg. exa031.tex)

  • type:latex exa031.tex, this generates a exa031.dvi file

  • type:dvips exa031.dvi, this generates a exa031.ps file

Creating a PDF from a PS

With Miktex’s ps2pdf

  • open a console (eg. cmd.exe)

  • navigate to your folder with your ps file (eg. exa031.ps)

  • type:ps2pdf exa031.ps

  • this generates a exa031.pdf file

With GhostScript

Ghostscript 9.04 is installed in the labs to

is not in the path. You can add it to your own path or invoke it with its full path.

  • open a console (eg. cmd.exe)

  • navigate to your folder with your ps file (eg. exa031.ps)

  • type:%ProgramFileS(x86)\gs\gs9.04\bin\gswin32c.exe -sDEVICE=pdfwrite -sOutputFile=exa031.pdf -dBATCH -dNOPAUSE exa031.ps

  • this generates a exa031.pdf file

Miktex from a console pdflatex latex->pdf

For up to date TeX distributions make sure you have \usepackage[pdf]{pstricks}

For older distributions make sure you have \usepackage{auto-pst-pdf}

  • open a console (eg. cmd.exe)

  • navigate to your folder with your tex file (eg. exa031.tex)

  • type:pdflatex -shell-escape exa031.tex

  • this generates a exa031-autopp.pdf file

TeXworks

TeXworks does not come with a tex->dvi->ps->pdf Processing tool by default. Also its pdfLatex option does not have a -shell-escape. The following may not survive a reboot as they save settings to

Creating a new Processing tool for PDFlaTeX with -shell-escape

For up to date TeX distributions make sure you have \usepackage[pdf]{pstricks}

For older distributions make sure you have \usepackage{auto-pst-pdf} This will not auto open the file as it appends a -autopp to the filename before the .pdf

  • open TeXworks

  • select edit

  • select preferences

  • select typesetting

  • under Processing tools select the plus

  • name it pdfLaTeX w/ -shell-escape

  • set program to miktex-pdftex.exe

  • add 4 arguments in the following order, -shell-escape, -synctex=1, -undump=pdflatex, $fullname

Adding a new processing tool for latex->dvi->ps->pdf

For up to date TeX distributions make sure you have \usepackage[pdf]{pstricks}

For older distributions make sure you have \usepackage{auto-pst-pdf} This will not auto open the file as it appends a -autopp to the filename before the .pdf

  • open TeXworks

  • select edit

  • select preferences

  • select typesetting

  • under Processing tools select the plus and then ok to exit

This causes %USERPROFILE%\\AppData\\Local\\MiKTeX\\2.9\\TeXworks\\0.4\\configuration\\tools.ini to be created.

A batch file needs created that will perform the multiple steps required.

latex-dvips-ps2pdf.bat

@latex -synctex=1 "%1.tex" && dvips "%1.dvi" && ps2pdf "%1.ps"

tex-dvips-ps2pdf.bat

@tex -synctex=1 "%1.tex" && dvips "%1.dvi" && ps2pdf "%1.ps"

To the end of the tools.ini file the following needs added w/ the proper path for the created bats

[013]
name=latex->dvips->ps2pdf
program=//cs/files/latex/TeXPSTricks/latex-dvips-ps2pdf.bat
arguments=$basename
showPdf=true

[014]
name=tex->dvips->ps2pdf
program=//cs/files/latex/TeXPSTricks/tex-dvips-ps2pdf.bat
arguments=$basename
showPdf=true

TeXnicCenter

  • start texniccenter

  • on the configuration wizard click next

  • for the tex distribution select C:\Program Files (x86)\MiKTeX 2.9\miktex\bin

  • click finish

  • you now have an output profile

Auto viewing will not work with Adobe Reader X

Linux

latex from a console latex->dvi->ps->pdf

We have texlive installed as of the beginning of the quarter.

Creating a DVI

  • open a console or terminal (eg. aterm)

  • navigate to your directorywith your tex file (eg. exa031.tex)

  • type:latex exa031.tex, this generates a exa031.dvi file

  • type:dvips exa031.dvi, this generates a exa031.ps file

Creating a PDF from a PS

With ps2pdf

  • open a console or terminal (eg. aterm)

  • navigate to your directory with your ps file (eg. exa031.ps)

  • type:ps2pdf exa031.ps

  • this generates a exa031.pdf file

With GhostScript

  • open a console or terminal (eg. aterm)

  • navigate to your directory with your ps file (eg. exa031.ps)

  • type:gs -sDEVICE=pdfwrite -sOutputFile=exa031.pdf -dBATCH -dNOPAUSE exa031.ps

  • this generates a exa031.pdf file

pdflatex latex->pdf

For up to date TeX distributions make sure you have \usepackage[pdf]{pstricks}

For older distributions make sure you have \usepackage{auto-pst-pdf}

  • open a console or terminal (eg. aterm)

  • navigate to your folder with your tex file (eg. exa031.tex)

  • type:pdflatex -shell-escape exa031.tex

  • this generates a exa031-autopp.pdf file