Re: Google Docs to LaTeX

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