SVGs are inline elements

So, I just found out that SVG elements are displayed inline by default. This has the “strange” effect that you get an overflow (which is not apparent, e.g., from the output of the Chrome debugging view) when you try to fill a parent element with a SVG. The following code shows how a scroll bar shows up for “no reason”:

To solve this issue all you have to do is to change the display  attribute of the SVG, e.g., to  block :

Try it yourself here: https://jsfiddle.net/mgbckr/ebvso38v/

The reason for this is nicely explained in a StackOverflow post like this:

inline or inline-block elements are called “inline” because they are intended to be laid out amongst lines of text. So, wherever they appear, space is reserved for the “descent”, which is the area underneath a line of text where the dangly parts of lowercase g’s, j’s, and y’s go.

 

Directly accessing PDFs from BibSonomy in TeXlipse

I am using BibSonomy for my for managing my references and TeXlipse as my LaTeX editor. While the latter is arguably a little outdated, it still works well and provides some features which other editors seem to lack (e.g., partial compilation not supported by TeXstudio or TeXmaker). Anyways, what I wanted was a way to directly access my PDFs from TeXlipse. It turned out there is an easy (if hacky) way of achieving this (of course there are other, cleaner ways such as writing an extension or plug into the existing BibSonomy extension). So here is what is possible now:

Highlight the Bib-Key (such as becker2016sparktrails) and hit F9 (or any custom shortcut). Voilà the PDF opens up.

As I mentioned the process to achieve this is a little hacky, and has some caveats:

  1. It is based on the External Tools functionality built into Eclipse, i.e., we take advantage of the shortcut  (F9) for the last used external tool meaning that if we use another external tool, we need to manually run our “Open PDF” external tool once, before the (F9) shortcut works again.
  2. We need to manually trigger the process of downloading the PDFs from BibSonomy (which need to be stored there in the first place, obviously).

Nevertheless, I found the process quite useful, so here is how to do it:

Howto

We will store our PDFs in a folder within our LaTeX project. I use build/papers . Then we use an external tool which uses the currently selected Bib-Key to open the appropriate PDF.

Downloading PDFs

For downloading the PDFs I use a Python 3 script which I have placed into a folder in my LaTeX project. I call this folder build . Paper are downloaded to build/papers . The python script is called as follows:

Here is the Python 3 source code. Note that this code currently only supports downloading up to 999 publications due to limitations in the BibSonomy API. This could be fixed by implementing a recursive downloading procedure.

 

Open PDFs

The configuration of the external tool ( Run -> External Tools -> External Tools Configuration ) is pretty easy, here my configuration using Okular as PDF viewer:

To configure a shortcut for this external tool, we use the Key Run Last Launched External Tool , which I set to F9. Here is a screenshot of my config:

Future Work

Here is some future work which may prove interesting, but I will probably never come around to do 😉

  • Shortcuts for specific external tools (probably needs an extension) in order to replace the usage of the “last used external tool” key
  • An extension for automatically downloading missing PDFs since we currently need to start this process by hand
  • Extending the already existing BibSonomy plug-in for TeXlipse to create an integrated experience
  • Adding something like this to TeXstudio or TeXmaker via JavaScript extension points, in order to support more recent TeX-editors

Power-law, Pareto, Zipf and Scale-Free distributions

I did some related work on human mobility these days and came across the terms of Power-Law, Pareto, Zipf’s and Scale-Free distributions all the time. And, shame on me, I did not know the “difference”. Indeed, it turned out that all these notions are words for the same thing as explained by

Power laws, Pareto distributions and Zipf’s law
M. Newman. Contemporary physics46 (5): 323-351 (2005)

In particular it says about the power-law, Zipf’s law and the Pareto distribution:

Since power-law cumulative distributions imply a powerlaw form for p(x), “Zipf’s law” and “Pareto distribution” are effectively synonymous with “power-law distribution”.

With regard to the scale-free aspect of power-law, it says:

A power-law distribution is also sometimes called a scale-free distribution. Why? Because a power law is the only distribution that is the same whatever scale we look at it on.

And, finally, a little fun fact:

