我正在用 latex 写一篇论文,当我添加 pstricks 代码时它会运行,但是当我插入\begin{figure}
and\end{figure}
命令来为图形添加标题时,它会产生错误,
\begin{document}
结尾是\end{figure}
...
这些是我正在使用的包。
\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}
% ------------------------------------------------------------------------
这是我章节的代码,其中我添加了图形
\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}
此文件生成错误。如果我删除 \begin{figure} 和 \end{figure},它就可以正常工作。
答案1
我正在使用包setspace
进行垂直间距。这有效:
\documentclass[12pt]{report}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\usepackage[scaled=0.85]{beramono}
\usepackage[centertags]{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm,amssymb}
%\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[dvipsnames]{pstricks}
\usepackage{pst-grad} % For gradients
\usepackage{pst-plot} % For axes
\usepackage{pstricks-add}
\usepackage{pst-blur}
\usepackage{caption}
\usepackage{graphicx, tikz}
\hfuzz2pt % Don't bother to report over-full boxes if over-edge is < 2pt
% Line spacing -----------------------------------------------------------
\usepackage{setspace}
\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}}
\def\ZZ{Z\!\!\!Z}
\begin{document}
% \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{}
% \setspace{2}
% ------------------------------------------------------------------------
\markright{\itshape Ch 1: Introduction}
\singlespacing
\chapter{Introduction}
\setstretch{1.66} \goodbreak
\begin{figure}\centering
\psscalebox{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}
\setstretch{1.5} \markright{\it References}
\bibliographystyle{amsplain}
\end{document}