Scientific Word to LyX Conversion - Wiki Entry
FYI: http://wiki.lyx.org/FAQ/ImportingFromSWP
Scientific Word to LyX Conversion
Hi, This is also addressed to [EMAIL PROTECTED] in order to request posting this tidbit onto a password-protected Wiki page. I suggest: <http://wiki.lyx.org/Windows/Windows> since Scientific Word/Workplace users are Windows-only. Thanks! - Importing Scientific Word/Scientific Workplace (hereinafter SWP) .tex files into LyX is relatively straightforward. The particular procedure that works as of 10 December 2007 is provided below. Before proceeding, one should consider the issue of included graphics files. One of the allures of SWP, working under MS Windows, has been the ready cutting-pasting of Windows metafiles (.wmf, .emf) via the clipboard, out from some application, as figures into one's document. This, plus punching out the final PDF, could be done without the aggravation of first putting figures into EPS (encapsulated postscript) format, as is the standard handling practice for most other LaTeX setups. With the advent of LyX 1.5 and the contributed metafile2eps utility, one can continue this lazy practice, as the combo will auto-render .wmf that are included in the document, and auto-convert to EPS when time for PDF output. However, metafile2eps is also great as a standalone utility for converting .wmf into EPS. If one collaborates with others possessing vanilla LaTeX setups and/or on linux, one will need to exchange figures in EPS format. So undertaking such conversions up-front is likely advisable. STEPS to Convert SW/SWP .tex to LyX .lyx If not done already, install the *free* MetafileToEPSConverter, per: <http://wiki.lyx.org/Windows/MetafileToEPSConverter> I. In SWP, File>SaveAs Portable LaTeX. This will employ, for instance, the LaTeX-standard \includegraphics directive, and comment-out SWP-specific macros and pragmas. These comment-outs will later show up as harmless ERT (evil red text - embedded TeX commands, but here, merely % comments) in the LyX document. Those can be left alone (harmless), or deleted as desired. II. Metafile-to-EPS conversion (optional, but recommended) Convert any figures that are windows metafiles (.wmf, .emf) to .eps: A. go to c:\Program Files\LyX15\bin, -- right-click metafile2eps.exe, and PinToStartMenu -- this makes it easy to invoke the program from the Start Menu B. - Open Powerpoint and metafile2eps windows - drag .wmf file icon into Powerpoint -- should auto-open the graphic -- in powerpoint: select-All, Copy - in metafile2eps window: Edit>paste, then File>ExportEPS (can use button icons) Note that when pasting, the image actually shown in the metafile2eps GUI window may not be the complete figure you were expecting, but don't be alarmed - the complete figure is put to the EPS file intact. C. In .tex file, using a text editor (e.g., WinVi32, WordPad etc) search/replace ".wmf" to ".eps", etc. III. The following is a current bug in the behind-scenes tex2lyx converter program; it will someday get fixed (bug 4418). Meanwhile, here's the workaround: In the .tex file, using a text editor (e.g., WinVi32, WordPad etc) search/replace: natheight with %natheight natwidth with %natwidth IV. LyX:Document>Settings>LaTeX Preamble: You may need to change the \usepackage directives to match MikTeX (or whatever LaTeX installation you're employing). For example, there is no such package (at least in MikTeX): \usepackage{fancyheadings} In this case, it's easy to delete this entry in the preamble and find built-in provisions for this functionality under Document>Settings>Page Layout to get what you want. V. BibTeX Bibliography: For converted .tex files that included a BibTeX bibliography at the end, at the tail of the resulting LyX document, there will be a grey tag labeled "BibTeX Generated Bibliography" - clicking it pops a menu showing the .bib database files and a selectable bib style. Frank J. Iannarilli [EMAIL PROTECTED] Aerodyne Research, Inc., 45 Manning Road, Billerica, MA 01821 USA www.aerodyne.com/cosr/cosr.html
Re: Pre-Mature Import Abort (Document Format Failure)?
Hi Anyone, This is really bizarre, but progress nonetheless. I'm finding that if I merely add the trim=0.00in 0.00in 0.000in 0.00in, directive into the \includegraphics[ section, things work out! That is, at/near the point in my .tex file where I *don't* do this, is where LyX poops out. As I keep moving deeper into my .tex file and adding this to each {figure}, I'm extending the point at which LyX is rendering the document within the GUI. Also, each figure so touched will render with a real numbered caption within the LyX GUI (otherwise not). Here is a snippet of one of my {figure}s: \begin{figure} [ptb] \begin{center} \includegraphics[ trim=0.00in 0.00in 0.000in 0.00in, natheight=2.792800in, natwidth=4.535500in, height=1.2324in, width=1.9951in ]% {SingletRecord.eps}% \caption{Data Record Plot, Showing Detector Digital Counts as a Function of Pixel Index, for a Group of Pixels Illuminated by a Singlet Spectral Line. }% \label{fig:SingletRecord}% \end{center} \end{figure} Note that LyX seems happy with either the \label separate from, or embedded within the \caption argument. So what does this imply about what is going on, and any remedies (if any) for LyX bugfixing? Regards, Frank
Re: Pre-Mature Import Abort (Document Format Failure)?
Another obvious thing I should now mention is that, if I Open the saved .lyx file (the one saved earlier by LyX into my working directory) into a new LyX session, then the same LyX:Document Format Failure popup error occurs. So the problem is likely well past the tex2lyx stage?
Re: Pre-Mature Import Abort (Document Format Failure)?
Hi again, Duh, I should have noticed earlier ... the .lyx file saved by the LyX GUI (i.e., into my working directory, not the temporary directory) is *also* a complete end-to-end parse of my .tex file (i.e., has my trailing bibtex invocation, \end_document, etc). I did a diff between this file and the temporary one named "XXX" in the TEMP directory, and they are somewhat different. Another clue as to where things are going awry?
Re: Pre-Mature Import Abort (Document Format Failure)?
Paul A. Rubin <[EMAIL PROTECTED]> writes: > Hey Frank, > > Was the XXX file in the error message your SWP file, the intermediate > file you found, or the final .lyx file? > > There are some known instances of tex2lyx failing, and SWP lards up its > "portable" files with lots of SWP-specific macros. The > divide-and-conquer approach you were taking usually works at isolating > where the problem lies. > > If you'd care to send the files to me, or post them here, I'll take a > look and see if I can narrow down where the problem lies. > > /Paul > > Hi Paul, Thanks for your offer. I've sent you the files directly. The XXX file was the intermediate temporary file I found (the one that seemed to be a complete parse of my .tex file, in lyx format). Regards,
Pre-Mature Import Abort (Document Format Failure)?
Hi, I'm trying to import a SWP "portable LaTeX" file into LyX1.5.2 (just downloaded few days ago - web-based installer, WinXP). I keep getting the same resulting error message (pop-up): "LyX: Document Format Failure C:\Documents and Settings...\Local Settings\Temp\lyx_tempdirXXX\XXX ended unexpectedly, which means that it is probably corrupted." Then the LyX GUI shows a partially imported result. I've tried several variations to diagnose what might be the problem: 1. First tried importing the .tex file, that contained .wmf files for \includegraphics (I had installed metafile2eps). The partial import did display the graphics. But I thought perhaps the conversion/render script buffer might be "overfilled"... 2. Then I converted all my graphics to .eps, changed their references to .eps in the .tex file, then tried again. Same result (same point in document at which the import was partial). So it wasn't due to .wmf conversion overflows... 3. I tried snipping out the section of the document around the area where the import terminated. The subsequent import effort produced a partial import that proceeded further into the document. I could not discern any commonality between the two halting points in the raw .tex file. Some other clues: A. I did notice that of the several figures imported, only 1 was treated as a float, with caption. I examined this and compared it to the other figures not so treated, and could not discern any difference between their \begin{figure} and \includegraphics directives. B. Before exiting the LyX session, I went into the Temp folder, and found what appeared to be a temporary lyx-format file (no extension) - it contained a tex2lyx conversion of my *entire* .tex file. So perhaps (in my feeble understanding) the problem lies in the lyx2lyx conversion? Does anyone have any immediate suggestions? Should this get posted to bugzilla? If/when I succeed, I intend to post a "how-to" for SWP-to-LyX (as of 1.5.2). Thanks! Frank J. Iannarilli [EMAIL PROTECTED] Aerodyne Research, Inc., 45 Manning Road, Billerica, MA 01821 USA www.aerodyne.com/cosr/cosr.html