使用模板编译 TikZ 图表时出现问题

使用模板编译 TikZ 图表时出现问题

这是我在这里的第一个输入。我在编译此文档时遇到问题,特别是 TikZ 图形变得混乱(根本没有图形并且标签叠加)。我在 Windows 7 中使用 TeXstudio 和 MiKTex 2.9 并应用标准命令:

  1. pdflatex:pdflatex -synctex = 1 -interaction = nonstopmode %tex
  2. LaTex:latex -interaction=nonstopmode %.tex ;以及后来的 DVI->PDF

两次编译均未出现错误,只有 pdflatex 和 latex 命令中的 \hbox 过满,以及额外的看似不相关的警告“不支持除 'pdftex.def' 之外的驱动程序”。执行 DVI->PDF 时会显示几个警告,但没有提到 TikZ。我知道图形没问题,因为我可以使用其他模板显示它;但这是推荐的论文模板。我已经更新了所有 Latex 包,我想知道问题出在哪里,我相信类或编译命令存在一些问题。

文件代码如下:对于主文档“phd_thesis_format.tex”:

\documentclass[a4paper,twoside,openright,12pt,mycolours,final]{mythesis}
\usepackage{graphicx}
\usepackage[usenames,dvips]{color}
\usepackage{amsmath}
\usepackage{bbold}
\usepackage{tikz}
\usepackage[noBBpl]{mathpazo}
\usepackage{array}
\usepackage{harvard}
\usepackage{makeidx}
\usepackage{fancyhdr}
\usepackage[hang]{caption}
\usepackage{psfrag}
\usepackage{amssymb}
\usepackage[notref,color]{showkeys}
\usepackage{epstopdf}

\begin{document}
\include{chapterOne}
\bibliography{bibliography}
\bibliographystyle{harvard_dcu}
\end{document}

对于带有简化图表的章节“ChapterOne.tex”

\chapter{Chapter One}

\begin{chaptersummmary}
\PARstart{C}{hapter} summary goes here.
\end{chaptersummmary}

\section{Chapter One section}
\label{section2.1} Create another section in this chapter
\begin{figure}
\centering
\begin{tikzpicture}
  [scale=1.0,auto=left, node distance = 1.5cm]
  \tikzset{
    arn_n/.style = {circle, black,  draw=black,  % font=\sffamily\bfseries,
      fill=blue!20, text width=1.5em, text centered},% arbre rouge noir, noeud noir
    arn_x/.style = {rectangle, draw=black,
      minimum width=1.2em, minimum height=1.2em} % arbre rouge noir, nil
  }
  \node[arn_x] (7) {};  
  \node[arn_n, right of=7] (8) {$y_{i-1}$};
  \node[arn_x, right of=8] (9) [label=above:{$\psi_i^2(y_{i-1},y_i)$}] {};
  \node[arn_n, right of=9] (10) {$ y_i$};
  \node[arn_x, right of=10] (11) {};
  \node[arn_n, right of=11] (12) {$y_{i+1}$};  
  \node[arn_x, right of=12] (13) {};
\end{tikzpicture}
\caption{Graph indicating propagation of messages}
\label{Fig2.FWprop}
\end{figure}

\subsection{Chapter One subsection}
\label{subsection2.1.1} Chapter 2 subsection goes here.

我已经将类文件从 800 多行缩减为 320 行,但是我对 Latex 的掌握还不够好,无法继续删减,从这里开始我又遇到了其他不相关的错误。

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mythesis}[2005/09/05 School of Electrical and Electronic Engineering -- University of Adelaide]
\RequirePackage{fancyhdr}
\RequirePackage{lettrine}
\RequirePackage{graphicx}
\RequirePackage{calc}

\newif\ifmydraft\mydraftfalse
\DeclareOption{mydraft}{\mydrafttrue}

