Wednesday, September 26, 2012

xelatex, polyglossia - french and verbatim

An interesting problem with the combination of circumstances in the title has cropped up today. A minimal sample like this exhibits the problem:

\documentclass[a4paper]{article}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\begin{document}
\verb|00:11:43:D4:86:A0|
\end{document}


 This code produces:
 whereas it correctly should look like this:
A bug about this has been reported, for now work around it with:
\newenvironment{\mverbatim}{\makeatletter \nofrench@punctuation\begin{verbatim}\makeatother}{\end{verbatim}\makeatletter\french@punctuation\makeatother}
The \verb is a little trickier, i'll think about that for a while. It probably boils down to copying the def from latex.ltx and adding an aftergroup or similar.
For now
\makeatletter\nofrench@punctuation
\verb|00:11:43:D4:86:A0|
\french@punctuation\makeatother

does the trick.

Wednesday, September 19, 2012

Widebar too wide

The following post shows a rather complicated solution to the problem of widebar being a little ugly that has naged for a while. Link
http://freebieber.org/ Please someone let me vote for this bill. Justin Bieber or any other cover singer on Youtube banned from the internet, what's not to like? How could one possibly oppose this. The only thing missing would be modems executing the owner if they were used to dial into aol.

Sunday, September 16, 2012

Umlaute not working in lualatex/making unicode work

This is a problem, that has confused us about a year ago. Lualatex claims to have the inputlanguage set to utf8, still i couldn't enter umlaute äüöß into the document. They were always eaten up or so it seems.
What really confused me was, that it worked as soon as i used \usepackage[utf8]{luainputenc}. It also started working without the inputenc if i set the fontenc to T1. This seemed to make no sense at all.

What usually happens is: if you enter a char into the document that char is converted to unicode (conceptually, i don't think it's literally done that way), and then replaced by the glyph corresponding to that point in the output.
This isn't quite so with  some chars, umlauts being one example. They are often constructed as an accent (the ") on top of the normal char, so both packages activate a mechanism that replaces these by composited chars, ä by \"{a} for example. This magic is all done by fontenc and inputenc loads fontenc! If fontenc isn't loaded in some way, the character is output unchanged and the font doesn't have that symbol, so it omits it!

If the font happens to sport the symbol, → comes to mind, then it may or may not look different, because it isn't made up of several parts. If you want the best of both worlds you could either
  • use the ucs package which requires knowing the code point
  • use DeclareUnicodeCharacter{<unicode>}{<replacement>} which of course requires knowing the code point as well
  • make it active and redefine it.
    \catcode`\→=13
    \let→{\rightarrow}
If you don't know the code point, just google it, or use something like http://www.utf8-chartable.de/

lsof replacement for windows

I must admit, i sorely miss lsof. This is sorely aggravated by the moronic way in which locks prevent you from working under windows. You can't delete or move folders with open file handles under them or files that are opened. This is not a problem most of the time, but when texing this can be a pain. Finding out what to close in order to be able to rename a folder can be challenging.
While i would love a
lsof <file>
under linux, this isn't an option. There are replacements like process hacker but I just found out about
openfiles /query <file>
Since this saves me from installing yet another tool, this is cool. :) You probably will have to enable the list keeping first, it's off by default. So in a root shell enter
/openfiles /local on 
and reboot (yes reboot, no kidding).

For the network aspect
lsof -i 
showing you opened connections and sockets, use
netstat /B
(maybe some other switch as well, there are plenty)

mswin.vim and ctrl-v

I started using vim under windows and the remapping of some keys, most importantly ctrl-v doing pasting instead of vertical selection had me going up the wall.

If you, like me, think the default is moronic, do
:e $MYVIMRC
and comment out the line that reads
source $VIMRUNTIME/mswin.vim

Tuesday, September 11, 2012

Always on Top

Always on Top was always something i missed under windows. There are a couple of dedicated tools for this, some of which sport a weird interface. Turns out you can get the same result with autohotkey (beginning to love this tool, even though the configuration is a little clumsy).
Anyway the snippet to make it work with ctrl-alt-t is
^!t::
WinGet, currentWindow, ID, A
WinSet, AlwaysOnTop, Toggle, ahk_id %currentWindow%

Sunday, September 9, 2012

Diagnosing BSODs

I had to investigate a series of Bluescreens and tried a lot of the usual stuff, i would do with common sense and my unixy background. In the end the best tool i found was the NirSoft Bluescreen Analyzer. It helped me understand the frequency of my problem and gave me rudimentary stack traces. So it seems my Page Fault in Non Paged Area BSOD was caused by some interaction of my AVG Virus scanner and the ntfs driver. Good riddance piece of crap.

Saturday, September 8, 2012

Why a lot of modern languages are doing it wrong.

While I am still uncertain about the role of go - half a year after release 1.0 and a bit longer since its introduction, i have not seen any major app in Go that sounded really interesting, just a load of proposals of what could be cool in Go - Rob Pike said quite a lot of true words about the old school dinosaur languages back in '10 that i just heard again.

Epic new bicycle helmet

This new design  is awsome, although i fear, it will be to expensive to really push the classical one out of the market. Poor, I'd love one of those.

En-/Disabling the Windows+L-Locking shortcut

Upon pressing Windows + L Windows will lock your session. I for one am trained to switch terminal emulator tabs with that key combination and am greatly hindered by this.
So i created
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableLockWorkstation
as a DWord (i had to create the System key as well) and set it to 1 for Disabling (0 would be for Enabling it again). Works instantly.

Changing the Windows keyboard layout *permanently*

I involuntarily spend a lot of time in windows at the moment and one of the things that drives me nuts, is the inability to use different keyboard layouts permanently, globally without uninstalling the alternatives. Having to change it for every window, and redoing it after closing one just doesn't cut it. So i now use autohotkey  as an xmodmap and xbindkeys replacement and combine it with kbswitch. In order to get us altgr-intl (the parts that interest me) and make capslock another escape i switch the language to english and use the following autohotkey script:
CapsLock::Escape
>!y::SendInput ü
>!p::SendInput ö
>!q::SendInput ä
>!s::SendInput ß
+>!y::SendInput Ü
+>!p::SendInput Ö
+>!q::SendInput Ä

This appears to satisify my most basic needs for now. Now if there was something that would make this insanity of a vfs less messy i'd be almost content.

Why something hailing itself an international, multiuser OS doesn't have that is beyond me. I would love to force the responsible people to use amharric, japanese and russian in random succession and see if they volunteer to implement it afterwards.

<edit>I forgot to mention, that you should realy turn off the global hotkeys for switching the ime, or you'll likely hit alt shift sometimes and be confused why your layout changes by itself.</edit>

Removing the searchya pest completely

My mother, despite being competent enough to reinstall her operating system, is quite prone to catch these nasty firefox toolbars. I am unsure if they are malware of some kind, though it's not unlikely given how much they resist being deactivated.

I found several hints on the internet regarding how to get rid of that crap:
  • Uninstall via Control Panel>Software
  • Deactivate the firefox addon
  • Edit the registry (don't you love administering windows?)
This still didn't get rid of the searchya completely because it had registered its useless url with the default for a new tab.
So i ended up solving it
  • Opening about:config and setting browser.newtab.url to something sensible.
Good Riddance Pest.

Sunday, September 2, 2012

Writing advice

I am not a very practiced writer and i found the following information quite helpful again http://web.science.mq.edu.au/~rdale/resources/writingnotes/