Multilingual Legend / Legend Formatting
Hi, Trying to produce a multilingual legend that shows two (or more) languages. I thought I could simply use text substitution to achieve this in my thconfig file. Source cave.th text en "area sand" "sand<br>darat" text en "area water" "water<br>danum" export map ... This works great except the formatting of the legend is borked. As you can see the text is vertically aligned with the middle of the text against the top of the legend box. [cid:image003.png@01D12DD3.9A7B0D40] th_legend.tex looks like this \line{% \legendsymbolbox{\THLaaab}{\thfb\char119 \char97 \char108 \char108 \mainfont{}}\hskip10pt \legendsymbolbox{\THLaaaj}{\thfb\char99 \char104 \char105 \char109 \char110 \char101 \char121 \mainfont{}}\hskip10pt \legendsymbolbox{\THLaabh}{\vbox{\halign{#\hfil\cr\cr \thfb\char115 \char97 \char110 \char100 \cr\thfb \char100 \char97 \char114 \char97 \char116 \cr}}\mainfont{}}\hskip10pt \legendsymbolbox{\THLaacf}{\thfb\char112 \char111 \char105 \char110 \char116 \ \char115 \char116 \char97 \char108 \char97 \char99 \char116 \char105 \char116 \char101 \char115 \mainfont{}}\hskip10pt \hss} The legend boxes get drawn using metapost and the labels with TEX. Although I can modify the metapost I can't see the template for the TEX. Any ideas where I could modify the alignment? Alternatively is there a way of specifying the legend language mid creation so I could have two legends, one for each language? Regards, Henry Bennett Dell Corporation Limited is authorised and regulated in the UK by the Financial Conduct Authority for consumer credit brokerage. Registered in England and Wales. Company Registration Number: 2081369 Registered address: Dell House, The Boulevard, Cain Road, Bracknell, Berkshire, RG12 1LF, UK. Company details for other Dell UK entities can be found on www.dell.co.uk.
Solved. In case anyone else needs to do this, the trick is to modify the legendsymbolbox in the tex section of your thconfig. \def\legendsymbolbox#1#2{% \setbox\tmpboxa=\hbox{\pdfrefxform#1}% \setbox\tmpboxb=\hbox{\the\legendtextsize(}% \legendsymbolwd=\wd\tmpboxa \legendsymbolht=\ht\tmpboxa \advance\legendsymbolht by -\ht\tmpboxb \advance\legendsymbolht by -\ht\tmpboxb \advance\legendsymbolht by -20pt \advance\legendsymbolht by -1dd \tmpdimen=\hsize \advance\tmpdimen by 10pt \divide\tmpdimen by\legendcolumns \advance\tmpdimen by-10pt \hbox to \tmpdimen{% \box\tmpboxa\kern10pt\raise\legendsymbolht\vtop{% \advance\tmpdimen by -\legendsymbolwd \advance\tmpdimen by -10pt \hsize=\tmpdimen\rightskip=0pt plus \tmpdimen minus 0pt\relax\the\legendtextsize #2\vskip1dd}\hss}% } The code above taken from thTMPDIR\data.tex was modified with the highlights to produce the desired effect [cid:image004.png@01D130D4.A0E5CDB0] Henry Bennett From: therion-bounces@speleo.sk [mailto:therion-bounces@speleo.sk] On Behalf Of Bennett, Henry Sent: 03 December 2015 14:05 To: therion@speleo.sk Subject: [Therion] Multilingual Legend / Legend Formatting Hi, Trying to produce a multilingual legend that shows two (or more) languages. I thought I could simply use text substitution to achieve this in my thconfig file. Source cave.th text en "area sand" "sand<br>darat" text en "area water" "water<br>danum" export map ... This works great except the formatting of the legend is borked. As you can see the text is vertically aligned with the middle of the text against the top of the legend box. [cid:image001.png@01D130D3.797AF8F0] th_legend.tex looks like this \line{% \legendsymbolbox{\THLaaab}{\thfb\char119 \char97 \char108 \char108 \mainfont{}}\hskip10pt \legendsymbolbox{\THLaaaj}{\thfb\char99 \char104 \char105 \char109 \char110 \char101 \char121 \mainfont{}}\hskip10pt \legendsymbolbox{\THLaabh}{\vbox{\halign{#\hfil\cr\cr \thfb\char115 \char97 \char110 \char100 \cr\thfb \char100 \char97 \char114 \char97 \char116 \cr}}\mainfont{}}\hskip10pt \legendsymbolbox{\THLaacf}{\thfb\char112 \char111 \char105 \char110 \char116 \ \char115 \char116 \char97 \char108 \char97 \char99 \char116 \char105 \char116 \char101 \char115 \mainfont{}}\hskip10pt \hss} The legend boxes get drawn using metapost and the labels with TEX. Although I can modify the metapost I can't see the template for the TEX. Any ideas where I could modify the alignment? Alternatively is there a way of specifying the legend language mid creation so I could have two legends, one for each language? Regards, Henry Bennett Dell Corporation Limited is authorised and regulated in the UK by the Financial Conduct Authority for consumer credit brokerage. Registered in England and Wales. Company Registration Number: 2081369 Registered address: Dell House, The Boulevard, Cain Road, Bracknell, Berkshire, RG12 1LF, UK. Company details for other Dell UK entities can be found on www.dell.co.uk<http://www.dell.co.uk/>. Dell Corporation Limited is authorised and regulated in the UK by the Financial Conduct Authority for consumer credit brokerage. Registered in England and Wales. Company Registration Number: 2081369 Registered address: Dell House, The Boulevard, Cain Road, Bracknell, Berkshire, RG12 1LF, UK. Company details for other Dell UK entities can be found on www.dell.co.uk.
Henry, may you add it to wiki? Or if not access, may do it instead? m.s.
7. 12. 2015 v 10:49, Henry_Bennett@Dell.com:
Solved.
In case anyone else needs to do this, the trick is to modify the legendsymbolbox in the tex section of your thconfig.
\def\legendsymbolbox#1#2{% \setbox\tmpboxa=\hbox{\pdfrefxform#1}% \setbox\tmpboxb=\hbox{\the\legendtextsize(}% \legendsymbolwd=\wd\tmpboxa \legendsymbolht=\ht\tmpboxa \advance\legendsymbolht by -\ht\tmpboxb \advance\legendsymbolht by -\ht\tmpboxb \advance\legendsymbolht by -20pt \advance\legendsymbolht by -1dd \tmpdimen=\hsize \advance\tmpdimen by 10pt \divide\tmpdimen by\legendcolumns \advance\tmpdimen by-10pt \hbox to \tmpdimen{% \box\tmpboxa\kern10pt\raise\legendsymbolht\vtop{% \advance\tmpdimen by -\legendsymbolwd \advance\tmpdimen by -10pt \hsize=\tmpdimen\rightskip=0pt plus \tmpdimen minus 0pt\relax\the\legendtextsize #2\vskip1dd}\hss}% }
The code above taken from thTMPDIR\data.tex was modified with the highlights to produce the desired effect
<image004.png>
Henry Bennett
<>From: therion-bounces@speleo.sk <mailto:therion-bounces@speleo.sk> [mailto:therion-bounces@speleo.sk <mailto:therion-bounces@speleo.sk>] On Behalf Of Bennett, Henry Sent: 03 December 2015 14:05 To: therion@speleo.sk <mailto:therion@speleo.sk> Subject: [Therion] Multilingual Legend / Legend Formatting
Hi,
Trying to produce a multilingual legend that shows two (or more) languages.
I thought I could simply use text substitution to achieve this in my thconfig file.
Source cave.th <http://cave.th/> text en "area sand" "sand<br>darat" text en "area water" "water<br>danum" export map …
This works great except the formatting of the legend is borked. As you can see the text is vertically aligned with the middle of the text against the top of the legend box. <image001.png>
th_legend.tex looks like this \line{% \legendsymbolbox{\THLaaab}{\thfb\char119 \char97 \char108 \char108 \mainfont{}}\hskip10pt \legendsymbolbox{\THLaaaj}{\thfb\char99 \char104 \char105 \char109 \char110 \char101 \char121 \mainfont{}}\hskip10pt \legendsymbolbox{\THLaabh}{\vbox{\halign{#\hfil\cr\cr \thfb\char115 \char97 \char110 \char100 \cr\thfb \char100 \char97 \char114 \char97 \char116 \cr}}\mainfont{}}\hskip10pt \legendsymbolbox{\THLaacf}{\thfb\char112 \char111 \char105 \char110 \char116 \ \char115 \char116 \char97 \char108 \char97 \char99 \char116 \char105 \char116 \char101 \char115 \mainfont{}}\hskip10pt \hss}
The legend boxes get drawn using metapost and the labels with TEX. Although I can modify the metapost I can’t see the template for the TEX.
Any ideas where I could modify the alignment?
Alternatively is there a way of specifying the legend language mid creation so I could have two legends, one for each language?
Regards,
Henry Bennett
Dell Corporation Limited is authorised and regulated in the UK by the Financial Conduct Authority for consumer credit brokerage. Registered in England and Wales. Company Registration Number: 2081369 Registered address: Dell House, The Boulevard, Cain Road, Bracknell, Berkshire, RG12 1LF, UK. Company details for other Dell UK entities can be found on www.dell.co.uk <http://www.dell.co.uk/>. Dell Corporation Limited is authorised and regulated in the UK by the Financial Conduct Authority for consumer credit brokerage. Registered in England and Wales. Company Registration Number: 2081369 Registered address: Dell House, The Boulevard, Cain Road, Bracknell, Berkshire, RG12 1LF, UK. Company details for other Dell UK entities can be found on www.dell.co.uk <http://www.dell.co.uk/>. _______________________________________________ Therion mailing list Therion@speleo.sk <mailto:Therion@speleo.sk> http://mailman.speleo.sk/mailman/listinfo/therion <http://mailman.speleo.sk/mailman/listinfo/therion>
participants (2)
-
Henry_Bennett@Dell.com -
Martin Sluka