Opened 22 years ago

Closed 11 months ago

#449 closed defect (fixed)

characters %, #, ^, and \ not handled when in URL in section heading

Reported by: bilodeau@… Owned by: lasgouttes
Priority: normal Milestone: 2.4.0
Component: general Version: 1.3.7
Severity: normal Keywords: layoutformat
Cc: lasgouttes, Juergen Spitzmueller, Uwe Stöhr, martin.vermeer@…, giorusconi@…, Richard Heck

Description (last modified by Uwe Stöhr)

When I user a # in an URL address (in a URL box) in a footnote.

When I try to export, view or print, in DVI or PDF he do the job, but he
stop at exporting or printing at the page who contain the # in URL in
footnote

Attachments (1)

url.lyx (998 bytes ) - added by Richard Heck 16 years ago.
Example file

Download all attachments as: .zip

Change History (45)

comment:1 by levon, 22 years ago

Version: 1.1.6fix21.2.0

Jonathan, your workaround is to add somewhere in LaTeX mode :

\urldef{\myurl}\url{http://path.to.my/#url}

then in the footnote, add in LaTeX mode

\myurl

JMarc, is there a nice solution LyX can use to avoid these problems ??

comment:2 by lasgouttes, 22 years ago

I don't know. I really hate our current url code... I think herbert (or dekel?)
said that hyperref has a better \url macro than url.sty, but herbert
also said that using hyperref is bound to create a lot of new interesting
problems.

The easiest solution would be to remove the URL inset, but I suspect that many
people will not like that :)

comment:3 by voss, 22 years ago

Cc: voss@… added

using hyperref is one solution, but a bad one if you
do not like the linked footnote symbols, because
they are underlined. The easiest and best solution
for me seems to be to write

