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