Michael Koziarski wrote:

> Insert URL -> Export to HTML yields "<p><Description> <URL>" But 
> Herbert's help pages describe a way to get the more sensible output
> 
> http://www.lyx.org/help/html/url.php3
> 
> Is there any reason why insert URL doesn't do this? Is it meant to? I 


you don't know how some wants to print out the urls.

> may be missing some LaTeX packages?  Is that weird HTML Type checkbox 
> meant to make this happen?


no, but I have it in my tree that this will work as described
in url.php3

> I'm trying to hack together a patch to make give an <a href=..... output 
> when the "HTML Type" checkbox is ticked, but I don't really know enough 
> (read any) LaTeX so can someone give me a tip or seventeen?
> 
> But looking at the code for getPackages() in LaTeXFeatures.C  it puts 
> the following into the preamble if you require("url"):
> 
> \IfFileExists{url.sty}{\usepackage{url}}
>     {\newcommand{\url}{\texttt}}
> 
> 
> Now is this saying "use url if it's there otherwise make up a url 
> command that produces a reasonable alternative".  


yes

> So I guess what I need 
> to do is something similar, provide a suitable \htmladdnormallink if the 
> required packages are present, then change InsetUrl::latex to behave 
> differently depending on the HTML Type checkbox.
> 
> Could someone with TeX Knowledge give me some help?
> 
> Also, I take it that I'll need to provide an alternative 
> \htmladdnormallink command in case there's no html.sty.


I did it in this way and it works fine for me


int InsetUrl::latex(Buffer const *, ostream & os,
                     bool fragile, bool /*free_spc*/) const
{
     if (fragile)
         os << "\\protect";
     if (getCmdName() == "htmlurl")                      // HTML URL
         if (packageAvailable("html")) {
             os << "\\htmladdnormallink{" << getOptions() << "}{"
                 << getContents() << "}";
             return 0;                                   // everything ok
         }
     if (!getOptions().empty())
         os << getOptions() + ' ';
     os << "\\url{" << getContents() << '}';
     return 0;
}


it's part of inseturl.C. There are some other minor changes in
FormUrl and others.

Herbert




-- 
http://www.lyx.org/help/

Reply via email to