# [OS X TeX] Re: graphics with xelatex

Luis Sequeira lfsequeira at fc.ul.pt
Fri Jul 6 06:14:40 EDT 2007

>
>> I drew a complete graph with 28 vertices (it has 378 edges!) using
>> some five lines of code. That you can't replicate in a drawing
>> program.
>>
>
> It would be more correct and compleate I believe if you were to add,
> ...without a lot of tedium and potentially error-prone repetition''
> at the end of that.
>

You're right, of course.

> One can draw _anything_ in FreeHand or Illustrator and the like (and
> in FreeHand, snap to nodes, power duplicate &c. make technical
> drawings _much_ easier), but there're often better tools which is the
> point you were trying to make I believe.
>

True. My point is that some things are more easily drawn
programmatically, i.~e., by writing descriptive commands that can be
easily understood and reused over and over, with as many variations
as you need, than by
using a more GUI oriented, point and click, approach.

Take the above mentioned graph, for example. Once written down, it is
trivial to adapt to any number of vertices. One may easily define a
\newcommand to draw any such complete graph,
with the number of vertices as a parameter.
Hence drawing a 5- or 28-vertices complete vertices are equally easy.
Or one can draw them side by side with simple code such as

\CompleteGraph{3} \CompleteGraph{4} \CompleteGraph{5} ...

and one can scale them in any way, change the colors, etc.
Here a version of this code (it can be tuned for efficiency, as it
draws each edge twice, but the more efficient code would be harder to
read). The possibility to use polar coordinates and, furthermore, to
divide the circle into as many "degrees" as we need are very handy
features of pstricks :-). I used the package multido to handle
repetitions.

\newcommand{\CompleteGraph}[1]{%
\begin{pspicture}(-1,-1)(1,1)
\SpecialCoor
\degrees[#1]
\multido{\n=1+1}{#1}{\multido{\i=1+1}{#1}{\psline(1;\n)(1;\i)}}
\end{pspicture}%
}

> A really wonderful book on this sort of thing is _Mathematical
> Illustrations_:
>
> http://www.math.ubc.ca/~cass/graphics/manual/
>
> William
>
> --
> senior graphic designer
> Fry Communications
>
>

Thank you very much for this reference. I put it in my bookmarks
right away.

Luis Sequeira