LaTeX cheatsheet

Writing a longer publication comes with many challenges. One of the most essential decisions is the selection of the application for writing and file format. You might consider using a word processor, like Microsoft Word or its Libreoffice/Openoffice competitor. Very soon you will notice that word processors were never really intended for long ( > 10 pages ) documents, complex bibliographies, complex formulas or exotic utf8 characters. What if you work with one or several coauthors and don’t want to exchange hundreds of different versions of your document in binary formats via email and don’t want to use Google Docs?

Many problems can be solved by using LaTeX, even though new and unconsidered problems are guaranteed to haunt you.

-Writing in plain text allows version control in a git repository and sharing of a common document version.

-You can focus on the content and let the program take care of the formatting, contrary to WYSIWYG applications like word processors. The results will look more beautiful for text. Images, however, can be a major pain to align correctly and place at the right spot.

-You can write in your favorite text editor or choose among several applications for creating LaTeX documents like lyx, texmaker, texmacs, texstudio and many more.

Frustrating about LaTeX is the high learning curve and the number of commands you need to know and unterstand ( every time I don’t write anything for several months, I tend to forget most of them ) and the bulky syntax. Graphics can look bad and the pdf generation process can fail with arcane messages. The whole approach seems like a relic from a completely different age. But anyway, it will output beautiful pdfs and nobody will ask about the troubles you went through when creating them.

I attach my collection of useful snippets to this document. Maybe you find them useful too?

always use a ~ before cite to ensure the citation will not accidentally move to the next line  [ ~\cite{}  ]

Use macros for names that have yet to be defined and complex words that you could easily misspell.

[ \newcommand{\approach}{\textit{Our magical solution}\xspace} ]

Don’t put everything into a single file, favor a modular approach consisting of multiple files that can be included in the main document. For including firstsection.tex in my main document, I would use:

[ \input{firstsection} ]

Include the savetrees package if you have a maximum amount of pages you can submit and are worried about not meeting this limit. It will try to optimize your content in order to save some page space.

[ \usepackage[subtle]{savetrees} ]

Alter the margins if the white spaces on the left and right of the document are too large for you.

[ \usepackage[margin=2.5cm]{geometry} ]

Remember you can adjust the bibliography style or create your own.

\bibliographystyle{apalike}

This is still very sketchy and incomplete but will be extended sooner or later!

 

Advertisements

mailbox.org – review

About a year ago I decided to move away from google and started looking for another email provider for non-work related mail. Good bye creepy ads, good bye annoying ‘you have logged in from an unknown location’ emails. The Germany-based mailbox.org fits all of my requirements so I decided to give it a try.

First of all, it is not a free service. But neither it is excessively overpriced. A basic account starts at 1 euro per month. Don’t expect to get something like an email provider who claims to value your privacy and offers high functionality for free. Consider that free email providers which don’t bill you for their services will have a business model that ensures that you pay with the data you generate when using these services.

If you need more than 3 aliases, a higher mail quota or more file storage ( default is 2gb for mails and 100mb for files), you can change to a different account type at any time. Even the one with 100GB mail quota looks affordable with 5 euro per months.

I compiled a list of the advantages I found so far ( there might be still much to discover in the future ):

-Besides email, you get a calendar service, a small amount of web storage to store files and also some kind of office suite that runs inside their web interface in the browser ( I’m not much interested in office apps and never tried it ).

-Integration. You can use standard protocols to interact with each service, like imap for email, caldav for calendar sync, carddav for address book sync and webdav for file exchange. They don’t force the user to use only one particular app for accessing things. There is a simple and functional web interface for web access in case you need it. There should be apps for android and IOS, but I’ve never tried them.

-No ads. If you decide to use the web interface, its perfect simplicity is never tarnished by ads.

-If you are a PGP fan, PGP support allows you to set up a completely encrypted mailbox.

-This is not some new and doubtful startup. They have been around for some time, since the early 90s according to the website.

Advanced users will love the possibility to integrate the services provided by mailbox.org with the applications of their choice. Beginners will love the simplicity and reliability of this email provider. I’m definitely satisfied with my choice, even though I might know and use only a fraction of the complete functionality provided.

Presenter software for pdfs

When it comes to presenting on a Linux PC, the powerpoint format is not an option. Neither is Openoffice/Libreoffice for me. Designing presentations with Openoffice/Libreoffice can be quite frustrating and results in incompatibilities with other presentation slide generators like Powerpoint.

The only format that can guarantee consistency of your presentation across devices is pdf.

When you want to present a pdf, you can just open it in any pdf viewer, go fullscreen and mirror the display. But this simple setup is still far away from the comfort of Libreoffice/Openoffice/Powerpoint presentation mode. Wouldn’t it be nice to combine the reliability of pdf with the flexibility of the presentation mode found in Libreoffice/Openoffice/Powerpoint?

My requirements for a pdf presenter software are as follows:

-An extended desktop setup, with one screen showing the current  slide and the oder screen showing a preview of the upcoming slides.

-Be able to show notes and annotations that are not visible on the main screen. Notes should be easy to modify.

-Easy navigation between the slides and an overview of the complete presentation with slide thumbnails.

There seem to be very few pieces of software out there that support those concepts. One that fits my needs is https://pdfpc.github.io/ .

The notes are written to a plaintext file and can be edited inside the application while in presentation mode or with any text editor.

It comes with many useful features that can be found on the home page and which I will not reiterate here.

The weak spots of pdfpc are in my opinion:

-Initial rendering of the thumbnails can take some time

-Escape ends the presentation, escape also exits annotation mode. Visually it is not always clear if annotation mode is still running and you might unintentionally end your presentation.

