使用 pgfplots 和 pgfornament 时出现的问题

使用 pgfplots 和 pgfornament 时出现的问题

我正在尝试解决一个奇怪的问题,但到目前为止还没有成功。问题如下:

  1. 我正在写一篇长篇论文(论文),其中包含情节、装饰和表格。
  2. 当我使用 pgfplots 绘制图形时,我得到如下图所示的图形: 正确的情节本该如此

  3. 但是当我包含 pgfornament 包时,我得到了以下图表: 使用 pgfornament 后出现错误绘图

这是使用 pgfornament 之前包含的包的列表,并给出了正确的图表。

\documentclass[12pt,english]{report}
\usepackage{setspace}
\usepackage{babel}
\usepackage{buthesis}
\usepackage{amsmath,amssymb,graphicx,amsfonts,amsthm}
\usepackage{verbatim}
\usepackage{epsfig}
\usepackage{wrapfig}
\usepackage{latexsym,amsfonts,amscd}
\usepackage{changebar}
\usepackage{enumerate}
\usepackage{tikz}
\usetikzlibrary{decorations}
\usetikzlibrary{shadows}
\usepackage{pgfplots}
\pgfplotsset{compat=1.3}

% Used only for example text
\usepackage{lipsum}

\usepackage[footnotesize,bf]{caption}  % Reduces caption font sizes

%%%%%%%%%%%%%%%%% Fancy chapter headings %%%%%%%%%%%%%%%%%%%
\usepackage[Bjarne]{ThesisFncychap}
\include{BjarneThesisTitles}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%-----------------------------------------------------------------
%% Control the fonts and formatting used in the table of contents, list of
%% figures, and list of tables
\usepackage[titles]{tocloft}

\setlength{\cftbeforechapskip}{-1ex}
\setlength{\cftbeforesecskip}{-3.5ex}
\setlength{\cftbeforesubsecskip}{-3.5ex}
\setlength{\cftbeforetabskip}{-3.5ex}
\setlength{\cftbeforefigskip}{-3.5ex}
%-----------------------------------------------------------------

\dissertation

下面是生成乱序图的代码。第一个代码和下面的代码之间的唯一区别是我添加了这一行:\usepackage[object=vectorian]{pgfornament}。另外,我有大约 10 个这样的图,应该通过 latex 自动调整为两页。但是使用 pgfornament 包后,这些图不会自动调整为两页,而是在一页中,有些会隐藏在页边距中。

\documentclass[12pt,english]{report}
\usepackage{setspace}
\usepackage{babel}
\usepackage{buthesis}
\usepackage{amsmath,amssymb,graphicx,amsfonts,amsthm}
\usepackage{verbatim}
\usepackage{epsfig}
\usepackage{wrapfig}
\usepackage{latexsym,amsfonts,amscd}
\usepackage{changebar}
\usepackage{enumerate}
% Do you use TikZ?
\usepackage{tikz}
\usetikzlibrary{decorations}
\usetikzlibrary{shadows}
\usepackage[object=vectorian]{pgfornament}
\usepackage{pgfplots}
\pgfplotsset{compat=1.3}

% Used only for example text
\usepackage{lipsum}

\usepackage[footnotesize,bf]{caption}  % Reduces caption font sizes

%%%%%%%%%%%%%%%%% Fancy chapter headings %%%%%%%%%%%%%%%%%%%
\usepackage[Bjarne]{ThesisFncychap}
\include{BjarneThesisTitles}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%-----------------------------------------------------------------
%% Control the fonts and formatting used in the table of contents, list of
%% figures, and list of tables
\usepackage[titles]{tocloft}

%% Aesthetic spacing redefines that look nicer to me than the defaults.
\setlength{\cftbeforechapskip}{-1ex}
\setlength{\cftbeforesecskip}{-3.5ex}
\setlength{\cftbeforesubsecskip}{-3.5ex}
\setlength{\cftbeforetabskip}{-3.5ex}
\setlength{\cftbeforefigskip}{-3.5ex}
%-----------------------------------------------------------------

\dissertation 
  1. 数据这个词是可以的,因为我已经自己设置了它\centerline{Data}

編輯:

上述代码来自我正在处理的文档。为了让读者更轻松地完成任务,我发布了一个非常简化的代码版本,其中问题仍然存在。这可以视为最低限度的工作代码。

