KLATEXFORMULA
Home
About
Downloads
Screen Shots
Wiki (Manuals)
News

User Manual:The new library concept (KLF version 3.2)

From KLFWiki

Jump to: navigation, search

Contents

Introduction

The library in KLatexFormula is the structure that allows storing previously generated formulas, archiving them, and recalling them for use again.

Early versions of KLatexFormula (1.x-2.0) had only a history list; the true concept of library was introduced in version 2.1.

For version 3.2, its concept was re-thought and completely re-written, to gain more flexibility. For the normal user the functionality has not radically changed, the changes essentially consisting in a remodeling of the internal structure, allowing for potentially much more possibilities. This article presents the main new features.

Many of the new features are (as of now) only of interest for programmers, until plugins have been written and possibly klatexformula itself has been adapted to take more advantage of the new flexibility offered.

Using the Library

The library can be used as one would expect; freshly generated latex formulas are added to the History, the user can tag/categorize a formula by filling the information in the fields on the right, formulas can be copied and pasted or dragged and dropped to various other locations in the library, etc.

To create a new tab, you will want to create a new sub-resource of the local library (creating a new resource would mean storing the formulas in a different location; you can do that too if you like, you will be prompted for a file name). You can do this by selecting the "New Sub-Resources" from the "Resources" menu next to the tabs.

You may choose between three view types ("Resources" menu -> "View Type"):

  • Category Tree view, default for "Archive" sub-resource, shows a tree with categorized formulas
  • List view, default for "History", just shows a list of all the formulas
  • Icon view, displays formulas without details

The Library as Interface to Different Back-Ends

Prior to version 3.2, the library was self-stored in a local, private directory, in an internal format. The properties latex code, category, tags, preview image, and style were stored for each formula.

The new library, however, is structured as an interface to view lists of formulas that can be provided by possibly different back-ends from possibly different sources. That is, we have separated the job of getting the formulas from somewhere (local storage, over the net on a remote database, etc.) from the job of displaying them.

Formulas belong to a resource (ie. the location where they come from, for ex. a given file) and possibly a sub-resource (sub-resource: a logical separation of formulas within a resource, for ex. "History" and "Archive" in the local library).

Formulas have the following properties set: latex code, category, tags, preview image, preview image size, and style. However it is possible (from the programmer's point of view) to add more properties to formulas.

Currently implemented (as of 3.2) are the backends:

  • SQLite database
  • KLF file (Legacy Format)

The SQLite database back-end stores its formulas in a sqlite3 database file, that has the characteristic suffix filename.klf.db. Different sub-resources are stored into different SQL tables. You can open the file in an sqlite prompt to get an idea. The files generated by this back-end can be treated like normal files, they for example can be moved, sent by e-mail, or deleted. The internally-stored "Local Library" uses the SQLite back-end on a privately-stored database file.

The Legacy back-end reads and writes .klf files that are compatible with import/export files in klatexformula versions 2.1-3.1. The file format is more appropriate for storing a small number of entries, however it is less efficient for handling large libraries. This back-end also ensures compatibility with previous versions of KLatexFormula.

The Legacy back-end is also capable of reading/writing private history and library file formats, that were privately stored in ~/.klatexformula/ by versions of klatexformula up to 2.0 and 3.1, respectively.

Note that upon initializing the library when first running KLatexFormula 3.2, it will correctly detect and import libraries from prior versions.

See also User Manual:Library File Formats.

From the Programmer Point of View

The programmer point of view to the new library framework is explained in the Developer's Manual at Devel Manual:The New Library from the Programmer Point of View.