Apart from that it is a very good presenter software that I can fully recommend to anyone doing presentations in pdf format.

Wireless scanning with Canon PIXMA on Linux – timeout issues ( solved )

Canon devices have their own USB over IP protocol for communicating wirelessly. This allows users to scan and print with Canon devices without physically connecting them.

Arch users would install aur/cups-bjnp and then configure the device in cups.

Printing with cups works nicely out of the box, but I had timeout issues with scanning. Nine out of ten times the scan would not finish successfully, but abort with an error message complaining about a timeout.

The solution for this is quite easy: set a high timeout value in /etc/sane.d/pixma.conf, something like 5s.

bjnp-timeout=5000

After setting this value, timeout errors during scans disappeared entirely.

Awesome Window Manager – Maximization issues

I have been a convinced follower of this tiling window manager [link] for some years, and never ever dream of going back to the messy days of stacking window managers.

Recently, I noticed that some windows start maximized like firefox or chrome ( with a + symbol in the taskbar ), and I’m unable to de-maximize them with conventional keybindings. The ordinary way for toggling maximization ( Mod4 + m ) does not change them in any way, and it results in different flags on the taskbar that indicate vertical and horizontal maximization.

After some fiddling I discovered that at least 3 ways exist to maximize a window and the default keybinding does not deal windows that are just maximized ( and thus different from vertically and horizontally maximized windows ). Here are the taskbar glyphs for each of them.

+ maximized
maximized_horizontal
maximized_vertical

A simple new keybinding to unset all three maximization flags for a given client can easily solve this when added to rc.lua :

awful.key({ modkey, “Shift” }, “m”,
function (c)
c.maximized = false
c.maximized_vertical=false
c.maximized_horizontal=false
c:raise()
end ,
{description = “demaximize”, group = “client”})

 

Mod4 + shift + m will cut all client windows down to size now

Random thought of the day

“Be silent and listen: have you recognized your madness and do you admit it? Have you noticed that all your foundations are completely mired in madness? Do you not want to recognize your madness and welcome it in a friendly manner? You wanted to accept everything. So accept madness too. Let the light of your madness shine, and it will suddenly dawn on you. Madness is not to be despised and not to be feared, but instead you should give it life…If you want to find paths, you should also not spurn madness, since it makes up such a great part of your nature…Be glad that you can recognize it, for you will thus avoid becoming its victim. Madness is a special form of the spirit and clings to all teachings and philosophies, but even more to daily life, since life itself is full of craziness and at bottom utterly illogical. Man strives toward reason only so that he can make rules for himself. Life itself has no rules. That is its mystery and its unknown law. What you call knowledge is an attempt to impose something comprehensible on life.”

-CG Jung, The Red Book

Firefox and dark GTK themes

Dark GTK themes can look very strange in firefox, since input widgets are likely to get transformed into dark pits with dark background colors and equally dark foreground fonts. Fortunately there is at least one solution that does not require fiddling around with GTK theme definitions.

The firefox plugin “Stylish” allows you to define your custom style overrides in css for your firefox browser.

https://addons.mozilla.org/en-US/firefox/addon/stylish/

To fix input widget color you would create a new style and copy something like the following into the style definition (sorry for the messy indentations caused by copy-pasting). Voilà, no more black holes in your browser sucking in your input text.

@-moz-document url-prefix(http), url-prefix(file) {
pre, input, textarea {
 color: black !important;
 background: white !important;
 border-left-color: gray !important;
 border-right-color: gray !important;
 border-top-color: gray !important;
 border-bottom-color: gray !important;
}
input:not([type="button"]):not([type="checkbox"])
:not([type="submit"]):not([type="reset"]), 
select {
 color: black !important;
 background: white !important;
 border-left-color: gray !important;
 border-right-color: gray !important;
 border-top-color: gray !important;
 border-bottom-color: gray !important;
}
}

Quote of the day

The dynamic principle of fantasy is play, a characteristic also of the child, and as such it appears inconsistent with the principle of serious work. But without this playing with fantasy no creative work has ever yet come to birth. The debt we owe to the play of imagination is incalculable. It is therefore short-sighted to treat fantasy, on account of its risky or unacceptable nature, as a thing of little worth. – CG Jung, Psychological Types

Random deep thought of the day

“What strikes me is the fact that in our society, art has become something which is related only to objects and not to individuals, or to life. That art is something which is specialized or which is done by experts who are artists. But couldn’t everyone’s life become a work of art? Why should the lamp or the house be an art object, but not our life?” – Michel Foucault

Learning a foreign language

One of the advantages of not being a native speaker of this wonderful mess existing under the umbrella term of ‘English language’ is that you will truly appreciate things like the following:

Waterfall is the opposite of firefly.

Seems legit to me.

The most interesting variant of this pluricentric language is definitely Engrish. And it is somewhat a secret language, since you cannot find courses or books for it. It has no semantic or syntactical rules, but relies entirely on intuition and creativity. This miracle language has recently gained popularity in eastern Asia.

engrish-lol28Engrish_44fa87_299912

189597d9d8968e05fe727368ee92df82

 

Have chinchillas been giving you nightmares lately? If you do not associate chinchillas with cuddly rodents, but orthographic nightmares, chances are high that you are a student of the Russian language. This is the word шиншилла in russian cursive script:

1426002913_1004627246

 

If your hovercraft is still not full of eels yet, try German ( not a foreign language to me, so I might be somewhat biased ) :

long_german_words

Oh, come on, it’s just an elementary word. Read some fiscal laws for some mindblowing experience and you will end up learning Italian which is basically a collection of loosely coupled vowels.

Have fun learning languages!