Bo Peng wrote:
> There are some problems when using python/manual.cls in lyx. The
> biggest one is that Python/manual.cls defines \url. When I uses
> insert->url, the latex file generated by lyx has
>
> \IfFileExists{url.sty}{\usepackage{url}}
> {\newcommand{\url}{\texttt}}
>
> which conflicts with manual.cls.
There are two things to do about this:
1) it is possible to define your own command for translation between LaTeX
and dvi/pdf (Edit/Preferences/Converters) which will be your own shell
script removing from .tex file offending lines (it is called vlnlatex and
there is a link to it called pdfvlnlatex -- if you want to call it
otherwise you have to fix line 5):
#!/bin/sh
LATEX='latex'
ZAKLAD=$(basename $1 .tex)
if [[ $(basename $0) == "pdfvlnlatex" ]]
then
PROG="pdf$LATEX"
else
PROG=$LATEX
fi
if ( grep -q '^\\documentclass.*{manual}' $ZAKLAD.tex )
then
# assuming GNU sed
sed -e '/\\IfFileExists{url.sty}/,+1d' \
< $ZAKLAD.tex > $ZAKLAD.ptex
else
cp $ZAKLAD.tex $ZAKLAD.ptex
fi
$PROG $ZAKLAD.ptex
Of course, the alternative option would be to ask developers (i.e., to file
a wish) to allow us to edit WHOLE preamble (at least in layout files),
because the current situation when LyX puts into .tex file some commands
and _user has no way how to influence it_ is insane.
Matej
--
Matej Cepl, http://www.ceplovi.cz/matej
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488
He has all the virtues I dislike and none of the vices I admire.
-- Winston Churchill