From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/12535 Path: main.gmane.org!not-for-mail From: Henning Hraban Ramm Newsgroups: gmane.comp.tex.context Subject: Re: Conversion LaTeX -> ConTeXt Date: Wed, 18 Jun 2003 21:21:46 +0200 Sender: ntg-context-admin@ntg.nl Message-ID: <1A65D657-A1C2-11D7-9ED9-0030659899AA@fiee.net> References: Reply-To: ntg-context@ntg.nl NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (Apple Message framework v552) Content-Type: multipart/mixed; boundary=Apple-Mail-4-347495641 X-Trace: main.gmane.org 1055965196 13744 80.91.224.249 (18 Jun 2003 19:39:56 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 18 Jun 2003 19:39:56 +0000 (UTC) Original-X-From: ntg-context-admin@ntg.nl Wed Jun 18 21:39:53 2003 Return-path: Original-Received: from ref.vet.uu.nl ([131.211.172.13] helo=ref.ntg.nl) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19SimA-0003Wt-00 for ; Wed, 18 Jun 2003 21:39:22 +0200 Original-Received: from ref.ntg.nl (localhost.localdomain [127.0.0.1]) by ref.ntg.nl (Postfix) with ESMTP id 465D810B3D; Wed, 18 Jun 2003 21:39:21 +0200 (MEST) Original-Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.177]) by ref.ntg.nl (Postfix) with ESMTP id 9728110B39 for ; Wed, 18 Jun 2003 21:35:21 +0200 (MEST) Original-Received: from [212.227.126.155] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 19SiiH-0004jd-00 for ntg-context@ntg.nl; Wed, 18 Jun 2003 21:35:21 +0200 Original-Received: from [194.230.122.246] (helo=fiee.net) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 19SiiG-0003Pr-00 for ntg-context@ntg.nl; Wed, 18 Jun 2003 21:35:20 +0200 Original-To: ntg-context@ntg.nl In-Reply-To: X-Mailer: Apple Mail (2.552) Errors-To: ntg-context-admin@ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.0.13 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.comp.tex.context:12535 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:12535 --Apple-Mail-4-347495641 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Am Mittwoch, 18.06.03, um 11:37 Uhr (Europe/Zurich) schrieb Frank Sonnemans: > I am starting to move away from LaTeX to ConTeXt and was wondering if > some > ConTeXt users have written scripts to convert LaTeX documents to > ConTeXt > documents. Or perhaps just partial conversions, for example from a > LaTeX > tabular environment to a ConTeXt table. Here you are. But it's *very* basic and not in any way sophisticated. If you need some more samples of ConTeXt sources (with layout definition etc.) have a look at my german tutorial files at: http://www.fiee.net/texnique/?menu=0-1-1&lang=de --Apple-Mail-4-347495641 Content-Disposition: attachment; filename=latex2context.pl Content-Transfer-Encoding: quoted-printable Content-Type: application/octet-stream; x-unix-mode=0644; name="latex2context.pl" #!/usr/bin/perl=20-w=0D=0A=0D=0Aprint=20"\nThis=20is=20LaTeX2ConTeXt.=20= Version=202002-03-13\n";=0D=0Aprint=20"I'll=20try=20to=20convert=20your=20= LaTeX=20file=20for=20ConTeXt.\n";=0D=0Aprint=20"copyleft=20Henning=20= Hraban=20Ramm,=20http://www.fiee.net/texnique/\n\n";=0D=0A=0D=0Aunless=20= ($ARGV[0])=20{die=20"You=20must=20name=20a=20file=20to=20convert!=20= $!"};=0D=0Amy=20$LaTeXDatei=20=3D=20$ARGV[0];=0D=0Aunless=20(-T=20= $LaTeXDatei)=20{=0D=0A=09print=20"$LaTeXDatei=20not=20found!\n";=0D=0A=09= if=20(-T=20$LaTeXDatei.'.tex')=20=20{=20$LaTeXDatei=20.=3D=20".tex";=20}=0D= =0A}=20#=20unless=0D=0A$LaTeXDatei=20=3D~=20s/\\/\//g;=0D=0Arename=20= ($LaTeXDatei,=20$LaTeXDatei.".bak");=0D=0A=0D=0Aopen=20(QUELLE,=20= $LaTeXDatei.".bak")=20or=20die=20"Can't=20open=20$LaTeXDatei!=20$!";=0D=0A= =0D=0Amy=20$ConTeXtDatei=20=3D=20$LaTeXDatei;=0D=0Aopen=20(ZIEL,=20= ">".$ConTeXtDatei)=20or=20die=20"Can't=20make=20$ConTeXtDatei!=20$!";=0D=0A= =0D=0A#=20Header=20(should=20be=20an=20extra=20file)=0D=0Aprint=20ZIEL=20= "%=20interface=3Denglish=20output=3Dpdftex\n";=0D=0Aprint=20ZIEL=20"%D=20= this=20\\ConTeXt\\=20file=20is=20automatically=20converted=20from=20= \\LaTeX.\n";=0D=0Aprint=20ZIEL=20"\\enableregime[windows]\n";=0D=0Aprint=20= ZIEL=20"\\mainlanguage[de]\n";=0D=0Aprint=20ZIEL=20= "\\setupencoding[default=3Dtexnansi]\n";=0D=0Aprint=20ZIEL=20"\n";=0D=0A=0D= =0Awhile=20()=20{=0D=0A#=20disable=20LaTeX=20header=20and=20some=20= other=20commands=0D=0A=09s=A7^%!=A7%%%=20=A7;=0D=0A=09= s=A7^(|\s)(\\document)(style|class)=A7%%%=20$2$3=A7g;=0D=0A=09= s=A7^(|\s)(\\usepackage|\\setlength|\\addtolength|\\normalfont)=A7%%%=20= $2=A7g;=0D=0A#=09s=A7^(|\s)(\\addtolength)=A7%%%=20$2=A7g;=0D=0A=0D=0A=09= unless=20(m/^%/)=20{=20#=20if=20no=20comment=20line=0D=0A#=20raw=20= convert=20environments=0D=0A=09=09s=A7\\begin{([^{}]*)}=A7\\start$1=20= =A7g;=09#=20\begin{environment}=20-->=20\startenvironment=0D=0A=09=09= s=A7\\end{([^{}]*)}=A7\\stop$1=20=A7g;=09#=20\end{environment}=20-->=20= \stopenvironment=0D=0A=09=09s=A7\\begingroup=A7\\bgroup=A7g;=0D=0A=09=09= s=A7\\endgroup=A7\\egroup=A7g;=0D=0A=09=09= s=A7\\include(\s*){([^{}<>\[\]]*)}=A7\\input=20$2=20=A7g;=09#=20= \include{}=20-->=20\input=0D=0A=0D=0A#=20convert=20single=20commands=0D=0A= =09=09s=A7\\newcommand=A7\\def=A7g;=09#=20\newcommand=20-->=20\def=0D=0A=09= =09s=A7\\new(environment)(\s*){([^{}]*)}=A7\\define$1\[$3\]=A7g;=09#=20= \newenvironment{}=20-->=20\defineenvironment[]=0D=0A=09=09= s=A7\\label=A7\\reference=A7g;=09#=20\label=20-->=20\reference=0D=0A=09=09= s=A7\\\\\*=A7\\\\=A7g;=09#=20\\*=20-->=20\\=0D=0A=09=09= s=A7\\(big|small)skip=A7\\blank\[$1\]=A7g;=09#=20\...skip=20-->=20= \blank[...]=0D=0A=09=09s=A7\"`(.*)\"'=A7\\quote{$1}=A7g;=0D=0A=09=09= s=A7``(.*)''=A7\\quotation{$1}=A7g;=0D=0A=09=09= s=A7\\select(language){([^{}]*)}=A7\\$1\[$2\]=A7g;=09#=20= \selectlanguage{lang}=20-->=20\language[lang]=0D=0A=09=09= s=A7\\new(page)=A7\\$1=A7g;=09#=20\newpage=20-->=20\page=0D=0A=09=09= s=A7\\(|this)pagestyle{empty}=A7\\setupheaders[state=3Dstop]=A7g;=0D=0A=09= =09s=A7\\(|this)pagestyle{([^{}]*)}=A7\\setupheaders[state=3Dstart]=20\%=20= $2=A7g;=0D=0A=09=09= s=A7\\areaset{([^{}]*)}{([^{}]*)}=A7\\setuplayout[width=3D$1,=20= height=3D$2]=A7g;=0D=0A=0D=0A#=09=09s=A7LaTeX=A7ConTeXt=A7gi;=0D=0A=0D=0A= #=20correct=20environments=0D=0A=09=09= s=A7\\(start|stop)document=A7\\$1text=A7g;=0D=0A=09=09= s=A7(\\startitemize)=A7$1\[1\]=A7g;=0D=0A=09=09= s=A7\\(start|stop)enumeration=A7\\$1itemize[n]=A7g;=0D=0A=09=09= s=A7\\(start|stop)(verbatim|alltt)=A7\\$1typing=A7g;=0D=0A=09=09= s=A7\\(start|stop)verse=A7\\$1lines=A7g;=0D=0A=09=09= s=A7\\(start|stop)center=A7\\$1centered=A7g;=0D=0A=09=09= s=A7\\(start|stop)tabular(x*)=A7\\$1tabulate=A7g;=0D=0A=09=09= s=A7\\(start|stop)long(table)=A7\\$1$2=A7g;=0D=0A=09=09= s=A7\\(start|stop)multicols(\s*){(0-9)}=A7\\$1columns[n=3D$3]=A7g;=0D=0A=09= =09s=A7\\twocolumn=A7\\startcolumns[n=3D2]=A7g;=0D=0A=09=09= s=A7\\onecolumn=A7\\stopcolumns=A7g;=0D=0A=0D=0A#=20correct=20titles=0D=0A= =09=09s=A7(\\part)(\**)=A7$1=A7g;=09#=20\part*=20-->=20\part=0D=0A=09=09= s=A7\\chapter\*=A7\\title=A7g;=0D=0A=09=09= s=A7\\(|sub)section\*=A7\\$1subject=A7g;=0D=0A=09=09= s=A7\\paragraph=A7\\subsubsubsection=A7g;=0D=0A#=09=09s=A7=A7=A7g;=0D=0A= #=09=09s=A7=A7=A7g;=0D=0A=0D=0A#=20correct=20tables=0D=0A=09=09= s=A7(\\starttabulate)(\s*){([^{}]*)}=A7$1$2\[\|$3\|\]=A7g;=0D=0A=09=09= s=A7&=A7\\NC=20=A7g;=0D=0A=09=09s=A7\\hline=A7\\HL=A7g;=0D=0A=09=09= s=A7\\(top|bottom|mid)rule=A7\\HL=A7g;=0D=0A=0D=0A#=20correct=20= typography=0D=0A=09=09s=A7\\verb(\||\+)([^\|]*)(\||\+)=A7\\type{$2}=A7g;=0D= =0A=09=09s=A7\\verb=A7\\type=A7g;=0D=0A=09=09s=A7\\type{\\=A7\\tex{=A7g;=0D= =0A=09=09s=A7\\texttt=A7\\type=A7g;=0D=0A=09=09s=A7\\emph{=A7{\\em=20=A7g;= =0D=0A=09=09s=A7\\text(bf|sc|it|sl){=A7{\\$1=20=A7g;=0D=0A=09=09= s=A7\\(rm|ss|tt)family=A7\\switchtobodyfont\[$1\]=A7g;=0D=0A=09=09= s=A7\\small=20=A7\\tfx=20=A7g;=0D=0A=09=09s=A7\\Small=20=A7\\tfxx=20=A7g;=0D= =0A=09=09s=A7\\large=20=A7\\tfa=20=A7g;=0D=0A=09=09s=A7\\Large=20=A7\\tfb=20= =A7g;=0D=0A=09}=20#=20unless=20comment=20line=0D=0A=09print=20ZIEL;=0D=0A= =09print=20".";=0D=0A}=20#=20while=0D=0Aprint=20"\n";=0D=0A=0D=0Aclose=20= (ZIEL);=0D=0Aclose=20(QUELLE);=0D=0A= --Apple-Mail-4-347495641 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed Gr=FC=DFlis vom Hraban! --=20 http://www.fiee.net/texnique/ --Apple-Mail-4-347495641--