The KLatexFormula library is a collection of formulas. It is by default divided into two tabs: the history, and the archive. The history automatically gathers all the formulas that have been evaluated, along with their style. The archive is where you can organize and store formulas for later reference or recall.
Formulas can be categorized and tagged, for organisation. In the archive, formulas with the same category will be grouped under a same label. Categories work like directory paths: you can for example store the equation of Stoke’s theorem under the category “Math/Vector Analysis”, which will place that equation under the label “Vector Analysis”, the latter being in turn placed under the label “Math”.
By default, when you assign a category and/or tags to a formula in the History tab, it is automatically copied to the Archive tab. This behavior can be changed in the klatexformula settings (which can be accessed from the main window, in expanded mode, with the “Settings” button, and then going under the “Library” tab).
The formula lists may be displayed in various view modes, namely category tree view (the default for the Archive), list view (the default for History), and icon view.
In category tree view mode, all formulas are grouped by category, in a tree-like display.
In list view mode, categories are ignored and all formulas are shown in a list. The list is by default sorted according to the date and time at which the formula was evaluated, but this can be changed by clicking on the corresponding header. Clicking on the “Preview” header will sort the list by evaluation date and time.
In icon view mode, only the equation image is shown in the pane, and the corresponding information can be seen in the right column by selecting an equation.
In all these three view modes, the icon preview size may be chosen as one of “Large”, “Medium”, or “Small”, in the view context menu (right-click in the view pane).
In list and category tree view modes, you can choose the columns that are displayed again in the context menu, under “Show/Hide Columns”.
You may choose your preferred view type for each tab by selecting the corresponding menu entry in the “Resource” menu.
The library is visually divided into tabs (among which, for example “History” and “Archive”). The formulas that have been freshly evaluated are automatically added to the “History” tab. Those that you want to organize, can be copied or moved to the “Archive” tab either by dragging and dropping them, or by cutting and pasting them, or by selecting “Copy To” or “Move To” in the context menu (mouse right-click), or even by just assigning a category or tag to them (this last behavior can be disabled in the settings).
If you want to create a new tab, select “New Sub-Resource” in the “Resource” menu by clicking the “Resources” button, or by right-clicking on the tab. This will create a new tab in the local library (also known as a sub-resource of the local library).
If you want to create a new tab, and physically store the data this tab will display in a different location than the local library, than select “Create Resource” instead, and specify where you want to store the data.
In the “Resource” menu, you can also select the following options: To open a resource file into a new tab, choose “Open Resource”. To open another tab of an already open resource, select “Open Sub-Resource”.
You may choose whether you want KLatexFormula to restore your tabs when restarting the program. This setting can be set in the Library tab of KLatexFormula’s settings dialog.
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 KLatexFormula 4.0) are the backends:
SQLite database
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.
This format greatly optimizes loading and saving time (compared to the .klf format), however big actions (cutting or pasting large parts of the library) are slower. This format is also crash-safe (since Sqlite provides high-tech database-syncing and journaling… as opposed to the .klf format where if the application crashed before being able to save, or while saving, the library data was likely to be lost).
KLF file (Legacy Format)
The Legacy back-end reads and writes .klf files that are compatible with import/export files in earlier versions of klatexformula. 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.
This format (the default for library exports) is a custom binary format in which the formula list is saved, along with their respective styles and resource information etc. This format takes time to load and save, however large operations (cutting and pasting large amounts of entries) are faster.
If klatexformula crashes while saving in this format, the file will be corrupt and all data will be lost. If klatexformula crashes before being able to save the file, then the most recent modifications will be lost.
This format was introduced back in KLatexFormula 2.1, and the file format has stayed backwards compatible since. In version 3.2.2 some meta-data is appended at the end of the file, which is ignored by previous versions of KLatexFormula, which implements resource properties such as locking the resource.
As a special case, the Legacy format 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.
The export tool is useful for example to back up your full library. It copies the contents of some resources and sub-resources (which you can select in the export dialog) to a single file.
The “Open All” tool is a convenience tool to open all sub-resources of a given resource file.
The Library as of KLatexFormula 3.2 is highly flexible, with a public API. See …………….. Devel Manual:The New Library from the Programmer Point of View.