Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!world!bzs From: bzs@world.std.com (Barry Shein) Newsgroups: comp.text.sgml Subject: Re: SGML translators to/from LaTeX Message-ID: Date: 18 Sep 90 01:57:25 GMT References: <1990Sep14.181719.12244@sq.sq.com> Sender: bzs@world.std.com (Barry Shein) Distribution: comp Organization: The World Lines: 51 In-Reply-To: Chuck.Phillips@FtCollins.NCR.COM's message of 17 Sep 90 01:01:40 GMT From: Chuck.Phillips@FtCollins.NCR.COM (Chuck.Phillips) >In LaTeX, you have something more like: > >\begin{document} >\abstract{text text text...} >\section >text text text... >\subsection >text text\footnote{text text text...} text... >\subsubsection >text text text... >... >\end{document} >Bearing all this in mind, would it be possible to construct "intelligent" >converters from/to LaTeX to/from SGML that preserve the document's overall >structure? ...if _explicit_ formatting commands were simply ignored? Yes, absolutely, you could probably write most of it as a little Perl or similar high-level script. Heck, you could probably write it in TeX, just write replacement macros that expand themselves to the corresponding SGML string, Tex will just think that's the output you wanted (well, I suppose it wants to put out a dvi file, this would be easier in nroff, but you could probably put all the ASCII/SGML out to the error file and throw away the dvi file, something like that...) There wouldn't be a heckuva lot more going on than just picking up the backslashes and curly braces and changing them to angle-brackets unless you were trying to conform to a particularly bad fit of a DTD: \abstract{text text text} -> \section ->
\subsection -> and so on. I suppose someone will now point out that you could probably define the SGML delimitors in the header to backslash and none and be done with it.. The only possible problem might be that most DTD's have a notion of ending an object eg,
. But I'd imagine you could just build a list of LaTeX objects which are presumed to end any preceding objects of a class and just use that. Note that SGML does not *require* these end markers, but it's common. -- -Barry Shein Software Tool & Die | {xylogics,uunet}!world!bzs | bzs@world.std.com Purveyors to the Trade | Voice: 617-739-0202 | Login: 617-739-WRLD