Zipf’s law and the Pareto distribution differ from one another in the way the cumulative distribution is plotted—Zipf made his plots with x on the horizontal axis and P(x) on the vertical one; Pareto did it the other way around. This causes much confusion in the literature, but the data depicted in the plots are of course identical.

Google: transparent and in the academic realm

 

[…] we believe the issue of advertising causes enough mixed incentives that it is crucial to have a competitive search engine [Google] that is transparent and in the academic realm.

— Sergey Brin and Lawrence Page, 1998, The Anatomy of a Large-Scale Hypertextual Web Search Engine

Funny to think that this statement is from the founders of the company who makes most of its money through advertisement 🙂

Fun Fact: Who’s Browsing?

I just came by an explanation of the origin of the phrase “browsing [the web]”, which I thought was interesting because usually one never really thinks about something like this. In their article “Online text retrieval via browsing”, Cove and Walsh (1988)  explain its origin as follows:

The term “browsing” is usually applied to the actions of moving about a library and dipping into books, picking out bits and pieces of information of all kinds. The term is derived from the eating behavior of deer when selecting the fresh young shoots, and thus carries the connotation of selecting worthwhile and useful information.

A PhD thesis, LaTeX and me

For writing a PhD thesis in LaTeX, there are many package choices to make and a whole lot of little issues and pitfalls to handle. This starts with choosing the document class and … goes on and on. Here, I am collecting some points which took me more than a few moments, so I don’t have to go through the whole process again. And maybe my little list can help others to make their choices a little faster or avoid some of the mistakes I made.

Choosing the document class

Even though there are alternatives, for me, the main contenders for the document class were KOMA-Script class ( scrbook  or scrreprt ) and memoir. In the end I chose KOMA-Script as it seems to be less bloated (i.e., memoir emulates many well established packages instead of using them directly) and there really seems to be no reason not to use it 😉 However, as you can see, I am not going into minute details as the articles mentioned above were enough to sway me.

As for the subcategory I use scrbook . It seems that from the book, report or article classes (koma-script or not) there seems to be an awful lot of features which fit a PhD thesis more than the report or article class (see this discussion). Just to name a few, such features include two-page layout or more flexible numbering with regard to front, main and back matter. Also this article explicitly states that scrbook  is for dissertations.

How to handle subfigures

An interesting choice was which package to use for subfigures. I chose the subcaption package. As to why: the subfigure package seems to be old and is superseded by subfig. While the newest most flexible option seems to be a combination of the caption and the floatrow package. However, the subcaption package supposedly was a case study for the interfaces provided by the latter two packages and provides a more easy to use functionality. Indeed, the introduction of the subfigure package on CTAN specifically describes itself as “superseded […], […] and users may find the more recent subcaption package more satisfactory.” Discussions on StackExchange further support this notion. I think overall, it boils down to subfig supposedly having issues with hyperref, and subcaption being more simple than using a combination of caption and floatrow. Thus in the end subcaption seems to be the best choice.

 

i3: Fast switching named workspaces

i3 is a tiling window manager which allows to work nicely with named workspaces. For example, I have a messaging/social workspace, a calendar and TODO workspace, two browser workspaces, my code workspaces and so forth. However, as the number of projects I work on increases, it becomes more difficult to keep track of the different workspaces. To solve this, it would be necessary to create new named workspaces. However, to do this, the config needs to be updated which I am usually to lazy to do.

Now, the core idea to solve this is based on the  i3-input  directive. This lets the user type the name of the desired workspace in order to easily create, rename and move to workspaces with very specific names on the fly. However, this becomes cumbersome when workspace names are longer than two or three characters. To solve this I came up with a little Python script which allows so “shortcode” workspaces. In the following I introduce the Python script as well as the corresponding i3 config entries.

The Python script

The Python script takes three parameters “prefix”, “query”, and “postfix”. It will then pick a workspace from the list of existing i3 workspaces if the query is a prefix of that workspace name (priority 1) or if the workspace contains the query (priority 2). Also, the script supports an “index”, i.e., you can append something to query using a . which is then appended to the name chosen by the script. For example is the workspaces project and project2 exists, then the query is p.2 will choose project2.  Then the script executes a command built from the prefix, the chosen workspace and the postfix: <prefix><chosen name><postfix> .

