[tex-k] HyperTeX tags

Akira Kakuto kakuto at fsci.fuk.kindai.ac.jp
Tue Feb 28 13:51:22 CET 2006


> Next problem is dvips itself:
> 
>   \special{html:<a name="abc)def">}%
> 
> The PS file is then invalid:
> 
>   (abc)def) [2 [72 719 183 721] 841] def
> 
> The name should be quoted to get a valid PostScript string:
> 
>   (abc\)def) ...

Very crude patch:
Best,
Akira

--- hps.c.orig	Sun Jan 16 14:54:10 2005
+++ hps.c	Tue Feb 28 21:36:12 2006
@@ -123,7 +123,14 @@
 void do_html P1C(char *, s)
 {
   Hps_link *nl ;
-  url_name = (char *)malloc(strlen(s)+1) ;
+  int ki = 0 ;
+  char *kp ;
+
+  for (kp = s; *kp; kp++) {
+    if (*kp == '(' || *kp == ')')
+       ki++ ;
+  }
+  url_name = (char *)malloc(strlen(s)+ki+1) ;
   hs = s ;
   HREF_COUNT = 0 ; 
   skip_space(hs) ; /* skip spaces */
@@ -227,7 +234,10 @@
   skip_space(hs) ;
   /* hash_name() ; */
   if (*hs == '"') {
-    for(hs++ ; *hs != '"' && *hs != '\0' ; *v++ = *hs++) ;  /* need to esc " */
+    for(hs++ ; *hs != '"' && *hs != '\0' ; hs++) {
+      if (*hs == '(' || *hs == ')') *v++ = '\\' ;
+      *v++ = *hs ;
+    }
     if(*hs == '"') {
       hs++ ;
       *v++ = '\0' ;



More information about the tex-k mailing list