Presenting “in-line data” with the font Sparks

Today’s project is quite curious, but nevertheless interesting. It’s main idea is to present data as small bar or dot graphs, but “in-line” and without using a graphical software, just a program with OpenType support that understands the +calt (Contextual Alternates) table. How? Just using one of the 15 fonts offered by the project

Sparks | A typeface for creating sparklines in text without code

in a program like LibreOffice Writer or XƎTEX. The result? Judge it for yourself:

The numbers outside the curly brackets will be ignored while the others, separated by commas, will be converted into “data.” We have 101 “levels” (from 0 to 100, both included) and three “styles,” each one in five “weights.”

It’s possible to enter normal text with this font, but it’s not that interesting: it’s main (let’s say, it’s only) use is to present data.

The font can also be downloaded from the project’s GitHub page.

A really curious project, isn’t it?


Side Note: this week is the second birthday of this blog! Yeah!

Using tables in WordPress

WordPress default editor does not come with options to create tables, but it’s possible to use them. Compare this

Head 1

Head 2

Head 3

Content 11

Content 12

Content 13

Content 21

Content 22

Content 23

With this one

Head 1 Head 2 Head 3
Content 11 Content 12 Content 13
Content 21 Content 22 Content 23

They look very different, isn’t it? The first one was created with Writer, formatting it there and then copy pasting the result, but to be honest it’s not exactly what it was in Writer: the HTML code is quite weird. The second table was quickly and easily created with the following on-line service

HTML Table generator

You give the formatting, then copy the generated code and paste it in the WordPress editor (HTML tab!). There you can pick any font, size, colour, anything. You can import the table content from the clipboard or from a file. Everything is really easy, so I’ll let you play with the service.

RegExp: search for integers greater than a certain value in Writer

I admit it: sometimes I make mistakes. For example, in my book about Writer there are a couple of them. For instance (thanks Miloslav for reporting it!) in page 23 there is a .dev instead of the correct .deb.

But there is another, quite amusing, error. In Chapter 18, where I talk about Regular Expressions, there is an example that shows how to find numbers between 1 and 50, but not greater. The problem with that example is that I use there the regular expression \d that was never defined in the text! It got lost in the long list of expressions!

So yes, \d is equivalent to [:digit:] and can be used to find a generic digit.

OK, because we are already here I’ll use the occasion to present another example: find an integer greater than a given number. For example, let’s find in a text any number greater than 42, but not 42.

Let’s see, to find numbers between 43 and 49 we can use

\b4[3-9]\b

That’s it, a four followed by a digit between 3 and 9. (In the book you’ll find the meaning of \b 😉 ). To find now numbers between 50 and 99 we can use

\b[5-9]\d\b

Finally, for numbers greater than 100

\b[1-9]\d{2,}\b

Now, in order to find all that at the same time, we only need a couple of vertical bars

\b4[3-9]\b|\b[5-9]\d\b|\b[1-9]\d{2,}\b

And that’s it!

Junicode Font

Originally thought of as a font for medievalists (its design is based on a digitization of a dictionary of medieval terms published in 1703-5 and using typefaces designed in the second half of the 1600), the Junicode font also includes extensive portions of the Unicode catalog  and numerous OpenType features that makes it a great typography for body text

Junicode

The bold and bold-italic “styles” have less features than the normal and italic faces (the bold-italic does not provide small caps). For me that’s not a problem, I think that bold faces are a bit overrated and overused, but if you need them, take this into account while considering the use of this font.

The font only offers Unicode fractions. Greek support was separated from the main font on version 1, by providing a new font called FoulisGreek

For those using XƎTEX, two notes:

  • At the moment of writing this article, the Junicode package in CTAN repository is quite outdated, so it’s recommended to manually install the last release instead of using the package provided by your LATEX distribution
  • The package includes a file with information for the microtype package, setting a personalized protrusion pattern.

Junicode is a really well designed and elegant “old style” typeface with a free license. Full of really interesting OpenType features, this is a “must have” font that can be used on long texts.

Recreate LibO’s “quickstart” in a KDE Plasma desktop (Linux)

Note: If you have written to me using the contact form and in your inbox you have not found an answer, please check the spam folder. Email providers are a bit paranoid these days…


During the release cycle of version 6, LibreOffice eliminated for good the “quickstarter,” a small applet that sat on the desktop’s system tray, offering a menu with several options.