\newcommand\docsize{}  % to allow 10pt or 11pt to be specified as option
\typeout{Modified by Greg Harmer, 2000}
\DeclareOption{10pt}{\renewcommand\docsize{10pt}}
\DeclareOption{11pt}{\renewcommand\docsize{11pt}}
\DeclareOption{12pt}{\renewcommand\docsize{12pt}}
%  Prepare to load the standard report class (12pt):
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ExecuteOptions{12pt}         % define 12pt as the default doc size
\ProcessOptions
\LoadClass[\docsize]{report}  % load report.cls
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  The following sections are revisions or additions to report.cls
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PAGE LAYOUT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setlength\voffset{-1.0in}
\setlength\hoffset{-1.0in}

\setlength\topmargin{20.0mm-4.0mm}
\setlength\headheight{5.00mm}
\setlength\headsep{7.00mm}

\setlength\footskip{10.00mm}
\setlength\textheight{\paperheight
                       -\topmargin-\headheight-\headsep
                       -\footskip-5.0mm-\topmargin}

% SIDE MARGINS:
\marginparsep 1mm
\if@twoside
   \setlength\oddsidemargin{3cm}
   \setlength\evensidemargin{2cm}
   \setlength\marginparwidth{1.5cm}
   \ifmydraft
      % Make room for marginal notes
      \setlength\oddsidemargin{2.5cm}
      \setlength\evensidemargin{2.5cm}
      \setlength\marginparwidth{2.25cm}
   \fi
\else
   \setlength\oddsidemargin{2.5cm}
   \setlength\evensidemargin{2.5cm}
   \setlength\marginparwidth{2.25cm}
\fi

\setlength\textwidth{\paperwidth-\oddsidemargin-\evensidemargin}

% Line spacing and par seps, gph.
\renewcommand{\baselinestretch}{1.33333}
\newcommand\setmyparsep{\parskip0.4\baselineskip\@plus0ex\@minus 0.5ex}
\newcommand\setmytightparsep{\parskip0.2\baselineskip\@minus0.5ex}
\setlength\parindent{0ex}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Headings stuff. Added by gph.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand\blob{\rule[-0.2\unitlength]{1in}{0.8\unitlength}}
\newcommand\rblob{\begin{picture}(0,0)
                    \setlength{\unitlength}{25mm}
                    %\put(0,-\value{chapter}){\blob}
                    \put(0.127,-\value{chapter}){\blob}
                  \end{picture}}


\fancyhf{} % delete current setting for header and footer
\fancyhead[LO]{\headerfont\chaptername\space\thechapter}
\fancyhead[LE]{\headerfont\rightmark}
\fancyhead[RO]{\headerfont\leftmark}
\fancyfoot[LE,RO]{\footerfont{Page\space\thepage}}
\ifmydraft\fancyfoot[C]{\footerfont{Fancy\draftcomment}}\fi
\renewcommand{\headrulewidth}{0.5pt}
\addtolength{\headheight}{0.5pt} % make space for the rule
\renewcommand{\footrulewidth}{0.5pt}
\addtolength{\footskip}{0.5pt} % make space for the rule


\fancypagestyle{plain}{%
   \fancyhead{} % get rid of headers
   \fancyfoot{}
   \renewcommand{\headrulewidth}{0pt} % and the line.
   \renewcommand{\footrulewidth}{0.5pt}
   \ifmydraft\fancyfoot[C]{\footerfont{Plain\draftcomment}}\fi
   \fancyfoot[LE,RO]{\footerfont{Page\space\thepage}}
   \addtolength{\footskip}{0.5pt}}

\fancypagestyle{chapterstart}{%
   \fancyhead{} % get rid of headers
   \fancyhead[RO]{\chapterblobcolor\rblob}
   \fancyfoot{}
   \renewcommand{\headrulewidth}{0pt} % and the line.
   \renewcommand{\footrulewidth}{0.5pt}
   \ifmydraft\fancyfoot[C]{\footerfont{Chapter Start\draftcomment}}\fi
   \fancyfoot[LE,RO]{\footerfont{Page\space\thepage}}
   \addtolength{\footskip}{0.5pt}}


