我有一个 pstrick 图形的模板代码,因为我经常需要制作具有相同特征的图形。这样,我就可以填写我需要的代码片段,例如绘图或绘图等。当我编译此代码时,它会给我一个.ps
看起来不错的图形。但是,当我在另一个.tex
文件中使用此图形时,.ps
我得到的是.pdf
该图像颠倒且非常小,根本不具备它应有的尺寸。
.tex
我用来调用该图的文件很.ps
简单:
\documentclass[10pt]{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}[ht]
\centering
\includegraphics[]{testFig.ps}
\caption{test}
\end{figure}
\end{document}
这是我编译后得到的结果:
它看起来应该是这样的:
你们有人遇到过这样的问题吗?我完全不知道发生了什么。
我把图的代码放在最后,因为它有点大。如果你能提示一下是什么原因造成的,我会很高兴听到你的消息。
\documentclass[pstricks,border={0pt 0pt 0pt 0pt}]{standalone}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{pstricks-add,pst-plot}
\usepackage{amsfonts,amssymb,amsmath,latexsym}
\usepackage{lmodern}
\usepackage{fancybox}
\usepackage{pstricks}
\usepackage{float}
\usepackage{multirow}
\usepackage{multido}
\usepackage{calc}
\usepackage{pst-intersect,rotating}
\usepackage{xstring}
\pagestyle{empty}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{borda}{rgb}{0.2, 0.2, 0.6} % frame and axes
\definecolor{bg}{rgb}{0.91, 0.84, 0.42} % background
% Frame box
\newcommand{\myframebox}[1] {\psframebox[fillstyle=solid,fillcolor=bg,linestyle=none]{#1}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\intx{0.4} % data range in the x-axis
\def\inty{100} % data range in the y-axis
%
\def\dvx{25} % 10/intx the ratio between the psfigure x-axis range (10) and the x-axis data range
\def\dvyT{1} % 10/intx the ratio between the psfigure y-axis range (10) and the y-axis data range
\def\dvyM{0.5}
\def\dvyB{0.25}
%
\def\cenx{-5.8} % the starting point of the x-axis' labels
\def\cenyT{0} % the starting point of the y-axis' labels
\def\cenyM{0}
\def\cenyB{-8}
%
\def\sx{5.8 add} % shift of the data initial point in the x-axis
\def\syT{0 add} % shift of the data initial point in the y-axis
\def\syM{0 add}
\def\syB{8 add}
%
\def\lax{0.1} % step of the labels in the x-axis
\def\layT{1} % step of the labels in the y-axis
\def\layM{2}
\def\layB{4}
%
\def\mulx{2.5} % lax * divx: plot's range in the x-axis
\def\mulyT{1} % lay * divy: plot's range in the y-axis
\def\mulyM{1}
\def\mulyB{1}
%
\def\slax{5} % number of subdivisions between labels in the x-axis
\def\slayT{2} % number of subdivisions between labels in the y-axis
\def\slayM{2}
\def\slayB{2}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\myscaleT{
\psset{algebraic,xunit=1.9cm,yunit=0.9cm}
\psframe[fillstyle=solid,fillcolor=bg,linestyle=none](0,0)(10,10)
\pstScalePoints(\dvx, \dvyT)\sx\syT
}
\def\myscaleM{
\psset{algebraic,xunit=1.9cm,yunit=0.9cm}
\psframe[fillstyle=solid,fillcolor=bg,linestyle=none](0,0)(10,10)
\pstScalePoints(\dvx, \dvyM)\sx\syM
}
\def\myscaleB{
\psset{algebraic,xunit=1.9cm,yunit=0.9cm}
\psframe[fillstyle=solid,fillcolor=bg,linestyle=none](0,0)(10,10)
\pstScalePoints(\dvx, \dvyB)\sx\syB
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\myaxlabT}[1]{
\psaxes[labels=#1,Ox=\cenx,Dx=\lax,dx=\mulx,Oy=\cenyT,Dy=\layT,dy=\mulyT,xsubticks=\slax,ysubticks=\slayT,
linewidth=1.5pt,tickwidth=0.1pt,linecolor=borda,tickstyle=inner,
ticksize=-4pt 4pt,axesstyle=frame,ylabelsep=2pt,ylabelOffset=0pt,xlabelsep=2pt,tickcolor=borda ,
subtickcolor=borda,labelFontSize=\bf \Large\color{borda},
% xlabelFactor={^\circ},
](0,0)(10,10)
}
\newcommand{\myaxlabM}[1]{
\psaxes[labels=#1,Ox=\cenx,Dx=\lax,dx=\mulx,Oy=\cenyM,Dy=\layM,dy=\mulyM,xsubtic ks=\slax,ysubticks=\slayM,
linewidth=1.5pt,tickwidth=0.1pt,linecolor=borda,tickstyle=inner,
ticksize=-4pt 4pt,axesstyle=frame,ylabelsep=2pt,ylabelOffset=0pt,xlabelsep=2pt,tickcolor=borda ,
subtickcolor=borda,labelFontSize=\bf \Large\color{borda},
% xlabelFactor={^\circ},
](0,0)(10,10)
}
\newcommand{\myaxlabB}[1]{
\psaxes[labels=#1,Ox=\cenx,Dx=\lax,dx=\mulx,Oy=\cenyB,Dy=\layB,dy=\mulyB,xsubtic ks=\slax,ysubticks=\slayB,
linewidth=1.5pt,tickwidth=0.1pt,linecolor=borda,tickstyle=inner,
ticksize=-4pt 4pt,axesstyle=frame,ylabelsep=2pt,ylabelOffset=0pt,xlabelsep=2pt,tickcolor=borda ,
subtickcolor=borda,labelFontSize=\bf \Large\color{borda},
% xlabelFactor={^\circ},
](0,0)(10,10)
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
% Do not let spaces between lines or else the MULTIDO may not work
\psset{algebraic,xunit=1cm,yunit=1cm}
\begin{pspicture}(0,-1.75)(21,27.95)
\psframe[fillstyle=solid,fillcolor=borda!20,linewidth=1.5pt,linecolor=borda,line style=solid](0,0)(21,29.7)
%
%
% TOP FIGURE
\uput[r](0.8,20.0){
\myscaleT
%
\myaxlabT{y}
%
}
%
%
% MID FIGURE
\uput[r](0.8,10.6){
\myscaleM
%
%
\myaxlabM{y}
%
}
%
%
%BOTTOM FIGURE
\uput[r](0.8,1.2){
\myscaleB
%
%
\myaxlabB{all}
%
}
\end{pspicture}
\end{document}