Dirk

I don’t know much about this, but have managed to tweak the standard header as below;

 

A bit long winded, and I have only copied the conventions in the standard Therion code, but you may get some clues…

 

 

 

layout LayoutExperimentalHeader

#This code is experimental redefinition of map header

#Bruce Mutton           Therion 5.3.15 make use of new variables

 

#this one affects maps only

code tex-map

% start bruces addition

\newtoks\thversiontitleA \thversiontitleA={Compiled}

\newtoks\thversiontitleB \thversiontitleB={Therion }

\newtoks\datetitle \datetitle={on }

\newtoks\depthrangetitle \depthrangetitle={Depth range from }

% end bruces addition

 

\legendcontent={%

  \hsize=\legendwidth

  \color[0 0 0]\the\legendtextcolor

  \ifnortharrow\vbox to 0pt{\line{\hfil\northarrow}\vss}\fi

%print cave map name

  \edef\tmp{\the\cavename} \ifx\tmp\empty \else

     {\the\legendtextheadersize\the\cavename}\vskip1cm

  \fi

%print scalebar 

  \ifscalebar\scalebar\vskip1cm\fi

 

% start bruces addition

  # %    CS

    \edef\tmp{\the\outcsname} \ifx\tmp\empty \else

      {\the\legendtextsize\ss\the\outcsname\par}

    \fi

    \edef\tmp{\the\northdir} \ifx\tmp\empty \else

      {\the\legendtextsize\ss\the\northdir north }

    \fi     

    \edef\tmp{\the\magdecl} \ifx\tmp\empty \else

      {\the\legendtextsize\ss\the\magdecl deg \par}

    \fi       

% end bruces addition   

%print comment

  {\rightskip=0pt plus 3em\parskip=3bp

    \edef\tmp{\the\comment} \ifx\tmp\empty \else

      {\the\legendtextsize\the\comment} \par\medskip

    \fi

%print cavelength and depth

    \everypar{\hangindent=2em\hangafter=1}

    \edef\tmp{\the\cavelength} \ifx\tmp\empty \else

      {\the\legendtextsize\si\the\cavelengthtitle: \ss\the\cavelength\par}

    \fi

    \edef\tmp{\the\cavedepth} \ifx\tmp\empty \else

      {\the\legendtextsize\si\the\cavedepthtitle: \ss\the\cavedepth\par}

    \fi

# % start bruces addition           

# %      altitude

    \edef\tmp{\the\cavemaxz} \ifx\tmp\empty \else

      {\the\legendtextsize\si\the\depthrangetitle \ss\the\cavemaxz m to}

    \fi

    \edef\tmp{\the\caveminz} \ifx\tmp\empty \else

      {\the\legendtextsize\ss\the\caveminz m \par} %above mean sea level

    \fi

# % end bruces addition

 

%print explorers names

    \edef\tmp{\the\exploteam} \ifx\tmp\empty \else

      {\the\legendtextsize\si\the\explotitle: \ss\the\exploteam\quad\si\the\explodate\par}

    \fi

%print surveyors names

    \edef\tmp{\the\topoteam} \ifx\tmp\empty \else

      {\the\legendtextsize\si\the\topotitle: \ss\the\topoteam\quad\si\the\topodate\par}

    \fi

%print cartographers names

    \edef\tmp{\the\cartoteam} \ifx\tmp\empty \else

      {\the\legendtextsize\si\the\cartotitle: \ss\the\cartoteam\quad\si\the\cartodate\par}

    \fi

# % start bruces addition (compilation version and date modified to use built-in 5.3.15 variables)

    \edef\tmp{\the\thversion} \ifx\tmp\empty \else  %only write version and date if version is not emplty

      {\the\legendtextsize\si\the\thversiontitleA: \ss\the\thversiontitleB \ss\the\thversion}

    % \fi

    % \edef\tmp{\the\currentdate} \ifx\tmp\empty \else

      {\the\legendtextsize\si\the\datetitle \ss\the\currentdate\par}

    \fi     

           

# % end bruces addition

%print copyrights

    \edef\tmp{\the\copyrights} \ifx\tmp\empty \else

      {\the\legendtextsize\ss\the\copyrights\par}

    \fi     

  }

  \formattedlegend

  \color[0 0 0]

}

 

endcode

endlayout LayoutExperimentalHeader

 

 

Bruce

 


From: therion-bounces@speleo.sk [mailto:therion-bounces@speleo.sk] On Behalf Of Dirk Peinelt
Sent: Saturday, 4 June 2016 11:05 p.m.
To: therion@speleo.sk
Subject: [Therion] MetaPost/Tex: variable \magdecl

 

Is there a way to handle the content of the \magdecl TEX-variable in METAPOST? (Therion V5.3.16)

In a string or numeric? – I think, i‘ve an syntax problem…

 

1.) string handling:

string dec;

%dec:=“3.022“; % FINE!

dec:=\magdecl; % ERROR

p_label.top(thTEX(dec),(0,0),0,8); % >> string output

 

2.) numeric handling:

numeric dec;

%dec:=3.022; % FINE!

dec:=\magdecl; % ERROR

p_label.top(thTEX(decimal dec),(0,0),0,8); % >> numeric to string output