On 07/30/2010 11:50 AM, David Hopkins wrote:

There are two issues:

1) if I use writer2latex and get the 'ugly' LaTex. The first error is
a misplaced \noalign in a table which seems to cascade into a lot of
other errors.

This is the kind of thing for which a perl script is helpful.

2) the second concerns an in-house tex template that is used for
internal reports. I can use Texworks, open the file, add text,
equations, tables, and such without issues. I can also use WinEdt (on
a PC) with the tex file and it works as well.  However, importing this
tex file into LyX fails miserably.  LaTex preamble seems to capture
everything before the begin{document}, but LyX can't create the
document.  The first issue seems to be the use of

\def\PREPARETYPE {\MYTR} where MYTR is later defined via

\newcommand{\MYTR}{
   \documentclass{myarticle}
   \usepackage{boxhandler}
   \def\MandatoryDL{MY.dls}% Mandatory Distribution List File
   \def\UserDL{mystencil.dls}%User Distribution List File
   \addtolength{\cftfignumwidth}{0.0ex}%Extend width of lof label if using
%appendix figures .OR.>  99 figures
   \addtolength{\cfttabnumwidth}{0.0ex}%Extend width of lot label if using
%appendix figures .OR.>  99 figures
   \def\CaptionJustification{\raggedright}
   \usepackage[T1]{fontenc}
   \usepackage{times}
}

%insert another \newcommand for a different TYPE here ... not included
in this email

\PREPARETYPE%

I get errors about having multiple documentclass definitions.

Because LyX adds \documentclass itself. To use this with LyX, you'll definitely need to disentangle some of this. The \usepackage stuff should really go in the preamble, BEFORE \documentclass is issued, and I'd think the \defs are more natural there, too.

If I simply remove the documentclass, I still get errors about
\addtolength, and others.

I'm not so sure why you see this, but, again, disentangling is surely the key.

I'm trying to convert the template to work with LyX although it
does show up with a lot of TeX commands embedded in it. (lots of red
sections).

This can probably be cleaned up some, but it has to be done manually. You may be able to write new layout styles, or character styles, to replace some of this.

Richard

Reply via email to