3 # wrapper to run tex2lyx of lyx-devel (lyx-1.4.0)
4 # and retrieve a lyx version for lyx-current (1.3.5)
5 # J.P. Chretien <chretien@cert.fr>
7 # initial version march 2005
8 # correction 19 may 2005: deals correctly w dependencies
9 # correction 30 may 2005: correct a flaw in dependency management
10 # due to the fact that included file suffix
11 # remains .tex if <basename>.lyx exists
13 # this script comes with no warranty, use at your own risk.
14 # WARNING: lyx2lyx backconversion needs printing of depending files
15 # DO NOT USE until the messages are commited to cvs version
16 # (tex2lyx should print the names of all created
17 # or updated lyx files)
20 LYXDEVEL="/usr/local/LyX/"
24 test $# -ge 1 && SCRIPT=`basename "$1"`
26 echo "Usage: $SCRIPT <LaTeX file basename>," >&2
27 echo "e.g. $SCRIPT foo to convert foo.tex" >&2
33 test $# -eq 1 || usage "$0"
36 # file exists and is redable
37 test -r $1.tex || usage "$0" "$1.tex non readable"
39 # check fo existing lyx file
40 test -r $1.lyx && usage "$0" "$1.lyx exists, remove or rename"
41 # temporary compulsory -f option to cope with multipart documents
44 echo "tex2lyx.sh will clobber all depending .lyx files"
45 echo "(called by include, input, or verbatiminput). Continue ? y/N"
47 (test -n $ok && test $ok = 'y') || {
53 echo "Converting $1.tex and dependant files to lyx format 241..."
54 $LYXDEVEL/bin/tex2lyx -f $1.tex 1> $1.lyx 2>$1.log || {
59 # find out depending files
61 grep 'Creating file' $1.log >$2.log
62 grep 'Overwriting existing file' $1.log >>$2.log
63 sed -e 's/^.* file //' $2.log > $1.log
66 echo "Converting back to lyx format 221..."
68 python $LYXDEVEL/share/lyx/lyx2lyx/lyx2lyx -t 221 -o $1.lyx $1.lyx-1.4\
69 && echo "$1.lyx available."
75 python $LYXDEVEL/share/lyx/lyx2lyx/lyx2lyx -t 221 -o $F $F-1.4 \
76 && echo "$F available."
79 echo "Conversion completed."