\documentclass[12pt]{article}

%-----------------------------------------------------------------------
%
% "preamble" with \usepackage commands, macro definitions, etc.
%

% make sure of okay hyphenation
% (this may no longer be needed, but at one time it fixed a bug)
\usepackage[english]{babel}
\selectlanguage{english}

% some useful packages
\usepackage{graphicx}	% has \includegraphics
\usepackage{amsmath}	% has considerable extra math stuff
\usepackage{color}	% needed to process xfig "special" text
\usepackage{tikz}
\usetikzlibrary{automata}
\usetikzlibrary{circuits.logic,circuits.logic.US, circuits.ee.IEC}
\usetikzlibrary{positioning}
\usetikzlibrary{matrix}

% allow more figures on a page
\setcounter{topnumber}{10}
\setcounter{bottomnumber}{10}
\setcounter{totalnumber}{10}
\setcounter{dbltopnumber}{10}
\def\topfraction{1.0}
\def\bottomfraction{1.0}
\def\textfraction{0.0}
\def\dbltopfraction{1.0}

% my macros -- if you have a lot of these you will use in many
%   documents, put them in a separate file foo.tex and use \input{foo}
%   to include them
% macros to reference sections, equations, consistently
%   the "~" disallows line breaks between Section, etc., and number
\newcommand{\SectionRef}[1]{Section~\ref{#1}}
\newcommand{\EqnRef}[1]{Equation~\ref{#1}}
\newcommand{\FigRef}[1]{Figure~\ref{#1}}
\newcommand{\TableRef}[1]{Table~\ref{#1}}
\newcommand{\PageRef}[1]{page~\pageref{#1}}
% macro to start an unindented paragraph with space before
\newcommand{\SpacedPar}{\vspace*{\baselineskip}\noindent}

%-----------------------------------------------------------------------
%
% body of document
%

%-----------------------------------------------------------------------

\begin{document}

%-----------------------------------------------------------------------

\section{Figures made with \texttt{xfig}}

\FigRef{xor-fig} and
\FigRef{xor-specialtext-fig} 
were generated by drawing a figure in \texttt{xfig}
and exporting into combined \LaTeX\ source and PostScript.
The resulting \texttt{.tex} files are included in this document
with \verb+\input+.

\begin{figure}[htbp]
\begin{center}
\input{xor.pstex_t}
\end{center}
\caption{This is a picture of an XOR circuit I drew for my
	CSCI~2321 class years ago, drawn using \texttt{xfig}
	and exporting into combined \LaTeX\ source and PostScript.
}
\label{xor-fig}
\end{figure}

\begin{figure}[htbp]
\begin{center}
\input{xor-specialtext.pstex_t}
\end{center}
\caption{This is the same diagram as \FigRef{xor-fig}, updated 
	(in \texttt{xfig})
	to replace regular text with ``special text'' set using math mode
	(to show how that works).
	It was then processed as for \FigRef{xor-fig}.
}
\label{xor-specialtext-fig}
\end{figure}

%-----------------------------------------------------------------------

\section{Figures made with \texttt{gnuplot}}

\FigRef{numint-fig} shows the result of generating input to \LaTeX\
with \texttt{gnuplot} using its \texttt{epslatex} terminal type,
which produces a \texttt{.tex} file to be included here with
\verb+\input+ and an EPS file.

\begin{figure}[htbp]
\begin{center}
\input{numint-plot}
\end{center}
\caption{Plot showing using numerical integration to approximate
	the definite integral
	% FIXME? seems like this would look nicer but doesn't seem to
	% work in caption
	%\[
	%\int_0^1 \frac{4}{1 + x^2} dx
	%\]
	$\int_0^1 \frac{4}{1 + x^2} dx$.
	The plot was generated with \texttt{gnuplot}.
	The formula for the function is represented in \texttt{gnuplot}
	as a \LaTeX\ math-mode expression.
}
\label{numint-fig}
\end{figure}

%-----------------------------------------------------------------------

\section{Figures made with TikZ}

\FigRef{tikz-simple-fig},
\FigRef{tikz-automata-fig}, and 
\FigRef{tikz-circuit-fig} show examples of drawing diagrams
directly in \LaTeX\ with the \texttt{tikz} package.

\begin{figure}[htbp]
\begin{center}
\begin{tikzpicture}
\draw (0,0) -- (5,5);
\draw (5,0) -- (0,5);
\end{tikzpicture}
\end{center}
\caption{Extremely simple TikZ example.}
\label{tikz-simple-fig}
\end{figure}

\begin{figure}[htbp]
\begin{center}
\input{tikz-automata}
\end{center}
\caption{TikZ automata example (using TikZ's library for drawing diagrams
	of automata).
	This example is based on an example in the TikZ manual.}
\label{tikz-automata-fig}
\end{figure}

\begin{figure}[htbp]
\begin{center}
\input{tikz-circuit}
\end{center}
\caption{TikZ circuit example (using TikZ's library for drawing circuit
	diagrams).}
\label{tikz-circuit-fig}
\end{figure}

%-----------------------------------------------------------------------

\end{document}
