对于 pstricks 来说太难了?

对于 pstricks 来说太难了?

我正在尝试将 GeoGebra 中创建的分段函数图形复制到 LaTeX 文档中,但我看到的只有轴,没有曲线。我正在运行 TexShop 并使用 XeLaTex 进行编译。在日志文件中,我收到以下不祥的消息:

** WARNING ** Image format conversion for PSTricks failed.
** WARNING ** Interpreting special command pst: (ps:) failed.

问题是,更简单的图形,如抛物线和直线似乎还可以——这个是不是太复杂了?

\documentclass[10pt]{article}
\usepackage{pstricks-add}
%\usepackage{pst-plot}
\pagestyle{empty}
\begin{document}
\newrgbcolor{xdxdff}{0.49 0.49 1}
\psset{algebraic=true} 
\psset{xunit=2.0cm,yunit=2.0cm}
\begin{pspicture*}(-3.94,-5.35)(7.93,3.35)
\psgrid[subgriddiv=0,gridlabels=0,gridcolor=lightgray](0,0)(-3.94,-5.35)(7.93,3.35)
\psset{xunit=1.0cm,yunit=1.0cm,algebraic=true,dotstyle=o,dotsize=3pt 0,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
\psaxes[labelFontSize=\scriptstyle,xAxis=true,yAxis=true,Dx=2,Dy=2,ticksize=-2pt 0,subticks=2]{->}(0,0)(-7.88,-10.7)(15.86,6.69)
\psplot[plotpoints=200]{-7.883107654532565}{0.95999979546005}{(x*<*0.96)*(x^2+1)}
\psplot[plotpoints=200]{1.0800001247036413}{6.999999907292117}{((1.08*<*x)*∧*(x*<*7))*(x-1)*(x-2)*(x-5)/(x-4)}
\begin{scriptsize}
\psdots[dotstyle=*,linecolor=blue](1,4)
\psdots[dotsize=4pt 0,linecolor=xdxdff](1,2)
\psdots[linecolor=xdxdff](1,0)
\end{scriptsize}
\end{pspicture*}
\end{document}

答案1

有可选参数<x|y>MaxValue(参见文档)

\documentclass[10pt]{article}
\usepackage{pstricks-add}
%\usepackage{pst-plot}
\pagestyle{empty}
\begin{document}
\newrgbcolor{xdxdff}{0.49 0.49 1}
\psset{algebraic,unit=2.0cm}
\begin{pspicture*}(-3.94,-5.35)(7.93,3.35)
\psgrid[subgriddiv=0,gridlabels=0,gridcolor=lightgray](0,0)(-3.94,-5.35)(7.93,3.35)
\psset{xunit=1.0cm,yunit=1.0cm,algebraic=true,dotstyle=o,dotsize=3pt 0,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
\psaxes[labelFontSize=\scriptstyle,xAxis=true,yAxis=true,Dx=2,Dy=2,ticksize=-2pt 0,
        subticks=2]{->}(0,0)(-7.88,-10.7)(15.86,6.69)
\psplot[plotpoints=200,linewidth=2pt]{-7.883107654532565}{0.95999979546005}{(x^2+1)}
\psplot[plotpoints=200,linewidth=2pt,
        yMaxValue=7,yMinValue=-10]{1.0800001247036413}{6.999999907292117}{(x-1)*(x-2)*(x-5)/(x-4)}
\psline[linestyle=dashed,linewidth=1.5pt](4,-11)(4,7)
\psdots[dotstyle=*,linecolor=blue](1,4)
\psdots[dotsize=4pt 0,linecolor=xdxdff](1,2)
\psdots[linecolor=xdxdff](1,0)
\end{pspicture*}

\end{document}

在此处输入图片描述

答案2

在我看来,x 范围似乎已从前两个强制参数复制到最后一个参数中的函数的伪子项中

{-7.883107654532565}{0.95999979546005}{(x*<*0.96)*
     -7.9 < x < .96                     ???????


{1.0800001247036413}{6.999999907292117}{((1.08*<*x)*∧*(x*<*7))
         1.08 < x < 7                   ????????????????????

无论如何,删除它可以使其运行而不会出现错误:

在此处输入图片描述

\documentclass[10pt]{article}
\usepackage{pstricks-add}
%\usepackage{pst-plot}

\pagestyle{empty}

\begin{document}

\newrgbcolor{xdxdff}{0.49 0.49 1}
\psset{algebraic=true} 
\psset{xunit=2.0cm,yunit=2.0cm}
\begin{pspicture*}(-3.94,-5.35)(7.93,3.35)
\psgrid[subgriddiv=0,gridlabels=0,gridcolor=lightgray](0,0)(-3.94,-5.35)(7.93,3.35)
\psset{xunit=1.0cm,yunit=1.0cm,algebraic=true,dotstyle=o,dotsize=3pt 0,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
\psaxes[labelFontSize=\scriptstyle,xAxis=true,yAxis=true,Dx=2,Dy=2,ticksize=-2pt 0,subticks=2]{->}(0,0)(-7.88,-10.7)(15.86,6.69)
\psplot[plotpoints=200]{-7.883107654532565}{0.95999979546005}{(x^2+1)}
\psplot[plotpoints=200]{1.0800001247036413}{6.999999907292117}{(x-1)*(x-2)*(x-5)/(x-4)}
\begin{scriptsize}
\psdots[dotstyle=*,linecolor=blue](1,4)
\psdots[dotsize=4pt 0,linecolor=xdxdff](1,2)
\psdots[linecolor=xdxdff](1,0)
\end{scriptsize}
\end{pspicture*}
\end{document}

相关内容