Hi, I want to use LyX to work on LaTeX files produced by lhs2tex from literate haskell scripts (and I know very little about LaTeX). When I open these files in LyX they are a massive jumble of ERT and ordinary text. lhs2tex uses a format file which is at /usr/share/lhs2tex/polycode.fmt on my system. How do I tell lyx about that? Will that help? What other files might I need to find or create to get LyX to play nicely with the output of lhs2tex? I've attached the result of running lhs2Tex on a small literate script -- I can run pdflatex on this and produce a pdf with no errors, so I suppose the paths must be set up OK on my system at some level?
Regards, Jim Burton TeX produced by lhs2tex from a small literate haskell script: ------------------------------- \documentclass{article} %% ODER: format == = "\mathrel{==}" %% ODER: format /= = "\neq " % % \makeatletter [EMAIL PROTECTED] [EMAIL PROTECTED] \newcommand\SkipToFmtEnd{}% \newcommand\EndFmtInput{}% \long\def\SkipToFmtEnd#1\EndFmtInput{}% }\SkipToFmtEnd \newcommand [EMAIL PROTECTED]@namedef{#1}{}}\SkipToFmtEnd} \usepackage{amstext} \usepackage{amssymb} \usepackage{stmaryrd} \DeclareFontFamily{OT1}{cmtex}{} \DeclareFontShape{OT1}{cmtex}{m}{n} {<5><6><7><8>cmtex8 <9>cmtex9 <10><10.95><12><14.4><17.28><20.74><24.88>cmtex10}{} \DeclareFontShape{OT1}{cmtex}{m}{it} {<-> ssub * cmtt/m/it}{} \newcommand{\texfamily}{\fontfamily{cmtex}\selectfont} \DeclareFontShape{OT1}{cmtt}{bx}{n} {<5><6><7><8>cmtt8 <9>cmbtt9 <10><10.95><12><14.4><17.28><20.74><24.88>cmbtt10}{} \DeclareFontShape{OT1}{cmtex}{bx}{n} {<-> ssub * cmtt/bx/n}{} \newcommand{\tex}[1]{\text{\texfamily#1}} % NEU \newcommand{\Sp}{\hskip.33334em\relax} \newcommand{\Conid}[1]{\mathit{#1}} \newcommand{\Varid}[1]{\mathit{#1}} \newcommand{\anonymous}{\kern0.06em [EMAIL PROTECTED] \newcommand{\plus}{\mathbin{+\!\!\!+}} \newcommand{\bind}{\mathbin{>\!\!\!>\mkern-6.7mu=}} \newcommand{\sequ}{\mathbin{>\!\!\!>}} \renewcommand{\leq}{\leqslant} \renewcommand{\geq}{\geqslant} \usepackage{polytable} %mathindent has to be defined [EMAIL PROTECTED] {\newdimen\mathindent\mathindent\leftmargini}% {}% \def\resethooks{% \global\let\SaveRestoreHook\empty \global\let\ColumnHook\empty} \newcommand*{\savecolumns}[1][default]% [EMAIL PROTECTED]@macro\SaveRestoreHook{\savecolumns[#1]}} \newcommand*{\restorecolumns}[1][default]% [EMAIL PROTECTED]@macro\SaveRestoreHook{\restorecolumns[#1]}} \newcommand*{\aligncolumn}[2]% [EMAIL PROTECTED]@macro\ColumnHook{\column{#1}{#2}}} \resethooks \newcommand{\onelinecommentchars}{\quad-{}- } \newcommand{\commentbeginchars}{\enskip\{-} \newcommand{\commentendchars}{-\}\enskip} \newcommand{\visiblecomments}{% \let\onelinecomment=\onelinecommentchars \let\commentbegin=\commentbeginchars \let\commentend=\commentendchars} \newcommand{\invisiblecomments}{% \let\onelinecomment=\empty \let\commentbegin=\empty \let\commentend=\empty} \visiblecomments \newlength{\blanklineskip} \setlength{\blanklineskip}{1mm} \newcommand{\hsindent}[1]{\quad}% default is fixed indentation \newcommand{\NB}{\textbf{NB}} \newcommand{\Todo}[1]{$\langle$\textbf{To do:}~#1$\rangle$} \makeatother \EndFmtInput % % % % % % % This package provides two environments suitable to take the place % of hscode, called "plainhscode" and "arrayhscode". % % The plain environment surrounds each code block by vertical space, % and it uses \abovedisplayskip and \belowdisplayskip to get spacing % similar to formulas. Note that if these dimensions are changed, % the spacing around displayed math formulas changes as well. % All code is indented using \leftskip. % % Changed 19.08.2004 to reflect changes in colorcode. Should work with % CodeGroup.sty. % \ReadOnlyOnce{polycode.fmt}% \makeatletter \newcommand{\hsnewpar}[1]% {{\parskip=0pt\parindent=0pt\par\vskip #1\noindent}} % can be used, for instance, to redefine the code size, by setting the % command to \small or something alike \newcommand{\hscodestyle}{} % The command \sethscode can be used to switch the code formatting % behaviour by mapping the hscode environment in the subst directive % to a new LaTeX environment. \newcommand{\sethscode}[1]% {\expandafter\let\expandafter\hscode\csname #1\endcsname \expandafter\let\expandafter\endhscode\csname end#1\endcsname} % "compatibility" mode restores the non-polycode.fmt layout. \newenvironment{compathscode}% {\par\noindent \advance\leftskip\mathindent \hscodestyle [EMAIL PROTECTED] \(\pboxed}% {\endpboxed\)% \par\noindent \ignorespacesafterend} \newcommand{\compaths}{\sethscode{compathscode}} % "plain" mode is the proposed default. \newenvironment{plainhscode}% {\hsnewpar\abovedisplayskip \advance\leftskip\mathindent \hscodestyle [EMAIL PROTECTED] \(\pboxed}% {\endpboxed\)% \hsnewpar\belowdisplayskip \ignorespacesafterend} % Here, we make plainhscode the default environment. \newcommand{\plainhs}{\sethscode{plainhscode}} \plainhs % The arrayhscode is like plain, but makes use of polytable's % parray environment which disallows page breaks in code blocks. \newenvironment{arrayhscode}% {\hsnewpar\abovedisplayskip \advance\leftskip\mathindent \hscodestyle [EMAIL PROTECTED] \(\parray}% {\endparray\)% \hsnewpar\belowdisplayskip \ignorespacesafterend} \newcommand{\arrayhs}{\sethscode{arrayhscode}} % The mathhscode environment also makes use of polytable's parray % environment. It is supposed to be used only inside math mode % (I used it to typeset the type rules in my thesis). \newenvironment{mathhscode}% {\parray}{\endparray} \newcommand{\mathhs}{\sethscode{mathhscode}} % texths is similar to mathhs, but works in text mode. \newenvironment{texthscode}% {\(\parray}{\endparray\)} \newcommand{\texths}{\sethscode{texthscode}} % The framed environment places code in a framed box. \def\codeframewidth{\arrayrulewidth} \RequirePackage{calc} \newenvironment{framedhscode}% {\parskip=\abovedisplayskip\par\noindent \hscodestyle \arrayrulewidth=\codeframewidth [EMAIL PROTECTED]|p{\linewidth-2\arraycolsep-2\arrayrulewidth-2pt}|@{}}% \hline\framedhslinecorrect\\{-1.5ex}% \let\endoflinesave=\\ [EMAIL PROTECTED] \(\pboxed}% {\endpboxed\)% \framedhslinecorrect\endoflinesave{.5ex}\hline \endtabular \parskip=\belowdisplayskip\par\noindent \ignorespacesafterend} \newcommand{\framedhslinecorrect}[2]% {#1[#2]} \newcommand{\framedhs}{\sethscode{framedhscode}} % The inlinehscode environment is an experimental environment % that can be used to typeset displayed code inline. \newenvironment{inlinehscode}% {\(\def\column##1##2{}% \let\>\undefined\let\<\undefined\let\\\undefined \newcommand\>[1][]{}\newcommand\<[1][]{}\newcommand\\[1][]{}% \def\fromto##1##2##3{##3}% \def\nextline{}}{\) }% \newcommand{\inlinehs}{\sethscode{inlinehscode}} % The joincode environment is a separate environment that % can be used to surround and thereby connect multiple code % blocks. \newenvironment{joincode}% {\let\orighscode=\hscode \let\origendhscode=\endhscode [EMAIL PROTECTED] \}\begingroup} %\let\SaveRestoreHook=\empty %\let\ColumnHook=\empty %\let\resethooks=\empty [EMAIL PROTECTED] {\origendhscode \global\let\hscode=\orighscode \global\let\endhscode=\origendhscode}% \makeatother \EndFmtInput % \begin{document} This is a literate haskell script. \ensuremath{(\Varid{f}\mathbin{\circ}\Varid{g})\;\Varid{x}\equiv \Varid{f}\;(\Varid{g}\;\Varid{x})} is inline code. \begin{hscode}\SaveRestoreHook [EMAIL PROTECTED]@{}} [EMAIL PROTECTED]@{}} \>[B]{}\Varid{fact}\mathbin{::}\Conid{Int}\to \Conid{Int}{}\<[E] \\ \>[B]{}\Varid{fact}\;\mathrm{0}\mathrel{=}\mathrm{1}{}\<[E] \\ \>[B]{}\Varid{fact}\; \Varid{n}\mathrel{=}\Varid{n}\mathbin{*}\Varid{fact}\;(\Varid{n}\mathbin{-}\mathrm{1}){}\<[E] \ColumnHook \end{hscode}\resethooks All I want is for LyX to like me :-( \end{document}