This file contains minimal examples of simple diagrams generated by
each of the output options of dpic.  In each case except the last two a
postscript file is produced that can be viewed using gsview. Example 11
produces an svg file that can be viewed by most browsers, but Internet
Explorer requires an svg viewer plug-in such as the Adobe svg viewer.
Consult the appropriate manual for processing mfpic, PStricks,
MetaPost, TikZ-PGP, or psfrag output.

========================================================================
EXAMPLE 1: LaTeX Picture Commands:  LaTeX provides a primitive drawing
  capability by placing characters from special fonts.  Dpic automates
  the tedious coordinate calculations, but drawings are still limited to
  the boxes, ovals, and lines of restricted slope provided by the fonts.

Diagram source file diag.pic:
.PS
  arrow "$u$" above
S: circle rad 10/72.27  # 10 pt
  line right 0.35
G: box "$G(s)$"
  arrow "$y$" above
  line down G.ht from last arrow then left last arrow.c.x-S.x
  arrow to S.s
  "$-\;$" below rjust
.PE

LaTeX file tst.tex:
   \documentclass{article}
   \begin{document}
   \input diag
   \end{document}

Commands:
  dpic diag.pic > diag.tex
  latex tst
  dvips -Ppdf tst.dvi

Result: tst.ps

========================================================================
EXAMPLE 2: LaTeX Picture Commands with epic and eepicemu:

Diagram source file diag.pic:
.PS
  arrow "$u$" above
S: circle rad 10/72.27  # 10 pt
  line right 0.35
G: box "$G(s)$"
  arrow "$y$" above
  line dotted down G.ht from last arrow then left last arrow.c.x-S.x then to S.s
  "$-\;$" below rjust
  arrow <- down 0.1 from S.s
.PE

LaTeX file tst.tex:
\documentclass{article}
\usepackage{epic,eepicemu}
\begin{document}
\input diag
\end{document}

Commands:
  dpic -t diag.pic > diag.tex
  latex tst
  dvips -Ppdf tst.dvi

Result: tst.ps

The feedback path has been dotted in this example, requiring the explicit
arrowhead below the circle.

========================================================================
EXAMPLE 3: PSTricks output.

Diagram source file diag.pic:
.PS
  arrow "$u$" above
S: circle rad 10/72.27  # 10 pt
  line right 0.35
G: box "$G(s)$"
  arrow "$y$" above
  line down G.ht from last arrow then left last arrow.c.x-S.x then to S.s
  "$-\;$" below rjust
  arrow <- down 0.1 from S.s
.PE

LaTeX file tst.tex:
\documentclass{article}
\usepackage{pstricks}
\begin{document}
\input diag
\end{document}

Commands:
  dpic -p diag.pic > diag.tex
  latex tst
  dvips -Ppdf tst.dvi

========================================================================
EXAMPLE 4: TikZ-PGF output to produce either postscript or pdf.

Diagram source file diag.pic:
.PS
  arrow "$u$" above
S: circle rad 10/72.27  # 10 pt
  line right 0.35
G: box "$G(s)$"
  arrow "$y$" above
  line down G.ht from last arrow then left last arrow.c.x-S.x then to S.s
  "$-\;$" below rjust
  arrow <- down 0.1 from S.s
.PE

LaTeX file tst.tex:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\input diag
\end{document}

Commands to produce tst.ps:
  dpic -g diag.pic > diag.tex
  latex tst
  dvips -Ppdf tst.dvi

Commands to produce tst.pdf:
  dpic -g diag.pic > diag.tex
  pdflatex tst

========================================================================
EXAMPLE 5: Mfpic output.

Diagram source file as above.

LaTeX file tst.tex:
\documentclass{article}
\usepackage{mfpic}
\begin{document}
\opengraphsfile{tst-mfpic}
\input diag
\closegraphsfile
\end{document}

Commands:
  dpic -m diag.pic > diag.tex
  latex tst
  mf tst-mfpic
  latex tst
  dvips tst.dvi
The mf command creates a new font tst-mfpic, containing
one character in this example.  To see the font characters,
type "tex testfont" and at the prompts, type "tst-mfpic",
"\table", and "\end".  Then "dvips testfont" creates
testfont.ps.  Notice that the font character contains the
lines of the diagram but not the labels.

========================================================================
EXAMPLE 6: Postscript output with psfrag strings.

Diagram source file as above.

