]> git.lyx.org Git - lyx.git/blob - lib/external_templates
Export external vector graphics as svg for XHTML.
[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}"
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 TemplateEnd
79
80 Template RasterImage
81         # By default, InsetExternal is displayed as a grey button
82         # containing this text.
83         GuiName "Raster image"
84         # This text is used in the External dialog.
85         # Provide enough information to explain to the user just
86         # what the template can provide him with.
87         HelpText
88                 A bitmap file.
89                 Use this template to include bitmap images of any kind.
90         HelpTextEnd
91         # ANY file type can be displayed as a RasterImage.
92         # Specifically, LyX will attempt to interrogate the file itself
93         # in order to deduce its format.
94         InputFormat "*"
95         # Globbing pattern used when browsing for a Raster image file.
96         FileFilter "*.{gif,png,jpg,bmp,pbm,ppm,tga,tif,xpm,xbm}"
97         # Set to "true" if the file represented by the template
98         # must be generated by LyX.
99         AutomaticProduction true
100         # LyX has hard-coded support for these transformations
101         Transform Rotate
102         Transform Resize
103         Transform Clip
104         Transform Extra
105         # LyX preview options:
106         # Off: LyX will not attempt to show this material on screen.
107         # Graphics: LyX will attempt to show this material as-is or via a
108         #           conversion to a showable format.
109         # InstantPreview: LyX will attempt to use the 'instant preview'
110         #                 mechanism in order to show this material.
111         Preview Graphics
112         Format LaTeX
113                 TransformOption Rotate RotationLatexOption
114                 TransformOption Resize ResizeLatexOption
115                 TransformOption Clip   ClipLatexOption
116                 TransformOption Extra  ExtraOption
117                 Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
118                 # This string is what is output to the LaTeX file.
119                 Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
120                 UpdateFormat eps
121                 UpdateResult "$$AbsPath$$Basename.eps"
122                 Requirement "graphicx"
123                 ReferencedFile latex "$$AbsPath$$Basename.eps"
124                 ReferencedFile dvi   "$$AbsPath$$Basename.eps"
125         FormatEnd
126         Format PDFLaTeX
127                 TransformOption Rotate RotationLatexOption
128                 TransformOption Resize ResizeLatexOption
129                 TransformOption Clip   ClipLatexOption
130                 TransformOption Extra  ExtraOption
131                 Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
132                 Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
133                 UpdateFormat "$$pngOrjpg"
134                 UpdateResult "$$AbsPath$$Basename.$$pngOrjpg"
135                 Requirement "graphicx"
136                 ReferencedFile pdflatex "$$AbsPath$$Basename.$$pngOrjpg"
137         FormatEnd
138         Format Ascii
139                 Product "$$Contents(\"$$AbsPath$$Basename.asc\")"
140                 UpdateFormat asciiimage
141                 UpdateResult "$$AbsPath$$Basename.asc"
142         FormatEnd
143         Format DocBook
144                 Product "<graphic fileref=\"$$AbsOrRelPathMaster$$Basename.eps\"></graphic>"
145                 UpdateFormat eps
146                 UpdateResult "$$AbsPath$$Basename.eps"
147                 ReferencedFile docbook     "$$AbsPath$$Basename.eps"
148                 ReferencedFile docbook-xml "$$AbsPath$$Basename.eps"
149         FormatEnd
150 TemplateEnd
151
152 Template VectorGraphics
153         GuiName "Vector graphics"
154         HelpText
155                 A vector graphics file.
156                 Use this template to include vector graphics of any kind.
157                 LyX will try to retain the vector properties of the image for
158                 the final output.
159                 Note that specialized templates exist for Xfig figures and Dia diagrams.
160                 The specialized templates allow to automatically use the document font in
161                 the figures, which is not possible with this general template.
162         HelpTextEnd
163         # ANY file type can be displayed as a VectorGraphics.
164         # Specifically, LyX will attempt to interrogate the file itself
165         # in order to deduce its format.
166         InputFormat "*"
167         # Globbing pattern used when browsing for a vector graphics file.
168         # xfig, dia, fen and ly are exlcuded, since we have specialized templates
169         FileFilter "*.{agr,dot,emf,eps,odg,obj,sxd,svg,svgz,tgo,pdf,wmf}"
170         AutomaticProduction true
171         # LyX has hard-coded support for these transformations
172         Transform Rotate
173         Transform Resize
174         Transform Clip
175         Transform Extra
176         Preview Graphics
177         Format LaTeX
178                 TransformOption Rotate RotationLatexOption
179                 TransformOption Resize ResizeLatexOption
180                 TransformOption Clip   ClipLatexOption
181                 TransformOption Extra  ExtraOption
182                 Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
183                 # This string is what is output to the LaTeX file.
184                 Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
185                 UpdateFormat eps
186                 UpdateResult "$$AbsPath$$Basename.eps"
187                 Requirement "graphicx"
188                 ReferencedFile latex "$$AbsPath$$Basename.eps"
189                 ReferencedFile dvi   "$$AbsPath$$Basename.eps"
190         FormatEnd
191         Format PDFLaTeX
192                 TransformOption Rotate RotationLatexOption
193                 TransformOption Resize ResizeLatexOption
194                 TransformOption Clip   ClipLatexOption
195                 TransformOption Extra  ExtraOption
196                 Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
197                 Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
198                 UpdateFormat pdf6
199                 UpdateResult "$$AbsPath$$Basename.pdf"
200                 Requirement "graphicx"
201                 ReferencedFile pdflatex "$$AbsPath$$Basename.pdf"
202         FormatEnd
203         Format Ascii
204                 Product "$$Contents(\"$$AbsPath$$Basename.asc\")"
205                 UpdateFormat asciiimage
206                 UpdateResult "$$AbsPath$$Basename.asc"
207         FormatEnd
208         Format DocBook
209                 Product "<graphic fileref=\"$$AbsOrRelPathMaster$$Basename.eps\"></graphic>"
210                 UpdateFormat eps
211                 UpdateResult "$$AbsPath$$Basename.eps"
212                 ReferencedFile docbook     "$$AbsPath$$Basename.eps"
213                 ReferencedFile docbook-xml "$$AbsPath$$Basename.eps"
214         FormatEnd
215         Format XHTML
216                 Product "<img src=\"$$AbsOrRelPathMaster$$Basename.svg\" />"
217                 UpdateFormat svg
218                 UpdateResult "$$AbsPath$$Basename.svg"
219                 ReferencedFile xhtml "$$AbsPath$$Basename.svg"
220         FormatEnd
221 TemplateEnd
222
223 Template XFig
224         GuiName "Xfig figure"
225         HelpText
226                 An Xfig figure.
227         HelpTextEnd
228         InputFormat fig
229         FileFilter "*.fig"
230         AutomaticProduction true
231         Transform Rotate
232         Transform Resize
233         Preview InstantPreview
234         Format LaTeX
235                 TransformCommand Rotate RotationLatexCommand
236                 TransformCommand Resize ResizeLatexCommand
237                 Product "$$RotateFront$$ResizeFront\\input{$$AbsOrRelPathMaster$$Basename.pstex_t}$$ResizeBack$$RotateBack"
238                 UpdateFormat pstex
239                 UpdateResult "$$AbsPath$$Basename.pstex_t"
240                 Requirement "color"
241                 Requirement "graphicx"
242                 # Preamble WarnNotFound
243                 # Preamble InputOrWarn
244                 ReferencedFile latex "$$AbsOrRelPathMaster$$Basename.pstex_t"
245                 ReferencedFile latex "$$AbsPath$$Basename.eps"
246                 ReferencedFile dvi   "$$AbsPath$$Basename.eps"
247         FormatEnd
248         Format PDFLaTeX
249                 TransformCommand Rotate RotationLatexCommand
250                 TransformCommand Resize ResizeLatexCommand
251                 Product "$$RotateFront$$ResizeFront\\input{$$AbsOrRelPathMaster$$Basename.pdftex_t}$$ResizeBack$$RotateBack"
252                 UpdateFormat pdftex
253                 UpdateResult "$$AbsPath$$Basename.pdftex_t"
254                 Requirement "color"
255                 Requirement "graphicx"
256                 # Preamble WarnNotFound
257                 # Preamble InputOrWarn
258                 ReferencedFile pdflatex "$$AbsOrRelPathMaster$$Basename.pdftex_t"
259                 ReferencedFile pdflatex "$$AbsPath$$Basename.pdf"
260         FormatEnd
261         Format Ascii
262                 Product "$$Contents(\"$$AbsPath$$Basename.asc\")"
263                 UpdateFormat asciixfig
264                 UpdateResult "$$AbsPath$$Basename.asc"
265         FormatEnd
266         Format DocBook
267                 Product "<graphic fileref=\"$$AbsOrRelPathMaster$$Basename.eps\"></graphic>"
268                 UpdateFormat eps
269                 UpdateResult "$$AbsPath$$Basename.eps"
270                 ReferencedFile docbook     "$$AbsPath$$Basename.eps"
271                 ReferencedFile docbook-xml "$$AbsPath$$Basename.eps"
272         FormatEnd
273         Format XHTML
274                 Product "<img src=\"$$AbsOrRelPathMaster$$Basename.svg\" />"
275                 UpdateFormat svg
276                 UpdateResult "$$AbsPath$$Basename.svg"
277                 ReferencedFile xhtml "$$AbsPath$$Basename.svg"
278         FormatEnd
279 TemplateEnd
280
281
282 Template ChessDiagram
283         GuiName "Chess diagram"
284         HelpText
285                 A chess position diagram.
286                 This template will use XBoard to edit the position.
287                 Use the 'File->Save Position' in XBoard to save
288                 the position that you want to display.
289                 Make sure to give it a '.fen' extension
290                 and remember to type in a relative path
291                 to the LyX document location.
292                 Within XBoard, use 'Edit->Edit Position'
293                 to enable general editing of the board.
294                 You might also check out the
295                 'Options->Test legality' option, and
296                 remember to middle and right click to
297                 insert new material in the board.
298                 In order for this to work, you have to
299                 put the bundled lyxskak.sty in a place
300                 that TeX will find it, and you will need
301                 to install the skak package from CTAN.
302         HelpTextEnd
303         InputFormat fen
304         FileFilter "*.fen"
305         AutomaticProduction true
306         Preview InstantPreview
307         Format LaTeX
308                 Product "\\loadgame{$$AbsOrRelPathMaster$$Basename}\\showboard"
309                 Requirement "chess"
310                 UpdateFormat fen
311                 UpdateResult "$$AbsPath$$Basename$$Extension"
312                 ReferencedFile latex "$$AbsPath$$Basename$$Extension"
313         FormatEnd
314         Format PDFLaTeX
315                 Product "\\loadgame{$$AbsOrRelPathMaster$$Basename}\\showboard"
316                 Requirement "chess"
317                 UpdateFormat fen
318                 UpdateResult "$$AbsPath$$Basename$$Extension"
319                 ReferencedFile pdflatex "$$AbsPath$$Basename$$Extension"
320         FormatEnd
321         Format Ascii
322                 Product "$$Contents(\"$$AbsPath$$Basename.asc\")"
323                 UpdateFormat asciichess
324                 UpdateResult "$$AbsPath$$Basename.asc"
325         FormatEnd
326         Format DocBook
327                 Product "[Chess: $$AbsOrRelPathMaster$$Basename]"
328         FormatEnd
329         Format XHTML
330                 Product "<pre>$$Contents(\"$$AbsPath$$Basename.asc\")</pre>"
331                 UpdateFormat asciichess
332                 UpdateResult "$$AbsPath$$Basename.asc"
333         FormatEnd
334 TemplateEnd
335
336
337 Template LilyPond
338         GuiName "Lilypond typeset music"
339         HelpText
340                 Sheet music typeset by GNU LilyPond,
341                 converted to .pdf or .eps for inclusion
342                 Using .eps requires at least lilypond 2.6
343                 Using .pdf requires at least lilypond 2.9
344         HelpTextEnd
345         InputFormat "lilypond"
346         FileFilter "*.ly"
347         AutomaticProduction true
348         Transform Rotate
349         Transform Resize
350         Transform Clip
351         Transform Extra
352         Preview InstantPreview
353         Format LaTeX
354                 TransformOption Rotate RotationLatexOption
355                 TransformOption Resize ResizeLatexOption
356                 TransformOption Clip   ClipLatexOption
357                 TransformOption Extra  ExtraOption
358                 Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
359                 Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
360                 UpdateFormat eps
361                 UpdateResult "$$AbsPath$$Basename.eps"
362                 Requirement "graphicx"
363                 ReferencedFile latex "$$AbsPath$$Basename.eps"
364                 ReferencedFile dvi   "$$AbsPath$$Basename.eps"
365         FormatEnd
366         Format PDFLaTeX
367                 TransformOption Rotate RotationLatexOption
368                 TransformOption Resize ResizeLatexOption
369                 TransformOption Clip   ClipLatexOption
370                 TransformOption Extra  ExtraOption
371                 Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
372                 Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
373                 UpdateFormat pdf6
374                 UpdateResult "$$AbsPath$$Basename.pdf"
375                 Requirement "graphicx"
376                 ReferencedFile pdflatex "$$AbsPath$$Basename.pdf"
377         FormatEnd
378         Format Ascii
379                 Product "[LilyPond: $$FName]"
380         FormatEnd
381         Format DocBook
382                 Product "[LilyPond: $$FName]"
383         FormatEnd
384         Format XHTML
385                 Product "<img src=\"$$AbsOrRelPathMaster$$Basename.png\" />"
386                 UpdateFormat png
387                 UpdateResult "$$AbsPath$$Basename.png"
388                 ReferencedFile xhtml "$$AbsPath$$Basename.png"
389         FormatEnd
390 TemplateEnd
391
392 Template PDFPages
393         GuiName "PDF pages"
394         HelpText
395                 Includes PDF documents, using the 'pdfpages' package.
396                 To include multiple pages, use the 'pages'-option,
397                 which must be inserted to 'Options'.
398                 Examples:
399                 * pages={x-y} (for a range of pages)
400                 * pages={x,y,z} (for specific pages)
401                 * pages=- (to include all pages)
402                 * pages=last-1 (to include all pages in reverse order)
403                 With the option 'noautoscale' the PDF pages are
404                 inserted in their original size.
405                 Read the documentation of the pdfpages package
406                 for further options and details.
407         HelpTextEnd
408         InputFormat pdf6
409         FileFilter "*.pdf"
410         AutomaticProduction true
411         Transform Rotate
412         Transform Resize
413         Transform Extra
414         Preview Graphics
415         Format LaTeX
416                 TransformOption Rotate RotationLatexOption
417                 TransformOption Resize ResizeLatexOption
418                 TransformOption Extra  ExtraOption
419                 Option Arg "[$$Extra,$$Rotate,$$Resize]"
420                 Product "\\includepdf$$Arg{$$AbsOrRelPathMaster$$Basename}"
421                 UpdateFormat pdf6
422                 UpdateResult "$$AbsPath$$Basename.pdf"
423                 Requirement "pdfpages"
424                 ReferencedFile pdflatex "$$AbsPath$$Basename.pdf"
425         FormatEnd
426         Format Ascii
427                 Product "[PDFPages: $$FName]"
428         FormatEnd
429         Format DocBook
430                 Product "[PDFPages: $$FName]"
431         FormatEnd
432         Format XHTML
433                 Product "[PDFPages: $$FName]"
434         FormatEnd
435 TemplateEnd
436
437
438 Template Date
439         GuiName "Date"
440         HelpText
441                 Today's date.
442                 Read 'info date' for more information.
443         HelpTextEnd
444         InputFormat date
445         FileFilter "*"
446         AutomaticProduction true
447         Preview Off
448         Format LaTeX
449                 Product "$$Contents(\"$$Tempname\")"
450                 UpdateFormat dateout
451                 UpdateResult "$$Tempname"
452         FormatEnd
453         Format PDFLaTeX
454                 Product "$$Contents(\"$$Tempname\")"
455                 UpdateFormat dateout
456                 UpdateResult "$$Tempname"
457         FormatEnd
458         Format Ascii
459                 Product "$$Contents(\"$$Tempname\")"
460                 UpdateFormat dateout
461                 UpdateResult "$$Tempname"
462         FormatEnd
463         Format DocBook
464                 Product "$$Contents(\"$$Tempname\")"
465                 UpdateFormat dateout
466                 UpdateResult "$$Tempname"
467         FormatEnd
468 TemplateEnd
469
470 Template Dia
471         GuiName "Dia diagram"
472         HelpText
473                 Dia diagram.
474         HelpTextEnd
475         InputFormat dia
476         FileFilter "*.dia"
477         AutomaticProduction true
478         # LyX has hard-coded support for these transformations
479         Transform Rotate
480         Transform Resize
481         Transform Clip
482         Transform Extra
483         Preview InstantPreview
484         Format LaTeX
485                 TransformOption Rotate RotationLatexOption
486                 TransformOption Resize ResizeLatexOption
487                 TransformOption Clip   ClipLatexOption
488                 TransformOption Extra  ExtraOption
489                 Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
490                 # This string is what is output to the LaTeX file.
491                 Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
492                 UpdateFormat eps
493                 UpdateResult "$$AbsPath$$Basename.eps"
494                 Requirement "graphicx"
495                 ReferencedFile latex "$$AbsPath$$Basename.eps"
496                 ReferencedFile dvi   "$$AbsPath$$Basename.eps"
497         FormatEnd
498         Format PDFLaTeX
499                 TransformOption Rotate RotationLatexOption
500                 TransformOption Resize ResizeLatexOption
501                 TransformOption Clip   ClipLatexOption
502                 TransformOption Extra  ExtraOption
503                 Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
504                 Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
505                 UpdateFormat pdf6
506                 UpdateResult "$$AbsPath$$Basename.pdf"
507                 Requirement "graphicx"
508                 ReferencedFile pdflatex "$$AbsPath$$Basename.pdf"
509         FormatEnd
510         Format Ascii
511                 Product "$$Contents(\"$$AbsPath$$Basename.asc\")"
512                 UpdateFormat asciiimage
513                 UpdateResult "$$AbsPath$$Basename.asc"
514         FormatEnd
515         Format DocBook
516                 Product "<graphic fileref=\"$$AbsOrRelPathMaster$$Basename.eps\"></graphic>"
517                 UpdateFormat eps
518                 UpdateResult "$$AbsPath$$Basename.eps"
519                 ReferencedFile docbook     "$$AbsPath$$Basename.eps"
520                 ReferencedFile docbook-xml "$$AbsPath$$Basename.eps"
521         FormatEnd
522         Format XHTML
523                 Product "<img src=\"$$AbsOrRelPathMaster$$Basename.svg\" />"
524                 UpdateFormat svg
525                 UpdateResult "$$AbsPath$$Basename.svg"
526                 ReferencedFile xhtml "$$AbsPath$$Basename.svg"
527         FormatEnd
528 TemplateEnd
529