\texttt{http://www.lyx.og/\#myUrl.html}
if we are in a footnote. all command characters must
be escaped \# \_ ... , with hyperref, too.

comment:4 by levon, 20 years ago

Cc: giorusconi@… added

comment:5 by levon, 20 years ago

* #1481 has been marked as a duplicate of this bug. *

comment:6 by Uwe Stöhr, 20 years ago

Cc: uwestoehr@… added

Isn't it possible to write all command chararcters with a beginning \ in the
LaTeX code, like mathed do.
If not, I will add a hint in the documentation.

comment:7 by Uwe Stöhr, 20 years ago

As LyX uses the package url.sty for the URL-insets, here a part of the
documentation in the actual (ver 3.0) url.sty:

Usage: Conditions:
% \url{ } If the argument contains any "%", "#", or "", or ends with
% "\", it can't be used in the argument to another command.
% The argument must not contain unbalanced braces.

comment:8 by voss, 20 years ago

Cc: voss@… removed

comment:9 by Uwe Stöhr, 20 years ago

I added a hint in a footnote in chapter 6.2 of the Userguide (and de_Userguide).

comment:10 by Juergen Spitzmueller, 20 years ago

Cc: j.spitzmueller@… added

Another possibility (with url.sty):

\let\oldfootnote\footnote
\renewcommand\footnote{%
\catcode`\#=12
\oldfootnote}

but I don't know which side effects this has. Furthermore, the problem also
appears in other environments (captions)

comment:11 by Uwe Stöhr, 18 years ago

Component: translationsexport
op_sys: LinuxAll
Version: 1.2.11.3.7

comment:12 by Uwe Stöhr, 18 years ago

Summary: # problem in URL in footnotespecial characters %, #, ^, \ not handled when used in URL inset

comment:13 by Uwe Stöhr, 18 years ago

dependson: 2268

This could be solved by replacing the \url stuff by \href, see #2268.

comment:14 by Georg Baum, 18 years ago

Keywords: fileformat added

The problem is twofold:

a) url.sty does not support all characters
b) The url is written as is to the .tex file

b) could be solved by proper escaping of characters in inset parameters like in
url or index insets. If we apply the same escaping that we use for normal text
then everything is fine. All insets that store parameters in InsetCommandParams
should be checked for this problem.

comment:15 by Richard Heck, 17 years ago

blocked: 3482

comment:16 by Uwe Stöhr, 17 years ago

Keywords: fixedintrunk added; fileformat removed
Milestone: 1.6.0

fixedintrunk: http://www.lyx.org/trac/changeset/20963

Cannot be fixed in LyX 1.5.x.

comment:17 by Uwe Stöhr, 17 years ago

Cc: rgheck@… added
Keywords: fixedintrunk removed

not fixedintrunk: This is only fixed for the hyperlink-inset, the URL style
still allows theses characters.

Richard, could you have a look?

comment:18 by Richard Heck, 17 years ago

Subject: Re: special characters %, #, , \ not handled when used

in URL inset

bugzilla-daemon@… wrote:

not fixedintrunk: This is only fixed for the hyperlink-inset, the URL style
still allows theses characters.

Richard, could you have a look?

Martin, is there an obvious extension of what you just did with ERT to
deal with this? Or has it been handled behind the scenes somehow?
Shouldn't these be escaped by the usual mechanism?

rh

comment:19 by Uwe Stöhr, 17 years ago

Cc: martin.vermeer@… added

Martin, could you have a look? (comment 13)

by Richard Heck, 16 years ago

Attachment: url.lyx added

Example file

comment:20 by Martin, 16 years ago

Richard, I suppose the problems in Section have to do with protecting.

comment:21 by Richard Heck, 16 years ago

Summary: special characters %, #, ^, \ not handled when used in URL insetspecial characters not handled in URL inset in section, etc

That's probably right. But I don't see what to do here. Escaping things doesn't
help. You don't get errors, but you get "\#", e.g., in the output, i.e., the
backslashes show up. So I'm thinking this is just a limitation of the \url
command itself.

Changing the description.

Last edited 6 years ago by Richard Heck (previous) (diff)

comment:22 by Uwe Stöhr, 16 years ago

Summary: special characters not handled in URL inset in section, etccharacters %, #, ^, and \ not handled when in URL in section heading

This is a limitation of the \url command.

The problem is that LyX creates such code:
\section{bla\protect\url{%}}
but \url is not to be designed to be used in section headings.

So the fix is to disable the URL menu when the cursor is in a section heading
and I'll document that in the docs.

The solution to create this code instead:
\section{bla}\url{%}
is not an option because this is not what the user expects. Th result of this
would be as if he had inserted the \url to the normal text paragraph and not the
section heading.

comment:23 by Richard Heck, 16 years ago

Keywords: fixedintrunk added

the bug here has changed, really. i'm marking this one fixedintrunk, and i've
opened the new bug #5128.

comment:24 by Juergen Spitzmueller, 16 years ago

Keywords: fixedintrunk removed
Resolution: fixed
Status: newclosed

LyX 1.6.0 is released.

comment:25 by Juergen Spitzmueller, 15 years ago

Milestone: 1.6.0
Resolution: fixed
Status: closedreopened

reopen bug, this is not resolved yet.
Disallowing URLs in the concerned environment in general is no option.

comment:26 by ps, 15 years ago

Priority: highnormal

comment:27 by Teraslilja, 14 years ago

Component: exportgeneral
Version: 1.3.71.6.4

Confirm that not resolved in 1.6.4

Footnote URL with http://en.wikipedia.org/wiki/Queue_%28data_structure%29 fails.
Footnote URL with http://en.wikipedia.org/wiki/Queue_(data_structure) works.

LaTeX Log:
Runaway argument?
{FIFO queue - \url {http://en.wikipedia.org/wiki/Queue_} isn't needed\ETC.
! File ended while scanning use of \@footnotetext.
<inserted text>

comment:28 by Uwe Stöhr, 14 years ago

Cc: Juergen Spitzmueller Uwe Stöhr Richard Heck added; j.spitzmueller@… uwestoehr@… rgheck@… removed
Description: modified (diff)
Version: 1.6.41.3.7

comment:29 by Uwe Stöhr, 11 years ago

Cc: lasgouttes added

Can we perhaps benefit from the PassTru improvements for this bug?

comment:30 by lasgouttes, 11 years ago

The very recent PassThru improvements only concern tex2lyx. Do you have something else in mind?

comment:31 by Uwe Stöhr, 8 years ago

bug #9935 had been marked as duplicate

comment:32 by Scott Kostyshak, 8 years ago

#10301 possibly a duplicate.

comment:33 by Uwe Stöhr, 8 years ago

#10301 possibly a duplicate.

Yes.

comment:34 by Juergen Spitzmueller, 6 years ago

#7116 marked as duplicate.

As indicated there, one solution is provided by the cprotect package.

Last edited 6 years ago by Juergen Spitzmueller (previous) (diff)

comment:35 by Juergen Spitzmueller, 6 years ago

Milestone: 2.4.0
Status: reopenedfixedinmaster

Fixed in master by using cprotect at [2ba584957cf11c/lyxgit]

I wouldn't backport this before it got thorough testing.

comment:36 by Richard Kimberly Heck, 6 years ago

This is a layout format change, so it's not eligible for backporting. It also needs an update of the layout format and layout2layout code.

in reply to:  36 comment:37 by Juergen Spitzmueller, 6 years ago

Replying to rikiheck:

This is a layout format change, so it's not eligible for backporting.

I thought we allow layout format changes (as opposed to file format changes) within stable series.

It also needs an update of the layout format and layout2layout code.

Done at [e11bda2cea6b4/lyxgit]

comment:38 by Richard Kimberly Heck, 6 years ago

We allow certain kinds of updates of layout files, but not (so far as I know) the format. Especially since we now embed layout into the files themselves, that could cause problems.

comment:39 by Juergen Spitzmueller, 6 years ago

OK, fine.

comment:40 by Richard Kimberly Heck, 6 years ago

Keywords: fileformat added

comment:41 by Juergen Spitzmueller, 6 years ago

Keywords: layoutformat added; fileformat removed

Actually not a file format change.

comment:42 by Richard Kimberly Heck, 6 years ago

Sorry, didn't realize we had a layoutformat keyword...

comment:43 by Juergen Spitzmueller, 4 years ago

#11711 marked as duplicate

comment:44 by ps, 11 months ago

Resolution: fixed
Status: fixedinmasterclosed

2.4 beta is out.

Note: See TracTickets for help on using tickets.