LaTeX file tst.tex:
\documentclass{article}
\usepackage{graphicx}
\usepackage[scanall]{psfrag}
\begin{document}
\includegraphics{diag}
\end{document}

Commands:
  dpic -f diag.pic > diag.eps
  latex tst
  dvips -Ppdf tst


========================================================================
EXAMPLE 7: Raw postscript output

Diagram source file diag.pic:
.PS
  command "/Times-Italic findfont 11 scalefont setfont"
  arrow "u" above
S: circle rad 10/72.27  # 10 pt
  line right 0.35
G: box "G(s)"
  arrow "y" above
  line down G.ht from last arrow then left last arrow.c.x-S.x then to S.s
  move down 0.05 left 0.15; ""
  command "(\261) show"
  arrow <- down 0.1 from S.s
.PE

LaTeX file tst.tex:
  \documentclass{article}
  \usepackage{graphicx}
  \begin{document}
  \includegraphics{diag}
  \end{document}

Commands:
  dpic -r diag.pic > diag.eps
  latex tst
  dvips -Ppdf tst

Postscript code to select the font and to position and print the minus
sign have been manually inserted using "command", since diag.eps is
produced without any automatic text formatting. This is not practical
for complicated labels.

========================================================================
EXAMPLE 8: Raw postscript output with overlaid labels

Diagram source file diagA.pic containing no labels:
.PS
  arrow
S: circle rad 10/72.27
  line right 0.35
G: box
  arrow
  line down G.ht from last arrow then left last arrow.c.x-S.x then to S.s
  arrow <- down 0.1 from S.s
.PE

Diagram source file diagB.pic containing only labels:
.PS
B: "\includegraphics{diag.eps}" wid 172/72 ht 54/72
  "$u$" at B.sw + (0.25,0.6)
  "$G(s)$" at B.sw + (1.5,0.5)
  "$y$" at B.sw + (2.13,0.6)
  "$-$" at B.sw + (0.55,0.6-0.30)
.PE

LaTeX file tst.tex:
  \documentclass{article}
  \usepackage{pstricks,graphicx}
  \begin{document}
  \input diag
  \end{document}

Commands:
  dpic -r diagA.pic > diag.eps
  dpic -p diagB.pic > diag.tex
  latex tst
  dvips -Ppdf tst.dvi

The .eps file contains no text strings but contains the line
%%BoundingBox: 0 -36 172 18
from which its width is 172-0 pt and its height is 18-(-36)=54 pt.
The locations of the labels have to be known in diagB.pic but
they can be calculated automatically as well as manually in this
simple example.

========================================================================
EXAMPLE 9: MetaPost output:

Diagram source file diag.pic:
  verbatimtex
  \documentclass[11pt]{article}
  \usepackage{times}
  \begin{document} etex
  .PS
    arrow "$u$" above
  S: circle rad 10/72.27  # 10 pt
    line right 0.35
  G: box "$G(s)$"
    arrow "$y$" above
    line down G.ht from last arrow then left last arrow.c.x-S.x then to S.s
    "$-\;$" below rjust
    arrow <- down 0.1 from S.s
  .PE
  end

LaTeX file tst.tex:
  \documentclass{article}
  \usepackage{graphicx}
  \begin{document}
  \includegraphics{diag.1}
  \end{document}

Commands:
    dpic -s diag.pic > diag.mp
    mpost --tex=latex diag.mp
    latex tst
    dvips -Ppdf tst

========================================================================
EXAMPLE 10: Xfig output:

Diagram source file diag.pic:
  .PS
    arrow "u" above
  S: circle rad 10/72.27  # 10 pt
    line right 0.35
  G: box "G(s)"
    arrow "y" above
    line -> down G.ht from last arrow then left last arrow.c.x-S.x then to S.s
    "-" below rjust
  .PE

Commands:
  dpic -x diag.pic > diag.fig

The file diag.fig can then be read by xfig version 3.2 or later.

========================================================================
EXAMPLE 11: SVG output:

Diagram source file diag.pic:
  .PS
    arrow "u" above
  S: circle rad 10/72.27  # 10 pt
    line right 0.35
  G: box "G(s)"
    arrow "y" above
    line -> down G.ht from last arrow then left last arrow.c.x-S.x then to S.s
    "-" below rjust
  .PE

Commands:
  dpic -v diag.pic > diag.svg

The file diag.svg can then be read by a browser or svg viewer plugin.