\fancypagestyle{special}{%
   \fancyhead{} % get rid of headers
   \fancyfoot{}
   \fancyhead[LE,RO]{\headerfont\leftmark}
   \fancyfoot[LE,RO]{\footerfont{Page\space\thepage}}
   \ifmydraft\fancyfoot[C]{\footerfont{Special\draftcomment}}\fi
   \renewcommand{\headrulewidth}{0.5pt} % and the line.
   \addtolength{\headheight}{0.5pt}
   \renewcommand{\footrulewidth}{0.5pt}
   \addtolength{\footskip}{0.5pt}}

\fancypagestyle{normal}{%
   \fancyhead{} % get rid of headers
   \fancyfoot{}
   \fancyhead[LO]{\headerfont\chaptername\space\thechapter}
   \fancyhead[LE]{\headerfont\rightmark}
   \fancyhead[RO]{\headerfont\leftmark}
   \renewcommand{\headrulewidth}{0.5pt} % and the line.
   \addtolength{\headheight}{0.5pt}
   \renewcommand{\footrulewidth}{0.5pt}
   \addtolength{\footskip}{0.5pt}
   \fancyfoot[LE,RO]{\footerfont{Page\space\thepage}}
   \ifmydraft\fancyfoot[C]{\footerfont{Normal\draftcomment}}\fi}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                            SECTION HEADINGS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\chaptersize{\normalsize}
\newcommand\sectionsize{\normalsize}
\newcommand\subsectionsize{\normalsize}
\newcommand\subsubsectionsize{\normalsize}
\newcounter{firstchapter}
\setcounter{firstchapter}{0}

\newif\ifwasonecol\wasonecolfalse

% What to do for the last chapter page if blank.
\def\cleardoublepage{%
\if@twocolumn\wasonecolfalse
\else\wasonecoltrue
\fi
\onecolumn
\clearpage
\if@twoside
   \ifodd\c@page\else
      \if@twocolumn % shouldn't need to be used any more, gph.
         \hbox{}\newpage\fi
      \hbox{}
      \ifmydraft
         \vspace*{\fill}
         \begin{center}
            {\normalfont\Large\bfseries\sffamily%
            This is the last page of\space\leftmark\par%
            Next chapter is
            \ifwasonecol{one}\else{two}\fi\space
            column\par\space
            (Draft -- Page will be blank)\par}
         \end{center}
         \vspace{\fill}
      \fi
      \thispagestyle{plain}
      \newpage
   \fi
\fi
\ifwasonecol\onecolumn\else\twocolumn\fi}

%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  CHAPTER HEADING STUFF  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%

\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
                    \global\@topnum\z@
                    \@afterindentfalse
                    \pagestyle{normal}
                    \setmyparsep
                    \secdef\@chapter\@schapter}

