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?

On 25 Oct, 2010, at 13:43 , Richard Heck wrote:

> On 10/25/2010 04:32 AM, Jurriën Stutterheim wrote:
>> Hmm... I just figured out I might be able to do this using Templates. 
>> However, I can't seem to be able to make my custom template appear in the 
>> list of Templates in the Insert External Material dialog. Where do I place 
>> my newly created template?
>> I'm using LyX 2.0 alpha 6 on Mac OS X 10.6.4.
>> 
>>   
> I'm not sure about this, but I think what you should do is copy the file 
> lib/external_templates from LyX's system directory to your local user 
> directory, then add your template to the local version. This is not the most 
> flexible system, to be sure.
> 
> Richard
> 
>> Cheers,
>> 
>> - Jurriën
>> 
>> On 25 Oct, 2010, at 09:57 , Jurriën Stutterheim wrote:
>> 
>>   
>>> Hi all,
>>> 
>>> 
>>> I'm trying to streamline the inclusion of Haskell code in my documents. 
>>> Currently, I use the lhs2TeX tool to convert my .lhs (Literate Haskell) 
>>> file to .tex, which I can then include in LyX using the regular include 
>>> mechanism.
>>> Ideally, however, I would just include my .lhs file in LyX and have a 
>>> converter execute the lhs2TeX step for me. It might be useful to note that 
>>> lhs2TeX can both write to a file and output the produced LaTeX code to 
>>> stdout.
>>> Is this possible?
>>> 
>>> I added a File Format in the LyX File Formats settings dialog with 
>>> extension lhs and Default Output Format LaTeX (pdflatex). I marked it as 
>>> Document format.
>>> Next, I added a converter from Literate Haskell to LaTeX (pdflatex). The 
>>> converter command is lhs2TeX $$i -o $$o . This command makes lhs2TeX 
>>> convert the input $$i to LaTeX and write the results to file $$o .
>>> Unfortunately, it doesn't really do anything useful yet. How can I make 
>>> this converter work?
>>> 
>>> 
>>> Thanks!
>>> 
>>> 
>>> - Jurriën
>>>     
>>   
> 

Reply via email to