\title{A Very Simple \LaTeXe{} Template}
\author{
}
\date{\today}

\documentclass[12pt]{report}
\usepackage[object=vectorian]{pgfornament}
\usepackage{pgfplots}
\pgfplotsset{compat=1.3}


\begin{document}
\maketitle

\pgfplotsset{grid style={dashed}}
\pgfkeys{/pgfplots/MyLineStyle/.style={samples=50, ultra thick}}
\pgfkeys{
    /pgf/number format/precision=3,
    /pgf/number format/fixed zerofill=true }

\pgfplotsset{
tick label style={font=\LARGE},
label style={font=\LARGE},
legend style={font=\LARGE},
title style={font=\LARGE}
}
\tikzset{every mark/.append style={scale=2}}

\centerline {\textbf{Data}}
\begin{tikzpicture}[scale=0.70]
\begin{axis}[title={Data-Segment},
xlabel=Z,
ylabel=P,
xticklabel style={/pgf/number format/fixed,
                  /pgf/number format/precision=0},
grid=major,
]
\addplot+[color=black,mark options={black},mark size = 2,line width=1.5pt,mark =*,style=densely dashed] coordinates {
(10,0.331)
(20,0.329)
(30,0.323)
(40,0.328)
(50,0.322)
(60,0.325)
(70,0.323)
(80,0.320)
(90,0.321)
(100,0.319)
};\label{p5}
\addplot+[color=black,mark options={black},mark size = 2,line width=1.5pt] coordinates {
(10,0.32)
(20,0.32)
(30,0.319)
(40,0.318)
(50,0.315)
(60,0.315)
(70,0.315)
(80,0.31)
(90,0.310)
(100,0.310)
};\label{p6}
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}[scale=0.70]
\begin{axis}[title={Data-Segment},
xlabel=Z,
ylabel=P,
legend style={ at={(1,0.5)},
anchor=east},
xticklabel style={/pgf/number format/fixed,
                  /pgf/number format/precision=0},
grid=major]
\addplot[color=black,mark options={black},mark size = 2,line width=1.5pt,mark =*,style=densely dashed] coordinates {
(10,0.331)
(20,0.329)
(30,0.323)
(40,0.328)
(50,0.322)
(60,0.325)
(70,0.323)
(80,0.320)
(90,0.321)
(100,0.319)
};
\addplot+[color=black,mark options={black},mark size = 2,line width=1.5pt,mark=square*] coordinates {
(10,0.32)
(20,0.32)
(30,0.32)
(40,0.319)
(50,0.317)
(60,0.312)
(70,0.312)
(80,0.31)
(90,0.309)
(100,0.31)
};
\end{axis}
\end{tikzpicture}
\newline
\begin{tikzpicture}[scale=0.70]
\begin{axis}[title={Data-Segment},xlabel=Z,ylabel=P,legend style={ at={(1,0.5)}, anchor=east},grid=major,xticklabel style={/pgf/number format/fixed,
                  /pgf/number format/precision=0},
]
\addplot[color=black,mark options={black},mark size = 2,line width=1.5pt,mark =*,style=densely dashed] coordinates {
(10,0.331)
(20,0.329)
(30,0.323)
(40,0.328)
(50,0.322)
(60,0.325)
(70,0.323)
(80,0.320)
(90,0.321)
(100,0.319)
};
\addplot+[color=black,mark options={black},mark size = 2,line width=1.5pt,mark=square*] coordinates {
(10,0.320)
(20,0.319)
(30,0.319)
(40,0.320)
(50,0.314)
(60,0.318)
(70,0.319)
(80,0.32)
(90,0.322)
(100,0.328)
};
\end{axis}
\end{tikzpicture}
\bibliographystyle{abbrv}
\bibliography{simple}

\end{document}

正确输出

在此处输入图片描述

答案1

我已设法重现该问题(不知道为什么我昨天的方法失败了)。

根本原因是 中的一个错误pgfornament.sty:它会全局覆盖 tikz 键at。如果我取消注释pgfornament.sty:97,它就会变成

\tikzset{%
%at/.code={\def\ornamenttopos{#1}},
options/.style={options default,#1},
ornament symmetry/.code={\def\ornamenttosymmetry{#1}},

一切正常。

我建议您提交一个错误报告pgfornament.sty

相关内容