Originally, that small applet was created because, in the old OOo times, the application start was painfully slow, so it was though that a “partial start” during system load was a good idea. I mean, some big companies still do that… but I’m digressing.

One of the (many!) good things in LibO development is a general speed up in the application, specially during start-up, so the quickstarter lost its usefulness, right?

Well, maybe. Of course, loading the whole thing in memory even when not in use is a bad idea, but the quickstarted offered some small advantages like starting with the list of templates instead of the list of recent documents.

Today I’ll show to all Linux+Plasma users how to recover the “good bits” of the quickstarter. Surely the same can be done on other desktop environments… but I don’t use them.

First of all, a warning: all screenshots will be in Spanish as that’s the language of my desktop. That also mean that the instructions I provide could be named in a slightly different way on your desktop, so you need to carefully check the paths.

Now, we need to create a new folder that can be called “LibreOffice Fast.” Within that folder, with a right click → New → Link to Application we’ll get a menu to create a generic “desktop” file. With that file we can start to build our “custom quickstarter.” For example, writing in the Application tab the following instruction

libreoffice --writer %U

Writer will be started, while

libreoffice --draw %U

will start Draw.

NOTE 1: Yes, I know it’s possible to drag and drop the corresponding element from the application menu, but as we’ll see bellow it’s better to create a new link from scratch.

NOTE 2: If you’re interested in the meaning of the “%U” thing, check desktop file specification.

Up to here, quite easy, but how can we call the template manager?  Just by using

libreoffice .uno:NewDoc

And if we want the menu to open an existing file? We can use

libreoffice .uno:Open

This “.uno” instructions use LibO’s “API” language to perform different tasks and are part of the macro programming language, of which I know nothing about so, don’t ask me about them!

Now, on our Plasma desktop we need to unlock the graphical elements and add, to any panel, a “folder view” widget.

Now we only need to set that folderview widget to point to the “LibreOffice Fast” folder and there we’ll see all the application links we created… all of them showing the .desktop file extension, which is quite ugly. No problem! With a simple right click on each file we can change the file name, eliminating the file extension: our Plasma desktop will identify them without problems.

And here we find the reason to not use the menu access that come with LibO: it seems they are badly formatted and when you delete the file extension Plasma stops recognizing them as quick access files. The .desktop files created from Plasma do not have that problem and they just work with or without file extension:

Done!

Summer!

It’s time for the traditional mid year stop. Dear reader, if you live in the northern hemisphere don’t forget to use solar screen and keep yourself hydrated (no, beer does not count: alcohol do exactly the opposite of hydration) while if you live in the souther hemisphere, coat and gloves that getting cold is always a bad idea.

I’ll be back on September 9. Until then, have a nice holiday!

Writer: “Hanging” numbers for footnotes and headings

The idea is to get the automated numbering for headings (for example, of Level 1) and footnotes “hanging” on the left margin, as you can see on the following screenshots (I’d to activate the non-printing characters to see the margins… oh well)

As you may imagine, these tricks have their stories, so let’s tackle one at a time.

Footnote numbers in the margin

And because we are already here, let align those numbers “to the right.”

First, we need to go to the Footnote paragraph style. In the Indent and Spacing tab, for Indents we need to set the space before text to zero, but in the First Line we need to set a negative value, big enough to provide space for the numbers, let’s say −1 cm.

Now we press Apply and move to the Tab tab (silly name for a tab… tab… oh well). There we need to define two tabs, the first one in −0,6 cm and aligned to the right and the second one  at 0 cm and aligned to the left. Apply the last changes too and close the dialogue to go to Tools → Footnotes and Endnotes → Footnotes tab, where for the automated numbering we need to type \t in both, the Before and After fields: this way Writer will insert the needed tab-stops (I go in more details about all this stuff to align the footnote numbering in my book).

This part is done.

Heading numbering in the margin

Here everything is a bit easier, but not necessarily more clear. Let’s see. We need to go to Tools → Chapter Numbering and in the Numbering tab pick the correct numbering scheme, to then add in the separator, After a couple of spaces. Now, in the Position tab we need to set everything as in the second screenshot: everything aligned to zero, the number alignment “to the right,” the numbering followed by “nothing” and the indent set to zero.

Nothing else to do.