6

How can I reduce the size of a \psdiabox, for instance:

\documentclass[10pt,a4paper,twoside]{scrbook}
\usepackage{pstricks}
\usepackage{pst-all}

\begin{document}
\psset{unit=0.35}
\begin{pspicture}(9.261250,-52.662503)(52.977702,-0.950000)
\begin{psmatrix}[rowsep=1cm,colsep=.5cm]
        & \rput[tc](30.5,-19.5){\psdiabox
            { \begin{tabular}{c}
                ?`$Pueden \, estar \, repetidos$ \\
                $los \, p \, que \, vaya \, a \, tomar?$ \\
                \end{tabular} }}
        \end{psmatrix}

\end{pspicture}
\end{document}

enter image description here

3
  • @user1792344 I've reduced the code to a MWE; the original one is still available in the revision history. May I ask why are you using math mode in the tabular? It's also not very clear what you mean by "too big".
    – egreg
    Sep 13, 2013 at 11:21
  • Without math code the diamond is too big.
    – Tobal
    Sep 13, 2013 at 11:28
  • This feature is a problem to design flowcharts!!
    – Mika Ike
    Apr 18, 2014 at 10:17

2 Answers 2

4
\documentclass{scrbook}
\usepackage{pst-node}
\begin{document}

\psdiabox{%
\begin{tabular}{@{}c@{}}
    ?`$Pueden \, estar \, repetidos$ \\
    $los \, p \, que \, vaya \, a \, tomar?$ \\
\end{tabular}}
%
\psdiabox{%
\makebox[0.7\width]{%
\begin{tabular}{@{}c@{}}
    ?`$Pueden \, estar \, repetidos$ \\
    $los \, p \, que \, vaya \, a \, tomar?$ \\
\end{tabular}}}

\end{document}

enter image description here

2
  • I knew there was an easier solution :).
    – Christoph
    Sep 13, 2013 at 19:48
  • Jjejeje thanks for your help too. And sorry for my own answer. Sometimes is very confused to me the english language
    – Tobal
    Sep 14, 2013 at 14:36
4

First of all, you can reduce framesep=0pt, and you can reduce the spaces left and right of the tabular using @{}c@{} instead of c.

But the main point is, that the width of \psdiabox is twice its height. To change that, you can redefine the internal command \tx@Diamond in order to change the aspect ratio:

\documentclass[pstricks, border=3pt]{standalone}
\usepackage{pst-node}
\usepackage{array}

\makeatletter
\pst@def{Diamond}<%
  /mtrx CM def 
  T rotate 
  1.2 mul /h ED % added the 1.2 mul
  0.8 mul /w ED % added the 0.8 mul
  dup 0 eq { pop } { CLW mul neg 
    /d ED 
    /a w h Atan def 
    /h d a sin Div h add def 
    /w d a cos Div w add def } ifelse 
  mark w 2 div h 2 div w 0 0 h neg w neg 0 0 h w 2 div h 2 div 
  /ArrowA { moveto } def 
  /ArrowB { } def 
  false Line 
  closepath mtrx setmatrix
>
\makeatother

\begin{document}
\begin{pspicture}(6,2)
  \rput(3,1){%
    \psdiabox[framesep=0pt]
      { \begin{tabular}{@{}>{\itshape}c@{}}
        ?`Pueden estar repetidos\\
        los p que vaya a tomar? \\
      \end{tabular}}}
\end{pspicture}
\end{document}

The result is:

enter image description here

Here, I changed the height by a factor of 1.2, and the width by 0.8. You can change it as you like.

If you have other diamonds, which shouldn't be changed, then you must make this change locally.

I strongly recommend you to have a look at pst-tree, see texdoc pst-tree and browse through the documentation! For automatic node alignment and node connections.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .