[Therion] MetaPost/Tex: variable \magdecl
Bruce
bruce at tomo.co.nz
Sun Jun 5 00:41:34 CEST 2016
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 at speleo.sk [mailto:therion-bounces at speleo.sk] On Behalf
Of Dirk Peinelt
Sent: Saturday, 4 June 2016 11:05 p.m.
To: therion at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20160605/8211a9c1/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.jpg
Type: image/jpeg
Size: 7915 bytes
Desc: image003.jpg
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20160605/8211a9c1/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.jpg
Type: image/jpeg
Size: 4484 bytes
Desc: image004.jpg
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20160605/8211a9c1/attachment-0001.jpg>
More information about the Therion
mailing list