Index: Singular/LIB/tropical.lib
===================================================================
--- Singular/LIB/tropical.lib	(revision 0a78c3b07600e6691a158387d392658721cf6619)
+++ Singular/LIB/tropical.lib	(revision b14053699cd89db8efa9555fbd217a30294502cc)
@@ -1,3 +1,3 @@
-version="$Id: tropical.lib,v 1.17 2009-05-13 14:51:55 keilen Exp $";
+version="$Id: tropical.lib,v 1.18 2009-07-09 12:20:30 keilen Exp $";
 category="Tropical Geometry";
 info="
@@ -2660,9 +2660,31 @@
     maxdiffy=1;
   }
+  int nachkomma=2; // number of decimals for the scalefactor
+  number sf=1; // correction factor for scalefactor
   if (size(#)!=2)
   {
     poly scalefactor=minOfPolys(list(12/leadcoef(maxdiffx),16/leadcoef(maxdiffy)));
+    // if the scalefactor is less than 1/100, then we need more than 2 decimals
+    if (leadcoef(scalefactor) < 1/100)
+    {
+      number scf=leadcoef(scalefactor);
+      while (scf < 1/100)
+      {
+        scf=scf * 10;
+        nachkomma++;
+      }
+    }    
+    // if the scalefactor is < 1/100, then we should rather scale the 
+    // coordinates directly, since otherwise texdraw gets into trouble
+    if (nachkomma > 2)
+    {
+      for (i=3;i<=nachkomma;i++)
+      {
+        scalefactor=scalefactor * 10;
+        sf=sf*10;
+      }
+    }    
     texdrawtp=texdrawtp+"
-       \\relunitscale "+ decimal(scalefactor);
+       \\relunitscale "+ decimal(scalefactor,nachkomma);
   }
   else
@@ -2678,5 +2700,5 @@
     {
       texdrawtp=texdrawtp+"
-       \\move ("+decimal(graph[i][1]-centerx)+" "+decimal(graph[i][2]-centery)+") \\fcir f:0 r:"+decimal(2/(leadcoef(scalefactor)*10),size(string(int(scalefactor)))+1);
+       \\move ("+decimal((graph[i][1]-centerx)/sf)+" "+decimal((graph[i][2]-centery)/sf)+") \\fcir f:0 r:"+decimal(2/(leadcoef(scalefactor)*10),size(string(int(scalefactor)))+1);
     }
     // draw the bounded edges emerging from the ith vertex
@@ -2688,10 +2710,10 @@
       {                       
         texdrawtp=texdrawtp+"
-       \\move ("+decimal(graph[i][1]-centerx)+" "+decimal(graph[i][2]-centery)+") \\lvec ("+decimal(graph[graph[i][3][1,j]][1]-centerx)+" "+decimal(graph[graph[i][3][1,j]][2]-centery)+")";
+       \\move ("+decimal((graph[i][1]-centerx)/sf)+" "+decimal((graph[i][2]-centery)/sf)+") \\lvec ("+decimal((graph[graph[i][3][1,j]][1]-centerx)/sf)+" "+decimal((graph[graph[i][3][1,j]][2]-centery)/sf)+")";
         // if the multiplicity is more than one, denote it in the picture
         if (graph[i][3][2,j]>1) 
         {
           texdrawtp=texdrawtp+"
-       \\htext ("+decimal((graph[i][1]-centerx+graph[graph[i][3][1,j]][1])/2)+" "+decimal((graph[i][2]-centery+graph[graph[i][3][1,j]][2])/2)+"){$"+string(graph[i][3][2,j])+"$}";
+       \\htext ("+decimal((graph[i][1]-centerx+graph[graph[i][3][1,j]][1])/(2*sf))+" "+decimal((graph[i][2]-centery+graph[graph[i][3][1,j]][2])/(2*sf))+"){$"+string(graph[i][3][2,j])+"$}";
         }
       }
@@ -2701,12 +2723,12 @@
     for (j=1;j<=size(graph[i][4]);j++) 
     {      
-      relxy=shorten(list(decimal(3*graph[i][4][j][1][1]/scalefactor),decimal(3*graph[i][4][j][1][2]/scalefactor),"2.5"));
+      relxy=shorten(list(decimal((3*graph[i][4][j][1][1]/scalefactor)*sf),decimal((3*graph[i][4][j][1][2]/scalefactor)*sf),string(5*sf/2)));
       texdrawtp=texdrawtp+"
-       \\move ("+decimal(graph[i][1]-centerx)+" "+decimal(graph[i][2]-centery)+") \\rlvec ("+relxy[1]+" "+relxy[2]+")";
+       \\move ("+decimal((graph[i][1]-centerx)/sf)+" "+decimal((graph[i][2]-centery)/sf)+") \\rlvec ("+relxy[1]+" "+relxy[2]+")";
       // if the multiplicity is more than one, denote it in the picture
       if (graph[i][4][j][2]>1) 
       {
         texdrawtp=texdrawtp+"
-       \\htext ("+decimal(graph[i][1]-centerx+graph[i][4][j][1][1]/scalefactor)+" "+decimal(graph[i][2]-centery+graph[i][4][j][1][2]/scalefactor)+"){$"+string(graph[i][4][j][2])+"$}";
+       \\htext ("+decimal(graph[i][1]/sf-centerx/sf+graph[i][4][j][1][1]/scalefactor)+" "+decimal(graph[i][2]/sf-centery/sf+graph[i][4][j][1][2]/scalefactor)+"){$"+string(graph[i][4][j][2])+"$}";
       }
     }