\def\@chapter[#1]#2{\thispagestyle{chapterstart}
                    \ifnum\c@firstchapter=0
                      \pagenumbering{arabic}
                      \setcounter{firstchapter}{1}
                    \fi
                    \ifnum \c@secnumdepth >\m@ne
                         \refstepcounter{chapter}%
                         \typeout{\space}
                         \typeout{Processing\space\@chapapp\space\thechapter.\space#2}%
                         \addcontentsline{toc}{chapter}%
                                   {\@chapapp\space\protect\numberline{\thechapter.}#1}%
                    \else
                      \addcontentsline{toc}{chapter}{#1}%
                    \fi
                    \chaptermark{#1}%
                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \ifnum\c@chapter>1
                      \addtocontents{lof}{\hfill\hrulefill\hspace*{\fill}\par%
                      \protect\addvspace{10\p@}}\fi
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}

\def\@makechapterhead#1{%
  %\vspace*{40\p@}%
  {\parindent\z@\raggedright
    \ifnum \c@secnumdepth >\m@ne
        \chapterlabelfont\@chapapp\space\thechapter\par\nobreak
        \vskip 30\p@
    \fi
    \interlinepenalty\@M
    \raggedleft\chapterfont#1\par\nobreak
    \vskip 40\p@
  }}

\def\vertbar{\vspace*{-50\p@}
             \vertbarcolor\rule{20mm}{100\p@}}

\def\@schapter#1{\pagestyle{special}
                 \thispagestyle{plain}
                 \addcontentsline{toc}{chapter}{\TOCchapterscolor#1}%%
                 \chaptermark{#1}
                 \typeout{\space}
                 \typeout{Processing\space#1}
                 \if@twocolumn
                   \@topnewpage[\@makeschapterhead{#1}]%
                 \else
                   \@makeschapterhead{#1}%
                   \@afterheading
                 \fi}


\def\@makeschapterhead#1{%
  %\vspace*{50\p@}%
  {\parindent \z@ \raggedright %\normalfont
    \interlinepenalty\@M
    \chapterfont#1\par\nobreak
    \vskip 40\p@
  }}

\font\afont=eurb8 at \docsize
\newlength\letterwidth
\newcommand{\PARstart}[1]{%
    \lettrine[lines=2,lhang=0.33,nindent=0em]{
        \dropcolor
            {\textsc{#1}}}{}}  %

% Chapter summary environment, gph.
\newlength{\chapsumwidth}
\setlength{\chapsumwidth}{\textwidth-2\leftmargin}
\newenvironment{chaptersummmary}
               {\vfill\noindent\hfill
                \minipage{\chapsumwidth}
                \setlength{\parskip}{0.3\baselineskip}
                \hrulefill\par}
               {\par\vspace{-0.3\baselineskip}\hrulefill
                \endminipage
                \hspace*{\fill}
                \vskip 50\p@
                \vspace*{\fill}
                \newpage}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SOME INITIALIZATIONS:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% make the following names uppercase:

\newcommand\black{\color{black}}
\newcommand\white{\color{white}}

   \newcommand\chaptercolor{}
   \newcommand\chapterlabelcolor{}
   \newcommand\chapterblobcolor{}
   \newcommand\sectionunderlinecolor{}
   \newcommand\sectioncolor{}
   \newcommand\sectionlabelcolor{}
   \newcommand\subsectioncolor{}
   \newcommand\subsectionlabelcolor{}
   \newcommand\subsubsectioncolor{}
   \newcommand\footercolor{}
   \newcommand\headercolor{}
   \newcommand\vertbarcolor{}
   \newcommand\titlecolor{}
   \newcommand\titlepagecolor{}
   \newcommand\captioncolor{\black}
   \newcommand\captionlabelcolor{}
   \newcommand\captionlinecolor{}
   \newcommand\figlabcolor{}
   \newcommand\tablecolor{}
   \newcommand\marginnotecolor{}
   \newcommand\margintodocolor{}
   \newcommand\dropcolor{}

% Now make the font types, gph.
\font\clfont=eurb10 at 28pt

\newcommand\chapterfont{\fontsize{36}{30}\bfseries\sffamily\chaptercolor}

\newcommand\chapterlabelfont{\normalfont\clfont\chapterlabelcolor}

\newcommand\sectionfont{\normalfont\Large\bfseries\sffamily\sectioncolor}
\newcommand\sectionlabelfont{\normalfont\Large\bfseries\sffamily\sectionlabelcolor}

\newcommand\footerfont{\normalfont\bfseries\sffamily\footercolor}
\newcommand\headerfont{\normalfont\bfseries\sffamily\headercolor}

\newcommand\signofffont{\normalfont\footnotesize\sffamily}

\newcommand\marginnotefont{\normalfont\scriptsize\sffamily\marginnotecolor}
\newcommand\margintodofont{\normalfont\scriptsize\sffamily\margintodocolor}

\newcommand\figlabelfont{\normalfont\small\bfseries\sffamily\figlabcolor}

\newcommand\captionlinefont{\bfseries\captionlinecolor}
\newcommand\tcaptionfont{\normalfont\small\sffamily\captioncolor}
\newcommand\tcaptionlabelfont{\normalfont\bfseries\small\sffamily\captionlabelcolor}

\newcommand\mycaption[2][]{\caption[{#1}]{{\captionlinefont{{#1}.}}\space{#2}}}
\endinput
)

答案1

pdflatex使用该选项进行编译时dvips确实会产生麻烦,无论它是全局给出,还是作为包选项color给出hyperref

经验法则:不要手动设置驱动程序,软件包可以自行选择使用哪个驱动程序。

相关内容