我正在尝试按照 Latex+dvips+ps2pdfviewpdf 的顺序(在 Ubuntu 中)在 Texmaker 中运行以下示例代码,其中包含由 Geogebra 生成的 PStricks 代码。
\documentclass[10pt,a4paper]{beamer}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{multimedia}
\usepackage{graphicx}
\usepackage{textpos}
\usepackage{graphicx}
\usepackage{pstricks}
\usetheme{CambridgeUS}%NICe
\usefonttheme{serif}
\setbeamercolor{normal text}{bg=white!100}%}, fg=black!100}
\begin{document}
\begin{frame}{Sample}
\begin{figure}[h]
\begin{center}
\psscalebox{0.5 0.5} % Change this value to rescale the drawing.
{
\newrgbcolor{xdxdff}{0.49 0.49 1}
\psset{xunit=0.5cm,yunit=0.5cm,dotstyle=o,dotsize=3pt 0,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
\begin{pspicture*}(-7.96,-11.79)(40.22,11.47)
\psline(-4,8)(-2,10)
\psline(-4,8)(-6,10)
\psline(-4,8)(-6,6)
\psline(-4,8)(-2,6)
\psline(-4,8)(-6.83,7.99)
\psline(-4,8)(-1.24,8.02)
\parametricplot[linestyle=dashed,dash=4pt 4pt]{3.145209626861558}{3.9269908169872414}{1*2.83*cos(t)+0*2.83*sin(t)+-4|0*2.83*cos(t)+1*2.83*sin(t)+8}
\parametricplot[linestyle=dashed,dash=4pt 4pt]{2.356194490192345}{3.145209626861558}{1*2.83*cos(t)+0*2.83*sin(t)+-4|0*2.83*cos(t)+1*2.83*sin(t)+8}
\parametricplot[linestyle=dashed,dash=4pt 4pt]{0.00766901039872073}{0.7853981633974483}{1*2.76*cos(t)+0*2.76*sin(t)+-4|0*2.76*cos(t)+1*2.76*sin(t)+8}
\parametricplot[linestyle=dashed,dash=4pt 4pt]{-0.7853981633974483}{0.00766901039872073}{1*2.83*cos(t)+0*2.83*sin(t)+-4|0*2.83*cos(t)+1*2.83*sin(t)+8}
\end{center}
\end{figure}
\end{frame}
\end{document}
但是我收到错误,没有创建虚线圆弧。出现以下错误:
Undefined control sequence \parametricplot l.510 \end{frame}
答案1
no place for a new dimension
由于beamer有问题,我使用了standalone
class。然后您可以使用\includegraphics
命令。以下是简化的代码:
\documentclass[10pt,a4paper, x11names, pdf]{standalone}%
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{pst-plot}
\begin{document}
\newrgbcolor{xdxdff}{0.49 0.49 1}
\psset{unit=0.25cm,dotstyle=o,dotsize=3pt 0,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25, algebraic}%
\begin{pspicture*}(-7.96,-11.79)(40.22,11.47)%
\psline(-4,8)(-2,10)
\psline(-4,8)(-6,10)
\psline(-4,8)(-6,6)
\psline(-4,8)(-2,6)
\psline(-4,8)(-6.83,7.99)
\psline(-4,8)(-1.24,8.02)
\psset{linecolor = red, linestyle=dashed,dash=4pt 4pt, arrows = c-c }
\parametricplot{3.145209626861558}{3.9269908169872414}{1*2.83*cos(t)+0*2.83*sin(t) +-4|
0*2.83*cos(t)+1*2.83*sin(t)+8}
\parametricplot{2.356194490192345}{3.145209626861558}{1*2.83*cos(t)+0*2.83*sin(t)+-4|0*2.83*cos(t)+1*2.83*sin(t)+8}
\parametricplot{0.00766901039872073}{0.7853981633974483}{1*2.76*cos(t)+0*2.76*sin(t)+-4|0*2.76*cos(t)+1*2.76*sin(t)+8}
\parametricplot{-0.7853981633974483}{0.00766901039872073}{1*2.83*cos(t)+0*2.83*sin(t)+-4|0*2.83*cos(t)+1*2.83*sin(t)+8}
% \parametricplot{3.145}{3.927}{2.83*cos(t)-4|2.83sin(t) + 8}
% \parametricplot{3.145}{3.927}{2.83*cos(t)-4|2.83sin(t) + 8}
% \parametricplot{0.008}{0.785}{2.76*cos(t)-4|2.76*sin(t)+8}
% \parametricplot{-0.785}{0.008}{2.83*cos(t)-4|2.83*sin(t)+8}
\end{pspicture*}
\end{document}
答案2
缺少一些参数。此操作使用xelatex
或latex->dvips->ps2pdf
\documentclass[10pt,a4paper]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{etex}
\usepackage{pst-plot}
\usetheme{CambridgeUS}%NICe
\usefonttheme{serif}
\setbeamercolor{normal text}{bg=white!100}%}, fg=black!100}
\begin{document}
\begin{frame}{Sample}
\begin{center}
\resizebox{0.6\linewidth}{!}{%
\psset{xunit=0.5cm,yunit=0.5cm,dotstyle=o,dotsize=3pt 0,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
\begin{pspicture}(-7,6)(-1,10)
\psline(-4,8)(-2,10)
\psline(-4,8)(-6,10)
\psline(-4,8)(-6,6)
\psline(-4,8)(-2,6)
\psline(-4,8)(-6.83,7.99)
\psline(-4,8)(-1.24,8.02)
\psset{algebraic,linestyle=dashed,dash=4pt 4pt}
\parametricplot{3.145209626861558}{3.9269908169872414}{1*2.83*cos(t)+0*2.83*sin(t)+-4|0*2.83*cos(t)+1*2.83*sin(t)+8}
\parametricplot{2.356194490192345}{3.145209626861558}{1*2.83*cos(t)+0*2.83*sin(t)+-4|0*2.83*cos(t)+1*2.83*sin(t)+8}
\parametricplot{0.00766901039872073}{0.7853981633974483}{1*2.76*cos(t)+0*2.76*sin(t)+-4|0*2.76*cos(t)+1*2.76*sin(t)+8}
\parametricplot{-0.7853981633974483}{0.00766901039872073}{1*2.83*cos(t)+0*2.83*sin(t)+-4|0*2.83*cos(t)+1*2.83*sin(t)+8}
\end{pspicture}}
\end{center}
\end{frame}
\end{document}
答案3
不要依赖 Geogebra 生成的代码,因为它浪费了很多击键。
\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{multido}
\def\radius{3 }
\def\angle{45 }
\begin{document}
\begin{pspicture}(-\radius,-\radius)(\radius,\radius)
\multido{\i=1+-1}{3}{\psline(!\radius \i\space \angle mul 180 add PtoC)(!\radius \i\space \angle mul PtoC)}
\multido{\i=0+1}{2}{\psarc[linestyle=dashed,linecolor=red](0,0){\radius}{!-\angle 180 \i\space mul add}{!\angle 180 \i\space mul add}}
\end{pspicture}
\end{document}