]> git.lyx.org Git - lyx.git/blob - lib/external_templates
Fine tune AddToToc options for Sweave, Knitr
[lyx.git] / lib / external_templates
1 #
2 # file external_templates
3 # This file is part of LyX, the document processor.
4 # Licence details can be found in the file COPYING.
5 #
6 # author Asger Alstrup Nielsen
7 # author Angus Leeming
8 # author Johnathan Burchill
9 #
10 # Full author contact details are available in file CREDITS.
11
12 # This file contains the definitions of those External Templates that are
13 # part of the official LyX distribution.
14 # Feel free to create your own External Templates, storing them in
15 # .lyx/external_templates
16 # Note that a user-defined external_templates file would replace this
17 # definition. Thus, if you would like to keep the external templates defined
18 # in this file, please copy this file and add on futher external templates
19 # to the end. For more information, see http://www.lyx.org/trac/ticket/3983.
20
21
22 PreambleDef WarnNotFound
23         %% Print a warning encased in an fbox.
24         \def\lyxstripprefix#1>{}
25         \newcommand{\warnNotFound}[1]{%
26                 \def\lyxtempfilename{#1}%
27                 \fbox{Could not find
28                         \ttfamily\expandafter\lyxstripprefix\meaning\lyxtempfilename!}%
29                 \typeout{Could not find \lyxtempfilename!}%
30         }
31 PreambleDefEnd
32
33
34 PreambleDef InputOrWarn
35         %% Input the file if it exists, using \input, else print a warning
36         \newcommand{\inputOrWarn}[1]{%
37                 \IfFileExists{#1}{\input{#1}}{\warnNotFound{#1}}}
38 PreambleDefEnd
39
40 Template GnumericSpreadsheet
41         GuiName "Spreadsheet"
42         HelpText
43                 A spreadsheet made with Gnumeric, LibreOffice, OpenOffice or Excel.
44                 It imports as a multi-page table, so any length
45                 is ok. Excessive width could be a problem.
46                 The gnumeric software is necessary for conversion,
47                 both for gnumeric and excel files.
48         HelpTextEnd
49         InputFormat "gnumeric"
50         FileFilter "*.{gnumeric,ods,xls,xlsx}"
51         AutomaticProduction true
52         Format LaTeX
53                 Product "\\def\\inputGnumericTable{}\\input{$$AbsOrRelPathMaster$$Basename.tex}"
54                 UpdateFormat latex
55                 UpdateResult "$$AbsPath$$Basename.tex"
56                 Requirement "color"
57                 Requirement "array"
58                 Requirement "longtable"
59                 Requirement "calc"
60                 Requirement "multirow"
61                 Requirement "hhline"
62                 Requirement "ifthen"
63                 ReferencedFile latex "$$AbsOrRelPathMaster$$Basename.tex"
64                 FormatEnd
65         Format PDFLaTeX
66                 Product "\\def\\inputGnumericTable{}\\input{$$AbsOrRelPathMaster$$Basename.tex}"
67                 UpdateFormat latex
68                 UpdateResult "$$AbsPath$$Basename.tex"
69                 Requirement "color"
70                 Requirement "array"
71                 Requirement "longtable"
72                 Requirement "calc"
73                 Requirement "multirow"
74                 Requirement "hhline"
75                 Requirement "ifthen"
76                 ReferencedFile pdflatex "$$AbsOrRelPathMaster$$Basename.tex"
77         FormatEnd
78         Format Ascii
79                 Product "[Spreadsheet: $$FName]"
80         FormatEnd
81         Format DocBook
82                 Product "[Spreadsheet: $$FName]"
83         FormatEnd
84         Format XHTML
85                 Product "$$Contents(\"$$AbsPath$$Basename.html\")</p>"
86                 UpdateFormat html_table
87                 UpdateResult "$$AbsPath$$Basename.html"
88         FormatEnd
89 TemplateEnd
90
91 Template RasterImage
92         # By default, InsetExternal is displayed as a grey button
93         # containing this text.
94         GuiName "Raster image"
95         # This text is used in the External dialog.
96         # Provide enough information to explain to the user just
97         # what the template can provide him with.
98         HelpText
99                 A bitmap file.
100                 Use this template to include bitmap images of any kind.
101         HelpTextEnd
102         # ANY file type can be displayed as a RasterImage.
103         # Specifically, LyX will attempt to interrogate the file itself
104         # in order to deduce its format.
105         InputFormat "*"
106         # Globbing pattern used when browsing for a Raster image file.
107         FileFilter "*.{gif,png,jpg,bmp,pbm,ppm,tga,tif,xpm,xbm}"
108         # Set to "true" if the file represented by the template
109         # must be generated by LyX.
110         AutomaticProduction true
111         # LyX has hard-coded support for these transformations
112         Transform Rotate
113         Transform Resize
114         Transform Clip
115         Transform Extra
116         # LyX preview options:
117         # Off: LyX will not attempt to show this material on screen.
118         # Graphics: LyX will attempt to show this material as-is or via a
119         #           conversion to a showable format.
120         # InstantPreview: LyX will attempt to use the 'instant preview'
121         #                 mechanism in order to show this material.
122         Preview Graphics
123         Format LaTeX
124                 TransformOption Rotate RotationLatexOption
125                 TransformOption Resize ResizeLatexOption
126                 TransformOption Clip   ClipLatexOption
127                 TransformOption Extra  ExtraOption
128                 Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
129                 # This string is what is output to the LaTeX file.
130                 Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
131                 UpdateFormat eps
132                 UpdateResult "$$AbsPath$$Basename.eps"
133                 Requirement "graphicx"
134                 ReferencedFile latex "$$AbsPath$$Basename.eps"
135                 ReferencedFile dvi   "$$AbsPath$$Basename.eps"
136         FormatEnd
137         Format PDFLaTeX
138                 TransformOption Rotate RotationLatexOption
139                 TransformOption Resize ResizeLatexOption
140                 TransformOption Clip   ClipLatexOption
141                 TransformOption Extra  ExtraOption
142                 Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
143                 Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
144                 UpdateFormat "$$pngOrjpg"
145                 UpdateResult "$$AbsPath$$Basename.$$pngOrjpg"
146                 Requirement "graphicx"
147                 ReferencedFile pdflatex "$$AbsPath$$Basename.$$pngOrjpg"
148         FormatEnd
149         Format Ascii
150                 Product "[RasterImage: $$FName]"
151         FormatEnd
152         Format DocBook
153                 Product "<graphic fileref=\"$$AbsOrRelPathMaster$$Basename.eps\"></graphic>"
154                 UpdateFormat eps
155                 UpdateResult "$$AbsPath$$Basename.eps"
156                 ReferencedFile docbook     "$$AbsPath$$Basename.eps"
157                 ReferencedFile docbook-xml "$$AbsPath$$Basename.eps"
158         FormatEnd
159         Format XHTML
160                 Product "<img src=\"$$AbsOrRelPathMaster$$Basename.png\" />"
161                 UpdateFormat png
162                 UpdateResult "$$AbsPath$$Basename.png"
163                 ReferencedFile xhtml "$$AbsPath$$Basename.png"
164         FormatEnd
165 TemplateEnd
166
167 Template VectorGraphics
168         GuiName "Vector graphics"
169         HelpText
170                 A vector graphics file.
171                 Use this template to include vector graphics of any kind.
172                 LyX will try to retain the vector properties of the image for
173                 the final output.
174                 Note that specialized templates exist for Xfig figures and Dia diagrams.
175                 The specialized templates allow to automatically use the document font in
176                 the figures, which is not possible with this general template.
177         HelpTextEnd
178         # ANY file type can be displayed as a VectorGraphics.
179         # Specifically, LyX will attempt to interrogate the file itself
180         # in order to deduce its format.
181         InputFormat "*"
182         # Globbing pattern used when browsing for a vector graphics file.
183         # xfig, dia, fen and ly are exlcuded, since we have specialized templates
184         FileFilter "*.{agr,dot,emf,eps,odg,obj,sxd,svg,svgz,tgo,pdf,wmf}"
185         AutomaticProduction true
186         # LyX has hard-coded support for these transformations
187         Transform Rotate
188         Transform Resize
189         Transform Clip
190         Transform Extra
191         Preview Graphics
192         Format LaTeX
193                 TransformOption Rotate RotationLatexOption
194                 TransformOption Resize ResizeLatexOption
195                 TransformOption Clip   ClipLatexOption
196                 TransformOption Extra  ExtraOption
197                 Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
198                 # This string is what is output to the LaTeX file.
199                 Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
200                 UpdateFormat eps
201                 UpdateResult "$$AbsPath$$Basename.eps"
202                 Requirement "graphicx"
203                 ReferencedFile latex "$$AbsPath$$Basename.eps"
204                 ReferencedFile dvi   "$$AbsPath$$Basename.eps"
205         FormatEnd
206         Format PDFLaTeX
207                 TransformOption Rotate RotationLatexOption
208                 TransformOption Resize ResizeLatexOption
209                 TransformOption Clip   ClipLatexOption
210                 TransformOption Extra  ExtraOption
211                 Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
212                 Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
213                 UpdateFormat pdf6
214                 UpdateResult "$$AbsPath$$Basename.pdf"
215                 Requirement "graphicx"
216                 ReferencedFile pdflatex "$$AbsPath$$Basename.pdf"
217         FormatEnd
218         Format Ascii
219                 Product "[VectorGraphics: $$FName]"
220         FormatEnd
221         Format DocBook
222                 Product "<graphic fileref=\"$$AbsOrRelPathMaster$$Basename.eps\"></graphic>"
223                 UpdateFormat eps
224                 UpdateResult "$$AbsPath$$Basename.eps"
225                 ReferencedFile docbook     "$$AbsPath$$Basename.eps"
226                 ReferencedFile docbook-xml "$$AbsPath$$Basename.eps"
227         FormatEnd
228         Format XHTML
229                 Product "<img src=\"$$AbsOrRelPathMaster$$Basename.svg\" />"
230                 UpdateFormat svg
231                 UpdateResult "$$AbsPath$$Basename.svg"
232                 ReferencedFile xhtml "$$AbsPath$$Basename.svg"
233         FormatEnd
234 TemplateEnd
235
236 Template XFig
237         GuiName "Xfig figure"
238         HelpText
239                 An Xfig figure.
240         HelpTextEnd
241         InputFormat fig
242         FileFilter "*.fig"
243         AutomaticProduction true
244         Transform Rotate
245         Transform Resize
246         Preview InstantPreview
247         Format LaTeX
248                 TransformCommand Rotate RotationLatexCommand
249                 TransformCommand Resize ResizeLatexCommand
250                 Product "$$RotateFront$$ResizeFront\\input{$$AbsOrRelPathMaster$$Basename.pstex_t}$$ResizeBack$$RotateBack"
251                 UpdateFormat pstex
252                 UpdateResult "$$AbsPath$$Basename.pstex_t"
253                 Requirement "color"
254                 Requirement "graphicx"
255                 # Preamble WarnNotFound
256                 # Preamble InputOrWarn
257                 ReferencedFile latex "$$AbsOrRelPathMaster$$Basename.pstex_t"
258                 ReferencedFile latex "$$AbsPath$$Basename.eps"
259                 ReferencedFile dvi   "$$AbsPath$$Basename.eps"
260         FormatEnd
261         Format PDFLaTeX
262                 TransformCommand Rotate RotationLatexCommand
263                 TransformCommand Resize ResizeLatexCommand
264                 Product "$$RotateFront$$ResizeFront\\input{$$AbsOrRelPathMaster$$Basename.pdftex_t}$$ResizeBack$$RotateBack"
265                 UpdateFormat pdftex
266                 UpdateResult "$$AbsPath$$Basename.pdftex_t"
267                 Requirement "color"
268                 Requirement "graphicx"
269                 # Preamble WarnNotFound
270                 # Preamble InputOrWarn
271                 ReferencedFile pdflatex "$$AbsOrRelPathMaster$$Basename.pdftex_t"
272                 ReferencedFile pdflatex "$$AbsPath$$Basename.pdf"
273         FormatEnd
274         Format Ascii
275                 Product "[XFig: $$FName]"
276         FormatEnd
277         Format DocBook
278                 Product "<graphic fileref=\"$$AbsOrRelPathMaster$$Basename.eps\"></graphic>"
279                 UpdateFormat eps
280                 UpdateResult "$$AbsPath$$Basename.eps"
281                 ReferencedFile docbook     "$$AbsPath$$Basename.eps"
282                 ReferencedFile docbook-xml "$$AbsPath$$Basename.eps"
283         FormatEnd
284         Format XHTML
285                 Product "<img src=\"$$AbsOrRelPathMaster$$Basename.svg\" />"
286                 UpdateFormat svg
287                 UpdateResult "$$AbsPath$$Basename.svg"
288                 ReferencedFile xhtml "$$AbsPath$$Basename.svg"
289         FormatEnd
290 TemplateEnd
291
292
293 Template Inkscape
294         GuiName "Inkscape figure"
295         HelpText
296                 An Inkscape figure.
297                 This template should work flawlessly with Inkscape 0.48. 
298                 For Inkscape 0.91, there is a (reported) bug in the 
299                 LaTeX + PDF output which makes a workaround necessary, 
300                 see Embedded Objects manual.
301                 Note that using this template automatically uses the 
302                 document text in the image (like with the Xfig template).
303         HelpTextEnd
304         InputFormat svg
305         FileFilter "*.svg"
306         AutomaticProduction true
307         Transform Rotate
308         Preview InstantPreview
309         Format PDFLaTeX
310                 TransformCommand Rotate RotationLatexCommand
311                 # Resize is not desirable here, as fonts are sized to surrounding LaTeX font
312                 Product "$$RotateFront\\input{$$AbsOrRelPathMaster$$Basename.pdf_tex}$$RotateBack"
313                 UpdateFormat pdftex
314                 UpdateResult "$$AbsPath$$Basename.pdf_tex"
315                 Requirement "color"
316                 Requirement "graphicx"
317                 # Preamble WarnNotFound
318                 # Preamble InputOrWarn
319                 ReferencedFile pdflatex "$$AbsOrRelPathMaster$$Basename.pdf_tex"
320                 ReferencedFile pdflatex "$$AbsPath$$Basename.pdf"
321         FormatEnd
322         Format LaTeX
323                 TransformCommand Rotate RotationLatexCommand
324                 Product "$$RotateFront\\input{$$AbsOrRelPathMaster$$Basename.eps_tex}$$RotateBack"
325                 UpdateFormat pstex
326                 UpdateResult "$$AbsPath$$Basename.eps_tex"
327                 Requirement "color"
328                 Requirement "graphicx"
329                 # Preamble WarnNotFound
330                 # Preamble InputOrWarn
331                 ReferencedFile latex "$$AbsOrRelPathMaster$$Basename.eps_tex"
332                 ReferencedFile latex "$$AbsPath$$Basename.eps"
333                 ReferencedFile dvi   "$$AbsPath$$Basename.eps"
334         FormatEnd
335 TemplateEnd
336
337
338 Template ChessDiagram
339         GuiName "Chess diagram"
340         HelpText
341                 A chess position diagram.
342                 This template will use XBoard to edit the position.
343                 Use the 'File->Save Position' in XBoard to save
344                 the position that you want to display.
345                 Make sure to give it a '.fen' extension
346                 and remember to type in a relative path
347                 to the LyX document location.
348                 Within XBoard, use 'Edit->Edit Position'
349                 to enable general editing of the board.
350                 You might also check out the
351                 'Options->Test legality' option, and
352                 remember to middle and right click to
353                 insert new material in the board.
354                 In order for this to work, you have to
355                 put the bundled lyxskak.sty in a place
356                 that TeX will find it, and you will need
357                 to install the skak package from CTAN.
358         HelpTextEnd
359         InputFormat fen
360         FileFilter "*.fen"
361         AutomaticProduction true
362         Preview InstantPreview
363         Format LaTeX
364                 Product "\\loadgame{$$AbsOrRelPathMaster$$Basename}\\showboard"
365                 Requirement "chess"
366                 UpdateFormat fen
367                 UpdateResult "$$AbsPath$$Basename$$Extension"
368                 ReferencedFile latex "$$AbsPath$$Basename$$Extension"
369         FormatEnd
370         Format PDFLaTeX
371                 Product "\\loadgame{$$AbsOrRelPathMaster$$Basename}\\showboard"
372                 Requirement "chess"
373                 UpdateFormat fen
374                 UpdateResult "$$AbsPath$$Basename$$Extension"
375                 ReferencedFile pdflatex "$$AbsPath$$Basename$$Extension"
376         FormatEnd
377         Format Ascii
378                 Product "$$Contents(\"$$AbsPath$$Basename.asc\")"
379                 UpdateFormat asciichess
380                 UpdateResult "$$AbsPath$$Basename.asc"
381         FormatEnd
382         Format DocBook
383                 Product "[Chess: $$AbsOrRelPathMaster$$Basename]"
384         FormatEnd
385         Format XHTML
386                 Product "<pre>$$Contents(\"$$AbsPath$$Basename.asc\")</pre>"
387                 UpdateFormat asciichess
388                 UpdateResult "$$AbsPath$$Basename.asc"
389         FormatEnd
390 TemplateEnd
391
392
393 Template LilyPond
394         GuiName "Lilypond typeset music"
395         HelpText
396                 Sheet music typeset by GNU LilyPond,
397                 converted to .pdf or .eps for inclusion
398                 Using .eps requires at least lilypond 2.6
399                 Using .pdf requires at least lilypond 2.9
400         HelpTextEnd
401         InputFormat "lilypond"
402         FileFilter "*.ly"
403         AutomaticProduction true
404         Transform Rotate
405         Transform Resize
406         Transform Clip
407         Transform Extra
408         Preview InstantPreview
409         Format LaTeX
410                 TransformOption Rotate RotationLatexOption
411                 TransformOption Resize ResizeLatexOption
412                 TransformOption Clip   ClipLatexOption
413                 TransformOption Extra  ExtraOption
414                 Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
415                 Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
416                 UpdateFormat eps
417                 UpdateResult "$$AbsPath$$Basename.eps"
418                 Requirement "graphicx"
419                 ReferencedFile latex "$$AbsPath$$Basename.eps"
420                 ReferencedFile dvi   "$$AbsPath$$Basename.eps"
421         FormatEnd
422         Format PDFLaTeX
423                 TransformOption Rotate RotationLatexOption
424                 TransformOption Resize ResizeLatexOption
425                 TransformOption Clip   ClipLatexOption
426                 TransformOption Extra  ExtraOption
427                 Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
428                 Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
429                 UpdateFormat pdf6
430                 UpdateResult "$$AbsPath$$Basename.pdf"
431                 Requirement "graphicx"
432                 ReferencedFile pdflatex "$$AbsPath$$Basename.pdf"
433         FormatEnd
434         Format Ascii
435                 Product "[LilyPond: $$FName]"
436         FormatEnd
437         Format DocBook
438                 Product "[LilyPond: $$FName]"
439         FormatEnd
440         Format XHTML
441                 Product "<img src=\"$$AbsOrRelPathMaster$$Basename.png\" />"
442                 UpdateFormat png
443                 UpdateResult "$$AbsPath$$Basename.png"
444                 ReferencedFile xhtml "$$AbsPath$$Basename.png"
445         FormatEnd
446 TemplateEnd
447
448 Template PDFPages
449         GuiName "PDF pages"
450         HelpText
451                 Includes PDF documents, using the 'pdfpages' package.
452                 To include multiple pages, use the 'pages'-option,
453                 which must be inserted to 'Options'.
454                 Examples:
455                 * pages={x-y} (for a range of pages)
456                 * pages={x,y,z} (for specific pages)
457                 * pages=- (to include all pages)
458                 * pages=last-1 (to include all pages in reverse order)
459                 With the option 'noautoscale' the PDF pages are
460                 inserted in their original size.
461                 Read the documentation of the pdfpages package
462                 for further options and details.
463         HelpTextEnd
464         InputFormat pdf6
465         FileFilter "*.pdf"
466         AutomaticProduction true
467         Transform Rotate
468         Transform Resize
469         Transform Extra
470         Preview Graphics
471         Format LaTeX
472                 TransformOption Rotate RotationLatexOption
473                 TransformOption Resize ResizeLatexOption
474                 TransformOption Extra  ExtraOption
475                 Option Arg "[$$Extra,$$Rotate,$$Resize]"
476                 Product "\\includepdf$$Arg{$$AbsOrRelPathMaster$$Basename}"
477                 UpdateFormat pdf6
478                 UpdateResult "$$AbsPath$$Basename.pdf"
479                 Requirement "pdfpages"
480                 ReferencedFile pdflatex "$$AbsPath$$Basename.pdf"
481         FormatEnd
482         Format Ascii
483                 Product "[PDFPages: $$FName]"
484         FormatEnd
485         Format DocBook
486                 Product "[PDFPages: $$FName]"
487         FormatEnd
488         Format XHTML
489                 Product "[PDFPages: $$FName]"
490         FormatEnd
491 TemplateEnd
492
493
494 Template Dia
495         GuiName "Dia diagram"
496         HelpText
497                 Dia diagram.
498         HelpTextEnd
499         InputFormat dia
500         FileFilter "*.dia"
501         AutomaticProduction true
502         # LyX has hard-coded support for these transformations
503         Transform Rotate
504         Transform Resize
505         Transform Clip
506         Transform Extra
507         Preview InstantPreview
508         Format LaTeX
509                 TransformOption Rotate RotationLatexOption
510                 TransformOption Resize ResizeLatexOption
511                 TransformOption Clip   ClipLatexOption
512                 TransformOption Extra  ExtraOption
513                 Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
514                 # This string is what is output to the LaTeX file.
515                 Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
516                 UpdateFormat eps
517                 UpdateResult "$$AbsPath$$Basename.eps"
518                 Requirement "graphicx"
519                 ReferencedFile latex "$$AbsPath$$Basename.eps"
520                 ReferencedFile dvi   "$$AbsPath$$Basename.eps"
521         FormatEnd
522         Format PDFLaTeX
523                 TransformOption Rotate RotationLatexOption
524                 TransformOption Resize ResizeLatexOption
525                 TransformOption Clip   ClipLatexOption
526                 TransformOption Extra  ExtraOption
527                 Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
528                 Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
529                 UpdateFormat pdf6
530                 UpdateResult "$$AbsPath$$Basename.pdf"
531                 Requirement "graphicx"
532                 ReferencedFile pdflatex "$$AbsPath$$Basename.pdf"
533         FormatEnd
534         Format Ascii
535                 Product "[Dia: $$FName]"
536         FormatEnd
537         Format DocBook
538                 Product "<graphic fileref=\"$$AbsOrRelPathMaster$$Basename.eps\"></graphic>"
539                 UpdateFormat eps
540                 UpdateResult "$$AbsPath$$Basename.eps"
541                 ReferencedFile docbook     "$$AbsPath$$Basename.eps"
542                 ReferencedFile docbook-xml "$$AbsPath$$Basename.eps"
543         FormatEnd
544         Format XHTML
545                 Product "<img src=\"$$AbsOrRelPathMaster$$Basename.svg\" />"
546                 UpdateFormat svg
547                 UpdateResult "$$AbsPath$$Basename.svg"
548                 ReferencedFile xhtml "$$AbsPath$$Basename.svg"
549         FormatEnd
550 TemplateEnd
551