Re: release candidate for latex2rtf

Juergen Spitzmueller <[email protected]> Mon, 12 Nov 2007 18:41:27 +0100
Newsgroups gmane.comp.tex.latex.latex2rtf.devel
Message-ID <[email protected]>
--nextPart2557608.EVjlMcbVth
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

J=C3=BCrgen Spitzm=C3=BCller wrote:

> I think the job of url.sty is simply to provide proper logical markup
> for URLs (and do proper line break). People who want hyperlinks should =
use
> hyperref, as with (PDF)LaTeX.

The attached patch implements this idea:

\url{www.foo.org} is not clickable when using url.sty only, but it become=
s a
clickable link when hyperref is loaded. This is what PDFLaTeX does.

While implementing this, I detected a bug. If two consecutive paragraphs
contain URLs only, no paragraph break is inserted.

Test case:

\documentclass{article}
\usepackage{url}

\begin{document}

\url{http://www.foo.org}

\url{http://www.bar.org}=20

\end{document}

Regards,
J=C3=BCrgen


--nextPart2557608.EVjlMcbVth
Content-Type: text/x-diff; name="url.diff"
Content-Disposition: attachment; filename="url.diff"
Content-Transfer-Encoding: quoted-printable

Index: preamble.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- preamble.c	(Revision 814)
+++ preamble.c	(Arbeitskopie)
@@ -475,12 +475,12 @@
                    strcmp(option, "verbatim"    ) =3D=3D 0 ||
                    strcmp(option, "paralist"    ) =3D=3D 0 ) {
             diagnostics(WARNING, "Incomplete support for package/option =
'%s' ", option);
-
+        } else if (strcmp(option, "hyperref") =3D=3D 0) {
+		set_hyperref();
         } else if (strcmp(option, "textcomp"    ) =3D=3D 0 ||=20
                    strcmp(option, "fontenc"     ) =3D=3D 0 ||
                    strcmp(option, "eurosym"     ) =3D=3D 0 ||
                    strcmp(option, "ucs"         ) =3D=3D 0 ||
-                   strcmp(option, "hyperref"    ) =3D=3D 0 ||
                    strcmp(option, "alltt"       ) =3D=3D 0 ||
                    strcmp(option, "url"         ) =3D=3D 0 ||
                    strcmp(option, "nameref"     ) =3D=3D 0 ||
Index: xrefs.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- xrefs.c	(Revision 814)
+++ xrefs.c	(Arbeitskopie)
@@ -76,6 +76,7 @@
 static int g_current_cite_item =3D 0;
 static int g_sorted_citations =3D FALSE;
 static int g_compressed_citations =3D FALSE;
+static int g_hyperref =3D FALSE;
=20
 static char *g_bibpunct_open =3D NULL;
 static char *g_bibpunct_close =3D NULL;
@@ -137,6 +138,11 @@
 	g_compressed_citations =3D TRUE;
 }
=20
+void set_hyperref(void)
+{
+	g_hyperref =3D TRUE;
+}
+
 /***********************************************************************=
**
  * return 1 if citation used otherwise return 0 and add citation to list
  ***********************************************************************=
*/
@@ -1880,15 +1886,20 @@
=20
 		case LABEL_URL:
 			/* cannot use insertHyperlink because url has toxic characters */
-	        url =3D getBraceRawParam();
+			url =3D getBraceRawParam();
 			text =3D strdup_together(baseurl,url);
 			fprintRTF("{");
 			putHtmlRTF(urlstyle);
-			fprintRTF("\\field{\\*\\fldinst{ HYPERLINK \"");
-			putRtfStrEscaped(text);
-			fprintRTF("\" }{{}}}{\\fldrslt{");
-			putRtfStrEscaped(text);
-			fprintRTF("}}}");
+			if (g_hyperref) {
+				fprintRTF("\\field{\\*\\fldinst{ HYPERLINK \"");
+				putRtfStrEscaped(text);
+				fprintRTF("\" }{{}}}{\\fldrslt{");
+				putRtfStrEscaped(text);
+				fprintRTF("}}}");
+			} else {
+				putRtfStrEscaped(text);
+				fprintRTF("}");
+			}
 			break;
=20
 		case LABEL_NO_LINK_URL:


--nextPart2557608.EVjlMcbVth
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
--nextPart2557608.EVjlMcbVth
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Latex2rtf-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/latex2rtf-developers

--nextPart2557608.EVjlMcbVth--