Hi, Everyone,

Before lyx1.2.1 fix the problem of getting proper links out of lyx
generated latex file by latex2html, I am using a perl script to
translate lyx URLs to corresponding ERTs as a temporary solution. 

1.  put the following to your preamble:
\usepackage{html}
 \usepackage{url}
 \latex{\renewcommand{\htmladdnormallink}[2]{#1 (\url{#2})}}

as suggest by lyx.org tricks->URLs.

2. Use usual insert URL. (The lyx file will be like \begin_inset
LatexComm�nd \url ....)

3. Save the lyx file and run the following command

perl -pe 's/\\begin_inset LatexCommand \\url\[(.*)\]\{(.*)\}/\\begin_inset ERT\nstatus 
Collapsed\n\n\\layout Standard\n\n\n\\backslash\nhtmladdnormallink\{$1\}\{$2\}\n/gs' 
old.lyx > new.lyx

This basically translate "\begin_inset LatexCommand ..." to "\begin_inset
ERT \htmladdnormallink ..." You can open new.lyx to see what is
happening.

4. compile and latex2html new.lyx.


This procedure can be automated by make:


$(TEXFILE): $(LYXFILE)
        rm -f /tmp/a.lyx
        perl -pe 's/\\begin_inset LatexCommand \\url\[(.*)\]\{(.*)\}/\\begin_inset 
ERT\nstatus Collapsed\n\n\\layout 
Standard\n\n\n\\backslash\nhtmladdnormallink\{$$1\}\{$$2\}\n/gs' ${LYXFILE} > 
/tmp/a.lyx
        lyx --export latex /tmp/a.lyx  
        mv /tmp/a.tex $(TEXFILE)

Note that $$1 will be translated into $1 by make.

Bo  Peng
Department of Statistics
Rice University


On Tue, Jul 09, 2002 at 02:30:11PM +0200, Jean-Marc Lasgouttes wrote:
> >>>>> "Wayan" == Wayan  <[EMAIL PROTECTED]> writes:

> Wayan> On 9 Jul 2002, Jean-Marc Lasgouttes wrote:

> >> Yes, Herbert has a patch (if this is what I think it is). My plan
> >> was to add that to 1.2.2, but if I find some time next week, I'll
> >> put it directly in 1.2.1 (which already has too many things in :)

> Wayan> When would the 1.2.1 be released?

> I do not know. I have several things that have to go in first, and my
> time is limited. I hope to be able to make advances next week. You can
> see what has been added to 1.2.1 here:
> http://www.lyx.org/cgi-bin/viewcvs.cgi/lyx-devel/Attic/status.12x?rev=1.1.2.18

> Feel welcome to grab the cvs and try it out...

> JMarc

Reply via email to