The i3 config

The Python script introduced above is then used in the i3 config as follows:

This allows to rename a workspace using MOD+Ctrl+m . For example using the name project2 . Then using MOD+m and typing p or  p.2 will take you to that workspace. Similarly, MOD+Shift+m and typing p or  p.2 will move the active container to the project workspace.

Conclusion

This made my life a lot easier since now it is possible to quickly create, rename, and move to arbitrarily named workspaces. I hope this helps a few people making their lives easier 😉 Finally, let me know if you have alternative or better solutions!

BibSonomy Scholar: A Chrome browser extension for BibSonomy

A while ago I was working on a Chrome browser extension for integrating BibSonomy, a social bookmarking and publication management platform, with the Google Chrome browser. The idea was to directly manage publication on the Google Scholar page without the cumbersome process of getting the BibTex, opening BibSonomy, pasting the BibTex, downloading the PDF, uploading the PDF … you get my point.

Google Scholar

Anyways,  the extensions now directly integrates with Google Scholar allowing to manage publications without ever leaving the current page. This includes marking already posted publications, directly posting and deleting publications, automatic upload of PDFs, etc.. Here is a little screenshot:

BibSonomy Scholar integrating with Google Scholar.
BibSonomy Scholar integrating with Google Scholar.

Managing Bookmarks

After a while, I came across the issue of choosing a new laptop, having a million tabs open, clicking through them again and again, trying to remember which laptop an which page was the one I was interested in and why. So I thought that adding tags to URLs for a better categorization of my reviewed laptops and leaving notes on each page would be a tremendous help. While I know that Firefox supports tagging of bookmarks and I guess that there are quite a few browser extensions to support leaving notes, I did not want to get started with yet another system for managing things. So, since BibSonomy actually supports adding tags and descriptions for bookmarks, I added a “Quick Bookmark Button” to the BibSonomy Scholar extension.

Similar to the usual bookmark button in Chrome, this “Quick Bookmark Button” indicates whether the currently viewed URL has already been bookmarked. It also supports posting, deleting and updating bookmarks by clicking on the button or using a keyboard shortcut (CTRL+B). Furthermore, for leaving notes, it renders Markdown directly in the posting dialog. Here is a screenshot:

BibSonomy Scholar - Quick Bookmark Button
BibSonomy Scholar – Quick Bookmark Button

 Conclusion

Overall, I think that the BibSonomy Scholar extension can be quite helpful and allows for a very “integrated” experience of BibSonomy. Of course I see many things which can still be improved and even more features which would be nice to implement. For example, all publications and bookmarks posted are public for now. Especially for bookmarks, this might not always be the desired option. Concerning additional features, I think it would be nice to handle pages from publishers containing publications differently than regular bookmarks, i.e., indicating if the corresponding publication has already been posted, or directly posting this publication instead of a bookmark. There are many more ideas floating around. I hope to find the time to add them at some point.

Finally, if you want to try out the extension have a look in the chrome web store and let me know about your experience with the extension. Also do not hesitate to post bug reports or feature requests or contribute yourself. The extension is open source and can be forked on Bitbucket. I will be happy to accept push request.

Hello world!

Welcome to my Blog! This is my first post where I try out some plug-ins before starting to write away.

Crayon Syntax Highlighter

This is Crayon Syntax Highlighter:

 

WP LaTeX

And this is WP LaTeX:
e^{\i \pi} + 1 = 0

BibSonomy/PUMA CSL

I also use BibSonomy, so I tried to install the corresponding plug-in in order to list some publications and research articles.  This turned out to be a little cumbersome since it does not seem to be compatible with PHP7. When I try to activate the plug-in, I get two errors:

The first error we can solve by modifying the file CurlHttpRequestProxy.php , i.e., we replace

by

The second error I was able to “fix” by installing the package php-xml :

After this, the BibSonomy plug-in worked for me.