Solved!

I ended up with the following template:

Template LHS 
    GuiName "LHS: $$AbsOrRelPathParent$$Basename"
    HelpText
        Including Literate Haskell
    HelpTextEnd
    InputFormat lhs
    FileFilter "*.lhs"
    AutomaticProduction true
    Format LaTeX
        Product "\\input{$$AbsOrRelPathMaster$$Basename.tex}"
        UpdateFormat pdflatex
        UpdateResult "$$AbsPath$$Basename.tex"
        ReferencedFile lhs "$$AbsPath$$Basename.tex"
    FormatEnd
    Format PDFLaTeX
        Product "\\input{$$AbsOrRelPathMaster$$Basename.tex}"
        UpdateFormat pdflatex
        UpdateResult "$$AbsPath$$Basename.tex"
        ReferencedFile lhs "$$AbsPath$$Basename.tex"
    FormatEnd
    Format Ascii
        Product "\\input{$$AbsOrRelPathMaster$$Basename.tex}"
        UpdateFormat pdflatex
        UpdateResult "$$AbsPath$$Basename.tex"
        ReferencedFile lhs "$$AbsPath$$Basename.tex"
    FormatEnd
    Format DocBook
        Product "\\input{$$AbsOrRelPathMaster$$Basename.tex}"
        UpdateFormat pdflatex
        UpdateResult "$$AbsPath$$Basename.tex"
        ReferencedFile lhs "$$AbsPath$$Basename.tex"
    FormatEnd
TemplateEnd

Using a Document file format called LHS, shortname lhs and extension lhs.
I also added a single converter from LHS to LaTeX (pdflatex) with the command 
lhs2TeX $$i -o $$o
LyX devs: please consider adding this template for inclusion in new LyX 
releases :)

Cheers,


Jurriën

P.S.: it has received very limited testing so far, and it works for my 
purposes. The ASCII and DocBook definitions probably don't make a lot of sense 
right now.

On 25 Oct, 2010, at 14:28 , Jurriën Stutterheim wrote:

> Ah, nice! There we go.. it's appearing in the list now.
> Strange side-effect: all stock templates are now gone from the list. (not 
> that I really care.. I don't use them)
> My document still compiles, however, I can't see my Haskell code in the 
> output, even when compiling to LaTeX, using pdflatex.
> How does it know it should use the settings from the LHS converter I added? 
> See screenshots I link below for my current settings. Is my template actually 
> correct?
> 
> Converters: http://cl.ly/3198899be981beaa633f
> File Formats: http://cl.ly/5574480e9555ba16dd57
> 
> On 25 Oct, 2010, at 14:10 , Richard Heck wrote:
> 
>> On 10/25/2010 07:55 AM, Jurriën Stutterheim wrote:
>>> It turns out the external_templates file was hidden away in LyX.app itself. 
>>> In it, it suggests the following:
>>> # Feel free to create your own External Templates, storing them in
>>> # .lyx/external_templates
>>> 
>>> So I created ~/.lyx/external_templates and added this content:
>>> 
>>> Template LHS
>>>    GuiName "LHS: $$AbsOrRelPathParent$$Basename"
>>>    HelpText
>>>        Including Literate Haskell
>>>    HelpTextEnd
>>>    InputFormat lhs
>>>    FileFilter "*.lhs"
>>>    AutomaticProduction true
>>>    Format LHS
>>>        Product "\\input{$$AbsOrRelPathMaster$$Basename.tex_t}"
>>>        UpdateFormat lhs
>>>        UpdateResult "$$AbsPath$$Basename.tex"
>>>        ReferencedFile lhs "$$AbsPath$$Basename.tex"
>>>    FormatEnd
>>> TemplateEnd
>>> 
>>> Next, I reconfigured LyX and restarted it.
>>> Unfortunately, it still doesn't show my template.
>>> Have I misplaced the external_templates file?
>>> 
>>> 
>> The location is wrong for Mac. I think it's something like ~/Application 
>> Support/LyX 1.6/external_templates. If you find your lyxrc.defaults file, 
>> then that is the right directory.
>> 
>> rh
>> 
> 

Reply via email to