Search:   Help

Developers' side bar

Selected categories

Edit

Shared groups

Links

CreateFromEmptySample

Categories: Development
<< | Page list | >>

How to create external image and template files directly from within LyX.

Table of contents (hide)

  1.   1.  Description
  2.   2.  How it works
  3.   3.  Advantages
  4.   4.  Install
  5.   5.  Categories

1.  Description

A patch for LyX 2.0.0 has been proposed that allows for creating external image files and external templates directly from within LyX. A video showing how this feature works is available at: http://www.youtube.com/watch?v=eJUj70islB4.

The need for such a feature is for example witnessed on the LyX bug-tracker, under enhancement requests #5962, #5726 and #3205, dating back to year 2006.

2.  How it works

The enhancement works as follows:

  1. you can install in your LYX_HOME/samples folder (e.g., $HOME/.lyx/samples on Linux) empty image or template files for the needed application types;
  2. the empty sample files need to be named as "sample.<ext>", where "<ext>" can be any of the formats recognised by LyX (e.g., sample.dia, sample.fig, sample.odg, sample.ods, sample.gnumeric, etc.);
  3. then, an external image or template file (of the same type as one of the installed sample files) can be created as follows:
    1. Use the [Insert]->[Graphics]... menu voice;
    2. Pick a file-name of your choice (either use the browse... dialog or directly enter the file-name by typing); this is the name of the file that will contain the new image, so normally it resides in the same folder as the .lyx file you are editing;
    3. Type the [Edit/Create] button on the right; if the new file-name does not exist, then the user is warned that a new file is going to be created by copying the available empty sample;
    4. The same [Edit/Create] button, or equivalently the [Modify Externally] right-click menu voice, can be used later to edit the file by re-launching the external editor as needed.

Note that LyX will automatically manage the new contents properly, and specifically you don't need to convert the external material into an image file by yourself. Just insert the file into your LyX document, and LyX will convert it automatically to a suitable format at the time of creation of the final output (e.g., PS, PDF).

3.  Advantages

  • This way, 3rd party applications for editing external contents to be embedded within LyX documents (notably vector image editors, such as XFig, Dia, Inkscape, OpenOffice Drawings) are integrated in a better way, with a quicker way of access to them directly from within LyX.
  • As opposed to launching directly the application externally, the main advantage is that, this way, the user does not have to direct all the times the external application to the folder where the LyX document is being edited, when a new external image/template file needs to be added to it.
  • When copying and pasting from the external applications to inside the LyX window, the image is normally copied in an arbitrary format, and the editable image format is not preserved into the LyX document. With this feature, instead, you can immediately create a new editable vectorial image format, for example, and keep linking the original editable format within the LyX document.

4.  Install

  • Download the LyX sources
  • Download the patch from: http://www.lyx.org/trac/attachment/ticket/5962/lyx-create-external-material-v2.patch
  • Apply the patch with a command (from within the LyX sources folder) like: patch -p0 < lyx-create-external-material-v2.patch
  • Configure, compile LyX
  • Create empty sample files for each desired type (.dia, .fig, .svg, .odg, etc...)
  • Place them into your $HOME/.lyx/samples folder
  • Launch LyX and enjoy the new enhancement

5.  Categories

Category: Development

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2011-08-22 23:29 UTC