2

I need to insert code in my report, so I decided to use minted with LyX, my usual editor. I found a solution for getting minted and LyX together in this post (pwaller answer), by adding a custom template for minted in the external_templates directory. Here is the template:

Template MintedSource
    GuiName "Minted Source Code"
    HelpText
        Run \inputminted{}
    HelpTextEnd
    InputFormat text
    FileFilter "*"
    AutomaticProduction true
    Preview InstantPreview
    Format PDFLaTeX
        Product "\\inputminted[linenos,fontsize=\\footnotesize,baselinestretch=1]{python}{$$AbsPath$$Basename$$Extension}"

        Requirement "underscore"
        Requirement "minted"

        UpdateFormat text
        UpdateResult "$$AbsPath$$Basename$$Extension"
        ReferencedFile text "$$AbsPath$$Basename$$Extension"
    FormatEnd
TemplateEnd

According to the LyX Documentation, external templates should be placed in C:\Users\User\AppData\Roaming\LyX\external_templates directory. So I copied the minted template there, under multiple extensions (.lyx, .layout and none).

Either way, the new template won't show up in Insert > File > External Material gui. Is there anything wrong I did? Is there a easiest way to deal with minted in LyX? (the \inputminted command won't work, reasons explained in the same post.

4
  • external_templates is a file. It does not have an extension. That might be weird from a Windows perspective but for Unix it is normal. So it is just a text file but with no extension (note that the wiki link you linked to lists "external_templates" as a "file"). When doing this, be aware of this bug: lyx.org/trac/ticket/3983 . That is, if you use other external templates, copy them from the system external_templates file.
    – scottkosty
    May 9, 2015 at 18:45
  • well thanks, didn't know why I thought external_templates was a folder…
    – qleguennec
    May 9, 2015 at 19:06
  • It is understandable. "templates", "examples", "doc" are all folders in the LyX user directory, so in some sense it is strange that "external_templates" is not.
    – scottkosty
    May 9, 2015 at 19:12
  • @scottkosty Could you write up an answer?
    – TeXnician
    Dec 30, 2017 at 15:47

1 Answer 1

1

external_templates is a file. So you should remove (backup) the external_templates folder you created, and create a text file and paste your external template in it. When doing this, be aware of this bug: lyx.org/trac/ticket/3983. That is, if you use other external templates, copy them from the system external_templates file.

The external_templates file does not have an extension. That might be weird from a Windows perspective but for Unix it is normal. So it is just a text file but with no extension.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .