#!/bin/bash # ooi2beamer -- Copyright (C) 2008 Christophe Lohr / TELECOM Bretagne # Translate an OpenOffice-Impress document to a LaTeX-Beamer one # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # GNU General Public License: # http://www.gnu.org/licenses/gpl.html # Documentation : # https://info.enstb.org/documentation/latex/beamer/ooi2beamer/ # Usage : # 1- Créez un nouveau répertoire # 2- Exécutez ooimpress, chargez votre document # 3- Exportez au format html (Fichier/Exporter, et surtout pas AssistantWeb) # 4- Répondez ce que vous voulez aux questions, ça n'a pas d'importance # 5- De très nombreux fichiers sont créés, on ne s'intéresse qu'à text*.html # 6- Exécutez "ooi2beamer" dans ce répertoire # 7- Un fichier main.tex est créé , enjoy! # (ainsi que main.{beamer,article}.tex, cf §21.2.2 beameruserguide.pdf) # Option(s) du script : # -nonotes Placer les "notes" en dehors de la frame et non pas dans la # commande \note{} de beamer # Parser les options NONOTES="false" while test $# -gt 0 ; do case "$1" in -nonotes ) shift NONOTES="true" ;; * ) echo "Warning: option inconnue $1" >&2 break ;; esac done #### # On suit le workflow de la section 21.2.2 du beameruserguide.pdf # Genere le main.beamer.tex echo main.beamer.tex cat << EOF > main.beamer.tex \documentclass[ignorenonframetext,14pt]{beamer} \usetheme{TELECOMBretagne} \setbeamercovered{transparent} \setlength\leftmargini{1em} \setlength\leftmarginii{1em} \setlength\leftmarginiii{1em} \setlength\labelwidth{\leftmargini} % \setbeamertemplate{navigation symbols}{% % \insertslidenavigationsymbol% % \insertframenavigationsymbol% % \insertbackfindforwardnavigationsymbol} \input{main.tex} EOF # Genere le main.article.tex echo main.article.tex cat << EOF > main.article.tex \documentclass[a4paper,twoside,12pt]{article} \usepackage{beamerarticle} \usepackage{fullpage} \usepackage{pgf} \usepackage{hyperref} \setjobnamebeamerversion{main.beamer} \sloppy \raggedbottom \input{main.tex} EOF # Genere le main.tex echo "main.tex ..." # Choisit un nom de fichier temporaire avec un suffixe .html TEMP="`tempfile -s .html`" # Les options qui vont bien pour html2tex, insérées dans le fichier html # Voir http://www.iwriteiam.nl/html2tex.html cat << EOF > $TEMP EOF # Avant de supprimer le bandeau de navigation entre transparents avec un # simple sed, il faut cannoniser le html avec tidy for i in text?.html text??.html text???.html; do if [ -f "$i" ] ; then echo $i >&2 tidy -q -utf8 -w 1000 $i fi done \ | sed -e '/.*Première.*Précédent.*Suivant.*?,+1d' \ >> "$TEMP" cat << EOF >> "$TEMP" EOF # Le fameux html2tex # compiler http://www.iwriteiam.nl/html2tex_c.txt avec "-DASCII8" html2tex -o "$TEMP.tex" "$TEMP" # Utilise sed pour : # - supprimer du blabla html2tex avec le nom du fichier # - essayer de bien gérer les notes qui sont coincées entre le # subsubsection{Notes:} et le end{frame}... # - gérer en LaTex les symbols html laissés par html2tex if [ "$NONOTES" = true ]; then # Traiter les notes comme étant du texte en dehors de la frame (pratique # en mode beamer-article) TRAITER_NOTES='/.*subsubsection{Notes:}.*/,/.*end{frame}.*/{s,.*end{frame},,g;s,.*subsubsection{Notes:},\\end{frame},g}' else # Le traitement par défaut des notes : le texte va dans la commande \note{} # de beamer, à l'intérieur de la frame TRAITER_NOTES='/.*subsubsection{Notes:}.*/,/.*end{frame}.*/{s,.*subsubsection{Notes:}.*,\\note{,g;s,.*end{frame}.*,}\n\\end{frame},g}' fi sed -e '1d;$d' "$TEMP.tex" \ -e $TRAITER_NOTES \ -e "s,\\’,',g" -e 's,\\…,\\ldots,g' -e 's,\\–,--,g' \ > main.tex echo "main.tex ... done" # echo Indent main.tex # indentTeX.sh main.tex # Supprime les fichiers temporaires rm -f "$TEMP" "$TEMP.tex"