Hot answers tagged pstricks
16
A suggestion with pgfplots:
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=10cm,
height=4cm,
x axis line style={-stealth},
y axis line style={-stealth},
title={Square wave},
xticklabels={},
ymax = 1.5,xmax=7.5,
axis lines*=center,
ytick={0.5,1},
xlabel={Time $\rightarrow$},
ylabel={Amplitude},
...
15
Here's one possibility using TikZ and a simple \foreach loop (I didn't drew the axes since the problem seemed to be the wave itself):
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\foreach \ini [evaluate=\ini as \inieval using 2*\ini] in {0,...,6}
\draw[ultra thick,cyan] (\inieval,0) -- ++(0,1) -| (\inieval+1,0) -- ...
14
\documentclass{article}
\usepackage{pst-3dplot}
\begin{document}
\psset{coorType=1,Alpha=30}% type 1 for orhtogonal x-z-axes
\begin{pspicture}(-2,-3)(3,3)
\pstThreeDCoor[IIIDticks,zMax=6,yMax=1]
\pstThreeDLine(0,0,0)(3,0,0)(3,0,4)(0,0,4)(0,0,0)
\pstThreeDLine(3,0,4)(1.5,0,6)(0,0,4)
\end{pspicture}
\end{document}
the isometric lines are simple lines in ...
13
\documentclass{article}
\usepackage{pst-plot}
\makeatletter
\def\func{ x T1 gt {
T1 yVal \tx@ScreenCoor
2 copy 4 2 roll L pop yVal L
/yVal yVal 0 gt {0}{yMax}ifelse def
/T1 T1 T0 add def } if yVal }
\makeatother
\begin{document}
\psset{xAxisLabel=t, yAxisLabel=U}
\begin{psgraph}{->}(0,0)(0,-0.5)(11,1.5){12cm}{5cm}
...
8
Cheating with pgfplots (verticals are not true verticals :) but gets better with increased sample number).
Jake has brought me to my senses :)
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\begin{document}
\begin{tikzpicture}
\begin{axis}[grid=both,xmin=0,width=7cm,height=4cm,
title=Square ...
7
\documentclass[pstricks,border=17pt]{standalone}
\usepackage{pst-plot}
\psset{algebraic,linewidth=1pt}
\begin{document}
\begin{psgraph}{->}(0,0)(5,2.5){6cm}{5cm}
\pscustom[linestyle=none]
{
\psplot{1}{4}{sqrt(x)}
\gsave
\stroke[linestyle=solid,linecolor=red]
\psplot{4}{1}{sqrt(x/2)}
\fill[fillstyle=solid,fillcolor=orange]
\grestore
...
7
\documentclass{minimal}
\parindent=0pt
\usepackage{pstricks}
\usepackage[nomessages]{fp}
\def\LoadConstants{}
\makeatletter
\def\const{\@ifnextchar[\const@i{\const@i[r]}}
\def\const@i[#1]{\expandafter\const@ii#1,,\@nil}
\def\const@ii#1,#2,#3\@nil#4#5{%
\if\relax\detokenize{#2}\relax
\if\relax\detokenize{#1}\relax ...
7
\documentclass[border=12pt]{standalone}
\usepackage{pstricks}
\def\obj#1{\psline[linecolor=#1](2,6)(6,6)(7,3.5)(6,1)\ignorespaces}
\begin{document}
\begin{pspicture}[showgrid](8,6)
\obj{red}
\end{pspicture}
\qquad
\begin{pspicture}[showgrid](8,6)
\obj{red}
\rput{180}(8,7){\obj{blue}}
\end{pspicture}
\end{document}
7
Maybe something along these lines with TikZ:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix,shapes.multipart,shapes.geometric,fit,scopes}
\tikzset{
>= latex,
el/.style={ellipse, draw, text width=8em, align=center},
rs/.style={rectangle split, draw, rectangle split parts=#1},
ou/.style={draw, inner xsep=1em, inner ysep=1ex, ...
6
\def\zzA#1,#2#3\relax#4{
\if t#2 trunc(#4:#1)%
\else\if r#2 round(#4:#1)%
\else clip(#4)%
\fi\fi}
% Constant declarator invoked in the preamble
\newcommand\const[3][]{%
\if\relax\detokenize{#1}\relax
\edef\temporary{#3}%
\else
\edef\temporary{\zzA#1,c\relax{#3}}%
\wlog{::\temporary}%
\fi
...
6
\numexpr works only with integers but your \heightis 5.4. You can use \dimexpr instead and use the current unit \psunit. However, I wouldn't use the values for Xstart because you can do it again from the center of the plaine:
\documentclass{article}
\usepackage{auto-pst-pdf,pstricks-add}
\usepackage[locale=DE]{siunitx}
...
6
I do not use siunitx it is overkill for writing only a length. \scriptsize and friends have no argument. The {..} have no meaning.
\documentclass{article}
%\usepackage[pdf]{pstricks}
\usepackage{pst-node}
\begin{document}
% Paremeters
\def\Laengde{90 } \def\laengde{\Laengde 2 div }
\def\Bredde{45 } \def\bredde{\Bredde 2 div }
\def\Goalwidth{7.32 ...
6
In my opinion, the interpretation is obvious:
\uput{2}[\i]{0}(4,4){\NonZeroDimenObject}
Consider the 4 arguments before object \NonZeroDimenObject. It is placed
at a radial distance of 2 units (runits to be specific) - first argument {.};
at a variable angle of \i (which ranges from 0 to 345 in steps of 15 degree increments ~ 24 steps in total; ...
6
Without TikZ.
\documentclass[pstricks,border=6pt]{standalone}
\SpecialCoor
\usepackage{fp}
\FPset\RR{2}% circle radius
\FPeval\XX{RR*root(2,3)}
\FPeval\RX{XX+RR}
\FPeval\Width{2*RX}
\FPeval\Height{RX*root(2,3)}
\def\Atom#1{%
\pscircle(\XX,\RR){\RR}
\psline(\RX;60)(0,0)(\RX,0)
\bgroup
\psset{linestyle=dashed}
\psarc(0,0){15pt}{0}{60}
...
6
I had to experiment for a while before I found a solution that worked for me. Here it is:
Log in to your restricted user account.
In the Start Menu, go to MiKTeX 2.9 --> Maintenance (Admin)
Right-click on Settings (Admin) and choose Run as...
Open the program as an Administrator (the Admin will have to type in
his Admin password)
Click Refresh FNDB and ...
6
your code looks like an complicated export from a graphical program and as Karl already pointed out it is not clear what exactly do you want: the image in grayscale or an automatic conversion from color to monochrome? However, here is a correct code for a black and white output:
\documentclass[10pt]{article}
\usepackage{pstricks}\SpecialCoor
...
5
Using pst-sex package to provide constants in both TeX and PS worlds at the same time.
\documentclass[pstricks,border=1pt]{standalone}
\usepackage{pst-node}
\usepackage{pst-sex}
\usepackage[locale=DE]{siunitx}
\const[1]{Radius}{19.2}
\const[1]{Width}{33.3}
\const{Height}{2*Radius}
\const{Length}{Width+Height}
\psset{unit=0.168cm}
\begin{document}
...
5
When there's a following ( you're doing
\pst@@@picture[#1](#3,#4)\LoadConstants(
which is wrong. Change the final part into
% END - redefine \const for invocation inside pspicture
\@ifnextchar(% ignore anything between [] and ()
% BEGIN - inject \LoadConstants into pspicture
{\pst@bugs@@@picture{#1}{#3}{#4}}%
...
5
I really don't understand the purpose of presenting the outer square especially for odd-side regular polygons. In this answer I omit the outer square.
Single:
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot,pst-node,siunitx}
\usepackage[nomessages]{fp}
% constants declarator
\def\LoadConstants{}
\newcommand\const[3][6]{%
...
5
I believe this solution is much simpler than the existing ones. Without declaring nodes! :-)
\documentclass[pstricks]{standalone}
\usepackage{pst-node,multido}
\usepackage[locale=DE]{siunitx}
\def\Label#1{\ncput*[nrot=:U]{\large\SI{#1}{\cm}}}
\def\Inner{{%
\psset{xunit=3.25cm,yunit=3cm}
\begin{pspicture}(8,6)
\bgroup
\psset{linewidth=3pt}
...
5
Because \numexpr for integers. So the better (might be the best) solution is as follows.
I have a package pst-sex (postscript constant declarator for StackEXchange) that I will upload to CTAN someday.
% ========================================================
% Copyright (c) 2013 Bugbusters. All rights reservered.
% LPPL LaTeX Public Project License
% ...
5
marking the angles is the same. Putting the origin in the middle of the base also simplifies the code:
\documentclass{article}
\usepackage{auto-pst-pdf,pst-eucl}
\begin{document}
\psset{unit=0.5mm}
\def\radius{21.5 }
\newlength\Radius \Radius=\radius\psunit
\begin{pspicture}(-3\Radius,0)(3\Radius,5\Radius)
\pstVerb{
/maxB 2 dup 3 sqrt mul add \radius ...
5
Without TikZ.
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot}
\begin{document}
\begin{pspicture}(-1,-1)(9,3)
\psaxes{->}(0,0)(-1,-1)(8.5,2.5)[$x$,0][$y$,90]
\multips(0,0)(2,0){4}{\psline[linecolor=red](0,2)(1,2)(1,0)(2,0)(2,2)}
\end{pspicture}
\end{document}
4
\documentclass{article}
\usepackage{auto-pst-pdf,pstricks-add}
\usepackage[locale=DE]{siunitx}
\newcommand\Label[2][:U]{\ncput*[nrot=#1]{\small\SI{#2}{\cm}}}
\begin{document}
\def\bredde{18 }
\edef\laengde{\the\numexpr3*\bredde/2\relax\space}
\def\radius{3.0 }
\def\afstand{6.5 }
\def\afstandB{3.25 }
\centering
\psset{unit=0.44cm}
...
4
Here's some initial code that you can use as a starting point (I didn't place all the labels); the idea was to use some predefined styles and two chains:
\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows,chains,positioning,patterns,calc}
\tikzset{
boxT/.style={
draw=none,
rectangle,
fill=teal!70,
...
4
A solution without defining nodes. Works only for n=8:
\documentclass{article}
\usepackage[pdf]{pstricks}% for pdflatex --shell-escape
\usepackage{pst-node,multido}
\usepackage[locale=DE]{siunitx}
\ExplSyntaxOn
\cs_new_eq:NN \calc \fp_eval:n
\ExplSyntaxOff
\def\NoSides{8 } \def\SideLength{60 }
\def\OR{\calc{\SideLength/(2*sin(pi/\NoSides))}}
...
4
An incomplete TikZ solution but which is flexible in terms of the number of sides:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
% Disclaimer: I use \pgfmathsetmacro instead of \def
% to avoid conflicts with existing macros
% parameters for the regular polygon
\pgfmathsetmacro{\R}{4} ...
4
The Asymptote is capable of calculations of the integral of f from a to b using adaptive Simpson integration. However, when configured with the GNU Scientific Library (GSL), it includes Si(x) = int(sin(t)/t, t=0..x) function as well. plot-si.tex:
\documentclass[10pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
...
4
The \NonZeroDimenObject you created is based on a pspicture of size (2,2). The frame inside of it only stretches from the origin (0,0) only as far out as (2,1), leaving a vertical gap above it of size 1. As such, the frame/rectangle is pushed downward when being \uput past 180 degrees. You should use the following definition:
\def\NonZeroDimenObject{%
...
4
Just for the (my) fun of it, a fairly automatic TikZ solution which also incorporates shifts and the duty factor:
Code
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows}
\begin{document}
\pgfmathsetmacro{\mydutyfactor}{0.11}
\pgfmathsetmacro{\myperiod}{1.5}
\pgfmathtruncatemacro{\myxlowborder}{-4}
\pgfmathtruncatemacro{\myxtopborder}{3}
...
Only top voted, non community-wiki answers of a minimum length are eligible

