[pstricks] 2 pictures (psmatrix) side by side

Denis Girou Denis.Girou at idris.fr
Wed Nov 28 21:20:02 CET 2001


>>>>> "Richard.Sudarmono" == Richard Sudarmono <RiSud at web.de> writes:

    Richard.Sudarmono> Bty .. I know how to make a parallelogram. But how can I use it as a
    Richard.Sudarmono> framebox (as \psovalbox or \psdiabox)?
    Richard.Sudarmono> (Just like the folowing picture..)

    Richard.Sudarmono>       _______________
    Richard.Sudarmono>     /               /
    Richard.Sudarmono>   / Parallelogram /
    Richard.Sudarmono> /_______________/

    Richard.Sudarmono> Maybe you can give me hint, where I could find the example/answer for
    Richard.Sudarmono> my problem.

  This doesn't exist. But this is not too difficult to build adapting the code
of \psframebox.

\documentclass[a4paper]{article}

\usepackage{pstricks}

\makeatletter

% Box of a parallelogram form built using the code of \psframebox

% The length used for the parallelogram (3mm by default)
\newdimen\psparallelogramsep
\def\psset at parallelogramsep#1{\pssetlength\psparallelogramsep{#1}}
\psset at parallelogramsep{3mm}

\def\psparallelogrambox{\pst at object{psparallelogrambox}}

\def\psparallelogrambox at i{\pst at makebox\psparallelogrambox at ii}

\def\psparallelogrambox at ii{%
\begingroup
\pst at useboxpar
\pst at dima=\pslinewidth
\advance\pst at dima by \psframesep
\pst at dimc=\wd\pst at hbox\advance\pst at dimc by \pst at dima
\pst at dimb=\dp\pst at hbox\advance\pst at dimb by \pst at dima
\pst at dimd=\ht\pst at hbox\advance\pst at dimd by \pst at dima
\setbox\pst at hbox=\hbox{%
\ifpsboxsep\kern\pst at dima\fi
\begin at ClosedObj
\addto at pscode{%
\psk at cornersize
\pst at number\pst at dima neg
\pst at number\pst at dimb neg
\pst at number\pst at dimc
\pst at number\pst at dimd
.5
% D.G. modification begin - Nov. 28, 2001
%\tx at Frame}%
\pst at number\psparallelogramsep
\tx at Parallelogram}%
% D.G. modification end
\def\pst at linetype{2}%
\showpointsfalse
\end at ClosedObj
\box\pst at hbox
\ifpsboxsep\kern\pst at dima\fi}%
\ifpsboxsep\dp\pst at hbox=\pst at dimb\ht\pst at hbox=\pst at dimd\fi
\leavevmode\box\pst at hbox
\endgroup}

% From the Frame and Rect PostScript macros
\pst at def{Parallelogram}<{%
/ParallelogramA {
x1 pgs sub y1 moveto
x1 y2 lineto
x2 pgs add y2 lineto
x2 y1 lineto
x1 pgs sub y1 lineto
closepath} def
%
/pgs ED
CLW mul
/a ED
3 -1 roll
2 copy gt { exch } if
a sub
/y2 ED
a add
/y1 ED
2 copy gt { exch } if
a sub
/x2 ED
a add
/x1 ED
1 index 0 eq {pop pop ParallelogramA } { OvalFrame } ifelse}>

\makeatother

\pagestyle{empty}

\begin{document}

\LARGE

\psparallelogrambox{T}
\hfill
\psparallelogrambox[parallelogramsep=0]{T}
\hfill
\psparallelogrambox[parallelogramsep=0.1]{T}
\hfill
\psparallelogrambox[parallelogramsep=0.5]{T}
\hfill
\psparallelogrambox[parallelogramsep=1]{T}

\vspace{1cm}

\psparallelogrambox{Text}
\hfill
\psparallelogrambox[parallelogramsep=0.5]{Text}
\hfill
\psparallelogrambox[linecolor=red,fillstyle=solid,fillcolor=cyan,
                    doubleline=true]{Text}

\vspace{1cm}
\psparallelogrambox{Long text}
\hfill
\psparallelogrambox[parallelogramsep=0.5]{Long text}
\hfill
\psparallelogrambox{\shortstack{Text\\Text\\Text}}
\hfill
\psparallelogrambox[parallelogramsep=1]{\shortstack{Text\\Text\\Text}}

\end{document}


D.G.



More information about the PSTricks mailing list