Talk:Todo

From Wikisophia
Jump to: navigation, search

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>

This might complement a raw <latex> tag; can you come up with some useful scenarios? Danenberg 01:55, 24 February 2006 (CST)

PSTricks support

  • What about pstricks support or at least a general <tex>-tag? --Xylo 10:31, 28 January 2009 (CST)