[OS X TeX] square cells and more

Eric van der Oord eric.van-der-oord at wanadoo.fr
Fri Dec 24 09:22:30 CET 2004


Poor man's solution is drawing : here is a metapost example :

Eric

%Metapost source code for Dürer's Melancholia magic square

beginfig(1);
u=1cm;
dx=0.5*u-8bp;
dy=0.5*u;
z0=(dx,dy);

pickup pencircle scaled 0.75bp ;

for  i=0 upto 4 :
     draw (0,i*u) -- (4*u,i*u) ;
     draw (i*u,0) -- (i*u,4*u) ;
endfor ;

label.rt(btex $\ 4$ etex, z0) ;
label.rt(btex $15$ etex, z0 shifted (u,0)) ;
label.rt(btex $14$ etex, z0 shifted (2*u,0)) ;
label.rt(btex $\ 1$ etex, z0 shifted (3*u,0)) ;
label.rt(btex $\ 9$ etex, z0 shifted (0,u)) ;
label.rt(btex $\ 6$ etex, z0 shifted (u,u)) ;
label.rt(btex $\ 7$ etex, z0 shifted (2*u,u)) ;
label.rt(btex $12$ etex, z0 shifted (3*u,u)) ;
label.rt(btex $\ 5$ etex, z0 shifted (0,2*u)) ;
label.rt(btex $10$ etex, z0 shifted (u,2*u)) ;
label.rt(btex $11$ etex, z0 shifted (2*u,2*u)) ;
label.rt(btex $\ 8$ etex, z0 shifted (3*u,2*u)) ;
label.rt(btex $16$ etex, z0 shifted (0,3*u)) ;
label.rt(btex $\ 3$ etex, z0 shifted (u,3*u)) ;
label.rt(btex $\ 2$ etex, z0 shifted (2*u,3*u)) ;
label.rt(btex $13$ etex, z0 shifted (3*u,3*u)) ;

endfig;
end;

Le 23 déc. 04, à 17:40, Arno Kruse a écrit :

> Es irrt der Mensch so lang er strebt. (Goethe, Faust 1)
>
> I wanted to write code for an apparent simple magig square my small 
> pupils like a lot; of course in LaTeX. (If the reader does not 
> remember: a magig square - in Germany we call it "magisches Quadrat" - 
> is a square matrix, filled with numbers; if you add all the numbers in 
> a line, a column or in the diagonals, the sum must be the same: the so 
> called "magig number".)
>
> No problem for an "experienced" LaTeXer like me.
> I thought.
>
> A lot of time later a frustrated LaTeX-user called Arno contented 
> himself with a code he better does not show you…
>
> Comp.text.tex did not help me, the only result I got was extremely 
> complicated and unflexibel and looked ruefully.
> Well, there is this list, and there is Will Robertson; I decided to 
> ask him, and you all know the result - a remarkable solution. It works 
> perfectly for me, and I want to thank Will heartily. I do not 
> understand everything of his code yet, but I like to learn using 
> examples like these. (By the way, I do agree to Hendrik Chaltin: 
> Complete examples of code are, especially when written by an artist 
> like Will, extremely helpful for beginners and even advanced users.)
>
> Please allow me some remarks anyhow:
> 1. Square cells are in my opinion (maybe I am completely wrong) a sort 
> of elementar modules. I wonder why it is complicated that way to 
> produce them.
> 2. Other users may have different solutions to produce square cells; I 
> am interested to learn how they have solved the difficulties, you may 
> write me off list, if you like.
> 3. Problems of this manner are not specific Mac-problems, and so I 
> first tried to find a solution in comp.text.tex. Do you think anyhow 
> that it is useful and adequate to discuss them in this list?
> 4.  If the answer is yes: There are certainly more "little problems" 
> like mine and a lot of interesting and helpful solutions - why not 
> announce your questions and answers here?
> 5. Will, you have written
> \settoheight\fontheight{(}.
> I have no idea why you have chosen just this brace.
>
> Again: Thank you very much,Will!
>
> Arno
>
> --------------------- Info ---------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>           & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
>
>
>


--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list