User:StasFomin

From Wikisophia
Jump to: navigation, search
Country
Russia
City
Moscow
E-mail
stas-fomin@yandex.ru
Homepage
http://stas-fomin.narod.ru
LJ
http://www.livejournal.com/users/belonesox/

Sandbox

WikiTeX failure:
5, Fault 1: "type 'exceptions.UnicodeEncodeError':'ascii' codec can't encode characters in position 163-170: ordinal not in range(128)"

Latex support

http://www.unruh.de/DniQ/latex/unicode/ http://www.unruh.de/DniQ/latex/unicode/unicode.tgz

$ mktexlsr
mktexlsr: Updating /usr/share/texmf/ls-R...
mktexlsr: Updating /var/cache/fonts/ls-R...
mktexlsr: Done.

Metapost support

--StasFomin 09:39, 14 Mar 2005 (CST): I propose to include MetaPost support to WikiTex extension. It's very simple and must be very useful.

  • Add file wikitex.metapost.inc.mp
%value%
  • Add function metapost to wikitex.sh
function metapost() {
   wt_exec "mpost ${HASH}"
   find . -name "${HASH}.log" -exec rm {} \;
   find . -name "${HASH}.mp*" -exec rm {} \;
   for i in ${HASH}\.*; do wt_exec "mv ${i} ${i}.eps"; done
   for i in ${HASH}*eps; do wt_exec "mogrify -format png -trim ${i}"; done
   for i in ${HASH}*png; do wt_img  "${OUT}${i}"; done
   wt_anch
}
  • Modify wikitex.inc.php:
'svg'		=> 'strSVG',
'metapost'    => 'strMetaPost',
'teng'	=> 'strTeng',


  • Add function strMetaPost to wikitex.php
function strMetaPost($str)
{
  global $objRend;
  return $objRend->strRend($str, array('class' => 'metapost'));
}

After this metapost (and additional packages if installed on a mediawiki server) works fine:

<metapost>
 input mp-text;
 input piechartmp.mp;
 SetupPercent(this, "%") ;
 DefinePattern(1, 1, blue, red, (8mm, 2pt)) ;
 Segment( 32.5, "first" , 1 ) ;
 Segment( 12.8, "second" , auto ) ;
 Segment( 22.4, "third" , (0,0.7,0.7) ) ;
 Segment( 18.2, "fourth" , auto ) ;
 SegmentState(2, hidden, this) ;
 beginfig(1);
 PieChart(3cm, 0.1, 65, 0, 0);
 Label(0)(percent)(inwards,0) withcolor white;
 Label.auto(0)(name)(outwards,0) ;
 endfig;
 beginfig(2);
 PieChart(5cm, 0.1, 65, 0, 0);
 Label(0)(percent)(inwards,0) withcolor white;
 Label.auto(0)(name)(outwards,0) ;
 endfig;
 end .
</metapost>

+May be export MPINPUTS in wikitex.sh