[prev in list] [next in list] [prev in thread] [next in thread]
List: lyx-users
Subject: Re: Google Docs to LaTeX
From: Charles de Miramon <cmiramon () kde-france ! org>
Date: 2008-04-21 10:51:30
Message-ID: fuhrji$g82$1 () ger ! gmane ! org
[Download RAW message or body]
Michael Thompson wrote:
> are too kind to what Charles calls the 'wysiwyg cruft'. If you find a
> solution to the problem with em-dashes that doesn't involve a
> find-and-replace in the .tex file, tell me.
I paste my w2lclean script that I run on files converted by writer2latex
before importing them into LyX. It is geared for French but can easily be
adapted. It uses sed (a command line search&replace that is standard on
Unix). I guess it will work on Mac OS/X.
sh w2lclean Myconvertedfile.tex will create a temp-Myconvertedfile.tex that
you can then import into LyX.
For en-dash problem, you have to create a rule to convert space-space to
space--space
Cheers,
Charles
---w2lclean----
#! /bin/sh
TEMP=temp-$1
cp $1 $TEMP
sed '
s/\\par/ /g;
s/\\bigskip//g;
s/\\fontsize{.*}{.*}\\selectfont//g;
s/\\usepackage\[ascii\]{inputenc}/\\usepackage\[latin1\]{inputenc}/g;
s/\\textsuperscript{\\footnotemark{}}\\footnotetext/\\footnote/g;
s/\\textstyleFootnoteSymbol{\\footnotemark{}}\\footnotetext/\\footnote/g;
s/\\textstyleAppelnotedebasdep{\\footnotemark{}}\\footnotetext/\\footnote/g;
s/\\textit/\\emph/g;
s/~/ /g;
s/{\\textquotedbl}/«/g;
s/{\\textquoteright}/'\''/g;
s/{\\textquotesingle}/'\''/g;
s/'\'''\''/»/g;
s/{\\guillemotleft}/«/g;
s/{\\guillemotright}/»/g;
s/{\\ /{ /g;
s/{}-/-/g;
s/\\"e/ë/g;
s/\\"i/ï/g;
s/\\"u/ü/g;
s/\\^i/î/g;
s/\\^e/ê/g;
s/\\'\''e/é/g;
s/\\`a/à/g;
s/\\`e/è/g;
s/\\^a/â/g;
s/\\^o/ô/g;
s/\\^u/û/g;
s/\\`u/ù/g;
s/\\^I/Î/g;
s/\\^E/Ê/g;
s/\\^O/Ô/g;
s/\\^U/Û/g;
s/\\`A/À/g;
s/\\selectlanguage{french}/ /g;
s/\\foreignlanguage{french}{/ /g;
s/}\\foreignlanguage{french}{/ /g;
s/\\foreignlanguage{dutch}{/ /g;
s/}\\foreignlanguage{dutch}{/ /g;
' $TEMP > temp-out
mv temp-out $TEMP
--
http://www.kde-france.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic