26 November, 2014

Switchable inline comments for LaTeX/LyX document.

For communication with my co-authors, I sometimes use inline comments, i.e., additional highlighted paragraphs withing the text of my PDF documents; exported from LyX/LaTeX. I know, I could also use PDF comments, but I like the inline style better. Here is how it looks like:

To create these comments, I use a redefinition of LyX's greyedout notes, turning them into an \fcolorbox (see code below). For exporting a printable/camera-ready PDF, I need to turn of the comments.  It took me some time to figure out how to tell LaTeX to completely ignore the comment's body text. I use the environ package for that. Here is the complete code (LaTeX preamble):


% remove old lyxgreyedout notes

% redefine lyxgreyedout notes
  \noindent %

% remove notes for printing: rename the above env and the next env
  %this will ignore all the body content in my greyedouts
And here is the rest of my LaTeX preamble; just for reference:
% I sometimes need a little more space
\newcommand{\vs}{ \textbf{\vspace{2pt}}}

% small fancy links; clickable but still readable (without the http protocol string)

% setting pretolerance to 4500 will remove most overflowing lines, esp.
% for two-column documents. In the final version of a paper, I lower this setting
% and handtune the overflows using hyphenation hints
\pretolerance = 4500

% more penalties for misplaced paragraphs,
% (usually not required for academic paper templates)
%\clubpenalty = 10000
%\widowpenalty = 10000
%\displaywidowpenalty = 10000

25 November, 2014

Linux at home + Mac at work = Goodbye Windows!

At home I had the luxury, freedom, and fun to use a Desktop Linux for nearly 10 years now. And I am quite happy with my fast and responsive Ubuntu/Gnome Desktop since 2006. When I started my professional career in 2008, I was shocked and sad to see only Windows machines; even on most servers! I think that server-side Windows was really popular at that time in Germany, even though the rest of the world was already moving forward to more OSS and to using Linux servers.

Today, over 6 years later, the situation in my company and in Germany has improved. Thanks to acquisitions, the Linux and Mac crowd was growing inside my company and also the religious devotion to Windows (in Germany) has changed. At my company, there is now a significant and growing number of Mac users and Linux servers are everywhere! Many people are remotely developing on Linux Desktops now, even if they still use a Windows machine as access point.

I am really happy to have Unix-like operating systems on all my devices now. No more fighting with missing features and cross platform software that behaves awkwardly under Windows. No more Cygwin, crappy XServer substitutes, or having to use MSBuild instead of make.

One of the most annoying things in Windows are regular freezes that are often impossible to explain. I had this 1-2 times a week and even more as the device/OS grew older. In most cases I just had to wait 2-10 minutes until the OS was responsive again. Sometimes, I had to hard reset my machine. Let's see if my new Macbook is better in this regard. I never had such issues with my Linux Desktops, or at least there was a way to kill the culprit, find an explanation, and eventually setup a mitigation to the problem. For Windows (and Mac) it is usually much harder or impossible to solve such problems.

I am a first time Mac user now and will probably run into several issues. Stay tuned for regular reports on my progress.


Update: My new Macbook also froze or had to be restarted a few times in the past month. Mainly caused by issues when logging into the corporate network, but also by software running wild. Regarding stability, I have to say that my new Mac is only slightly better than the a fresh Windows machine. Next time, I will try get a real Linux machine!

Update 2: The Mac has been running stable for months now.

05 November, 2014

Cleaning up SVG `transform="translate(dx,dy)"` in Inkscape

I use SVGs in Inkscape and some JavaScript magic to create all my slides for talks and presentations and show them using Firefox or Chrome. Therefore, in Inkscape I draw rectangles on a separate layer to mark the view of each slides. All content goes to the second layer. My JavaScript -- actually it is some awesome CoffeeScript -- then uses the transform attribute to control the current view and the flow of the slides. However, sometimes Inkscape already sets an transform on some of the rectangles, e.g., when copying slides from previous presentations. These transforms interfere with my script.

Here is the trick how to remove them:
  1. Group the rectangles (Ctrl+G).
  2. Ungroup the group (Ctrl+Shift+G).
Inkscape will then recompute the x and y attributes, incorporating the translate(dx,dy) defined in the transform attribute. Afterwards, the transform will then be removed.

PS: If I find the time to cleanup my presentation script, I will open-source it on Github.