I am writing a thesis in latex, when I add the pstricks code it runs but when I insert the \begin{figure}
and \end{figure}
command to caption the figure, it generates error
\begin{document}
ended by \end{figure}
…
These are the packages I am using.
\documentclass[12pt]{report}
\usepackage[usenames,dvipsnames]{pstricks}
\usepackage[centertags]{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm,amssymb}
\usepackage{newlfont}
\usepackage{xthesis} %DAL Thesis Style
\usepackage{xtocinc} %Include Table of Contents as the first entry in TOC
% Advanced Studies and Research Board insists on this!?
\usepackage[usenames,dvipsnames]{pstricks}
\usepackage{pst-grad} % For gradients
\usepackage{pst-plot} % For axes
\usepackage{epsfig}
\usepackage{pstricks-add}
\usepackage{pst-blur}
\usepackage{caption}
\usepackage{graphics, tikz}
\hfuzz2pt % Don't bother to report over-full boxes if over-edge is < 2pt
% Line spacing -----------------------------------------------------------
\newlength{\defbaselineskip}
\setlength{\defbaselineskip}{\baselineskip}
\newcommand{\setlinespacing}[1]%
{\setlength{\baselineskip}{#1 \defbaselineskip}}
\newcommand{\doublespacing}{\setlength{\baselineskip}%
{2.0 \defbaselineskip}}
\newcommand{\singlespacing}{\setlength{\baselineskip}{\defbaselineskip}}
% MATH -------------------------------------------------------------------
\newcommand{\A}{{\cal A}}
\newcommand{\h}{{\cal H}}
\newcommand{\s}{{\cal S}}
\newcommand{\W}{{\cal W}}
\newcommand{\BH}{\mathbf B(\cal H)}
\newcommand{\KH}{\cal K(\cal H)}
\newcommand{\Real}{\mathbb R}
\newcommand{\Complex}{\mathbb C}
\newcommand{\Field}{\mathbb F}
\newcommand{\RPlus}{[0,\infty)}
\newcommand{\norm}[1]{\left\Vert#1\right\Vert}
\newcommand{\essnorm}[1]{\norm{#1}_{\text{\rm\normalshape}}}
\newcommand{\abs}[1]{\left\vert#1\right\vert}
\newcommand{\set}[1]{\left\{#1\right\}}
\newcommand{\seq}[1]{\left<#1\right>}
\newcommand{\eps}{\varepsilon}
\newcommand{\To}{\longrightarrow}
\newcommand{\RE}{\operatorname{Re}}
\newcommand{\IM}{\operatorname{Im}}
\newcommand{\Poly}{{\cal{P}}(E)}
\newcommand{\EssD}{{\cal{D}}}
% THEOREMS ---------------------------------------------------------------
\theoremstyle{plain}
\newtheorem{thm}{Theorem}[section]
\newtheorem{cor}[thm]{Corollary}
\newtheorem{lem}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
%
\theoremstyle{definition}
\newtheorem{defn}{Definition}[section]
%
\theoremstyle{remark}
\newtheorem{rem}{Remark}[section]
%
\numberwithin{equation}{section}
\renewcommand{\theequation}{\thesection.\arabic{equation}}
%%% ----------------------------------------------------------------------
\setlength{\tclineskip}{1.05\baselineskip}
%%% ----------------------------------------------------------------------
\def\ZZ{Z\!\!\!Z}
\begin{document}
%\nobib
%\draft
%\nofront
%\permissionfalse
\dedicate{\textit{Dedications\\ To my Parents\\
and\\ those who taught me even a single word\\ in my life.}}
\nolistoftables \nolistoffigures \msc \copyrightyear{2013}
\submitdate{September, 2013}
% ------------------------------------------------------------------------
\title{}
\author{}
\supervisor{}
% ------------------------------------------------------------------------
{
\typeout{:?0000} % Don't bother with over/under-full boxes
%\beforepreface
\typeout{:?1111} % Process All Errors from Here on
}
\setlinespacing{2}
% ------------------------------------------------------------------------
{\typeout{Introduction} \markright{\it Ch 1: Introduction}
\include{T0}
% ------------------------------------------------------------------------
\setlinespacing{2}
\setlinespacing{1.5} \markright{\it References}
\bibliographystyle{amsplain}
%\bibliography{XBib}
%\appendix
%\include{Appendix}
\end{document}
% ------------------------------------------------------------------------
This the code of my chapter in which i have added the figure
\def\baselinestretch{1}
\chapter{Introduction}
\def\baselinestretch{1.66}
%%% ----------------------------------------------------------------------
\goodbreak
\begin{figure}
\scalebox{1} % Change this value to rescale the drawing.
{
\begin{pspicture}(0,-1.6045313)(2.64,1.6045313)
\psline[linewidth=0.04cm](0.0,0.94609374)(2.62,-1.0739063)
\psline[linewidth=0.04cm](0.62,0.18609375)(0.96,0.18609375)
\psline[linewidth=0.04cm](0.96,0.22609375)(0.84,0.56609374)
\usefont{T1}{ptm}{m}{n}
\rput(0.17078125,1.4360938){P}
\usefont{T1}{ptm}{m}{n}
\rput(2.1767187,-1.3839062){Q}
\usefont{T1}{ptm}{b}{it}
\rput(2.0196874,0.13609375){x}
\end{pspicture}
}\end{figure}
This file generates the error. If i remove \begin{figure} and \end{figure} it works.
Best Answer
I am using package
setspace
for the vertical spacing. THis works: