[texhax] Placing text in a graphical manner (bad description, sorry)

Uwe Lück uwe.lueck at web.de
Thu Nov 15 10:10:00 CET 2012


Am Mittwoch, den 14.11.2012, 12:03 -0700 schrieb Gordon Haverland:
> Using Xfig and fig2dev to lean on, I 
> have a start.  The formatting is really ugly at this point.  
> Perhaps others are interested in the data?  I am manually 
> calculating the positioning.  Some of the data really should be a 
> range, instead of a single value.

The next thing I would do is introducing macros for abstraction 
and reducing the code, such as \putline or even \putcompound etc. 
You might say you need a macro \putcompound whose arguments are 
obvious and now try to find a definition of \putcompound that 
makes it work according to your specification.

Very first of all, indenting code for structuring would be helpful 
(lost in sending?):

    \put(600,-1800){%
        \makebox(0,0)[lb]{\smash{%
            {\SetFigFont{12}{14.4}%
                        {\rmdefault}{\mddefault}{\updefault}%
                        {0.0002}}}}}

The \makebox thing seems to vary only in one argument, displayed 
<text>, so [curious about appearance of <meta> in HMTL mails]

    \makeboxof{<text>}

    \newcommand*{\makeboxof}[1]{%
        \makebox(0,0)[lb]{\smash{%
            {\SetFigFont{12}{14.4}%
                        {\rmdefault}{\mddefault}{\updefault}%
                        {#1}}}}}

(I believe, however, \smash{{\SetFigFont...}} can be replaced by 
 \smash{\SetFigFont...}, the argument of \smash being processed 
 within an \hbox.)

First you seem to put labels to the frame, could be 

    \putlabel{<x>}{<y>}{<label>}

    \newcommand*{\putlabel}[3]{%
        \put(#1,#2){\makeboxof{#3}}}

For placing compound/element/material names:

    \rawputmatter{<x>}{<y>}{<matter>}

    \newcommand*{\rawputmatter}[3]{%
        \put(#1,#2){\rotatebox{270.0}{\makeboxof{#3}}}}

Originally, you wrote about a logarithmic scale, and now about 
"manually calculating the positioning". In June, a new package 
(scientific) `calculator' appeared that can calculate logarithms, 
trigonometry etc., actually made for a LaTeX package `xpicture' 
to extend LaTeX's `picture' environment:

    http://ctan.org/pkg/calculator
    http://www.upv.es/~rfuster/xpicture/

This may help for some \smartputmatter. The second argument 
of \rawputmatter seems to be a design choice, not so calculable, 
but the first one may be a logarithmic function of some material 
index, so something like

    \smartputmatter{<index>}{<y>}{<matter>}

    \newcommand*{\smartputmatter}[1]{%
        \rawputmatter{\logof{#1}}}

provided we can find such an expandable macro \logof, otherwise some

    \newcommand*{\smartputmatter}[1]{%
        \setlogof{\thelog}{#1}%
        \rawputmatter{\thelog}}

Maybe I have overlooked something, and I do not understand the 
"range" thing.

Cheers,

    Uwe.

> \documentclass[letter,12pt]{article}
> 
> \usepackage{graphicx}
> 
> \begin{document}
> 
> \setlength{\unitlength}{4144sp}%
> %
> \begingroup\makeatletter\ifx\SetFigFont\undefined%
> \gdef\SetFigFont#1#2#3#4#5{%
>   \reset at font\fontsize{#1}{#2pt}%
>   \fontfamily{#3}\fontseries{#4}\fontshape{#5}%
>   \selectfont}%
> \fi\endgroup%
> \begin{picture}(7449,10284)(439,-9928)
> \thinlines
> {\put(600,-1550){\line( 1, 0){7000}}
> }%
> {\put(600,-4100){\line( 1, 0){7200}}
> }%
> {\put(451,-9916){\framebox(7425,10260){}}
> }%
> \put(600,-1800){\makebox(0,0)[lb]{\smash{{\SetFigFont{12}{14.4}
> {\rmdefault}{\mddefault}{\updefault}{0.0002}%
> }}}}
> \put(2413,-1800){\makebox(0,0)[lb]{\smash{{\SetFigFont{12}{14.4}
> {\rmdefault}{\mddefault}{\updefault}{0.001}%
> }}}}
> \put(5006,-1800){\makebox(0,0)[lb]{\smash{{\SetFigFont{12}{14.4}
> {\rmdefault}{\mddefault}{\updefault}{0.01}%
> }}}}
> \put(7349,-1800){\makebox(0,0)[lb]{\smash{{\SetFigFont{12}{14.4}
> {\rmdefault}{\mddefault}{\updefault}{0.08}%
> }}}}
> \put(600, -100){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Aerographite}%
> }}}}}
> \put(2618, -100){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Air}%
> }}}}}
> \put(2413, -100){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Aerogel}%
> }}}}}
> \put(3445, -100){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Feathers}%
> }}}}}
> \put(6568, -100){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Concrete Foam}%
> }}}}}
> \put(7198, -100){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Styrofoam}%
> }}}}}
> %
> \put(600,-4350){\makebox(0,0)[lb]{\smash{{\SetFigFont{12}{14.4}
> {\rmdefault}{\mddefault}{\updefault}{0.08}%
> }}}}
> \put(1632,-4350){\makebox(0,0)[lb]{\smash{{\SetFigFont{12}{14.4}
> {\rmdefault}{\mddefault}{\updefault}{0.2}%
> }}}}
> \put(3445,-4350){\makebox(0,0)[lb]{\smash{{\SetFigFont{12}{14.4}
> {\rmdefault}{\mddefault}{\updefault}{1}%
> }}}}
> \put(5787,-4350){\makebox(0,0)[lb]{\smash{{\SetFigFont{12}{14.4}
> {\rmdefault}{\mddefault}{\updefault}{8}%
> }}}}
> \put(6952,-4350){\makebox(0,0)[lb]{\smash{{\SetFigFont{12}{14.4}
> {\rmdefault}{\mddefault}{\updefault}{22.5}%
> }}}}
> \put(6952, -2000){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Os}%
> }}}}}
> \put(6895, -2500){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Pt}%
> }}}}}
> \put(6779, -2000){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Au}%
> }}}}}
> \put(6744, -2500){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {U}%
> }}}}}
> \put(6176, -2000){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Pb}%
> }}}}}
> \put(5888, -2000){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Cu}%
> }}}}}
> \put(5759, -2500){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Fe}%
> }}}}}
> \put(5759, -2500){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Fe}%
> }}}}}
> \put(5684, -3000){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Sn}%
> }}}}}
> \put(5620, -3500){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Zn}%
> }}}}}
> \put(5149, -2000){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Ti}%
> }}}}}
> \put(5013, -2500){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Alumina}%
> }}}}}
> \put(4856, -2000){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Diamond}%
> }}}}}
> \put(4564, -2000){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Al}%
> }}}}}
> \put(4383, -2000){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Gypsum}%
> }}}}}
> \put(4317, -3000){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {PTFE}%
> }}}}}
> \put(4131, -3000){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Brick}%
> }}}}}
> \put(4042, -3500){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Mg}%
> }}}}}
> \put(3766, -2000){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Lignum Vitae}%
> }}}}}
> \put(3650, -2500){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Ebony}%
> }}}}}
> \put(3351, -3500){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Ice}%
> }}}}}
> \put(3261, -2000){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Oak}%
> }}}}}
> \put(3027, -2000){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Maple}%
> }}}}}
> \put(2730, -3500){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Li}%
> }}}}}
> \put(2494, -2000){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Pine}%
> }}}}}
> \put(1883, -2000){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Cork}%
> }}}}}
> \put(1057, -2000){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Balsa}%
> }}}}}
> %
> \put(2649, -2000){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Propane}%
> }}}}}
> \put(3043, -2750){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Gasoline}%
> }}}}}
> \put(3043, -3500){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Br}%
> }}}}}
> \put(6385, -2500){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Hg}%
> }}}}}
> \put(3974, -2500){\rotatebox{270.0}{\makebox(0,0)[lb]
> {\smash{{\SetFigFont{12}{14.4}{\rmdefault}{\mddefault}{\updefault}
> {Blood}%
> }}}}}
> \end{picture}%
> 
> \end{document}
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
> 
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org




More information about the texhax mailing list