13/04/2017

Beamer to pptx via LibreOffice.

Notes on getting your beamer slides into PowerPoint via LibreOffice without too much postediting. (AKA boss asks you for a few quick slides from a recent presentation. Gah, I wish I'd figured out the tricks below last Monday)

Standard procedure:
  • Open PDF in LibreOffice Draw. 
  • Save as ODP (or as odg and rename the extension to odp).
  • Open in Impress. Fix display issues. Save as PPTX. Pray.

How to prepare your LaTeX source in order to minimise postediting:
  • Use a recent libreoffice. There were some improvements of the PDF import with regard to text spacing in 2014 which should have been implemented by version 5.x.
  • Speaking of text spacing: avoid justification. Best switch it off globally with the ragged2e package.
  • Don't use PDF figures. Convert to PNG if necessary.
  • Forget about conversion-proofing equations, take screenshots and add them afterwards as pictures. They will get screwed up during PDF import and then there's the issue of LibreOffice vs. PowerPoint math editors.
  • Use LuaLaTeX with a Microsoft system TTF font and switch off ligatures. (note setsansfont vs. setmainfont for beamer!)
  • Don't worry about advanced figure/text block positioning with columns or tikz pictures.  That stuff transferred surprisingly well.

Minimum example:

\documentclass{beamer}
\usepackage[document]{ragged2e}
\usepackage{fontspec}
\setsansfont[Ligatures = {NoRequired, NoCommon, NoContextual}]{Arial}
\usepackage{lipsum}
\begin{document}
 \frame{\frametitle{Lorem Ipsum}\lipsum[1]}
\end{document}



06/03/2017

Greek letters via compose key

h/t to Peter Williams: https://newton.cx/~peter/2013/04/typing-greek-letters-easily-on-linux/
If you don't have an .XCompose file in your home directory yet, copy the default file (replace locale if necessary, e.g. 'de_DE.UTF-8'):
cp /usr/share/X11/locale/en_US.UTF-8/Compose ~/.XCompose
The file in your home directory should take precedence over the one in /usr/share/… The default XCompose file already has the greek letter mapped using a key (line 5357 in my instance). If you don't have a Greek dead key defined in your key map, you can just switch to a different Compose prefix - e.g. 
<dead_greek> <d> : "δ" U03B4 # GREEK SMALL LETTER DELTA 
to 
<Multi_key> <g> <d> : "δ" U03B4 # GREEK SMALL LETTER DELTA 
which produces δ via <Compose>-g-d. I had to restart my application (e.g. LibreOffice) for the changes to take effect, but needed no logout/restart.
Also, sometimes the damn letters don't show up. It took me a while to realise that this might have something to do with the font in use not having them implemented (*headdesk*)

19/02/2017

Garmin Fenix 3: maxing out the battery life.

Some settings culled from a couple of forum threads and the official Garmin manuals. Go into the watch menu by pressing and holding Up, then choose Settings with the Go button. The following settings can affect battery life.

GPS tracks by Garmin user canopenerboy
Apps:
  • Run (or whatever app you will use to record/navigate) →GPS →UltraTrack. In this mode, the GPS records, is switched off for a minute or so, on again, reacquires a signal, records, etc. This will extend the battery life, but considering how hard it is to get a fix while moving, it can result in really dodgy data. At least make sure your EPO is up to date. (http://www.javawa.nl/epo_en.html)
    Or better, skip UltraTrack and carry a charger (see below).  
Watch Face:
  •  Seconds Style. Pick one without a seconds hand/counter, so the watch face only updates every minute.
Sensors:
Very thoughtful when you're ultra training.
  • Compass →Mode →off. I doubt this will seriously dent the battery life, though. Altimeter and barometer can't be disabled.
Bluetooth: Status →off

Activity Tracking: Status →off. Duh. Unless you can't live without Insights.

System:
  • Backlight: Mode manual, short timeout, reduce brightness.
  • Sounds: No one needs key tones. I'd keep alert tones, but switch off vibration. Shaking a steel watch consumes a lot of energy.
  • GLONASS: off. Unless you have GPS location troubles and know that the added GLONASS helps.
  •  Data recording: "Smart" only reduces file size, not battery life. Garmin's .fit format is pretty compact (ballpark number: 100KB/h at the non-smart 1Hz recording rate) and you've got about 20MB of free space, so it's probably more useful to clean out/backup all .fit files from previous activities (GARMIN/ACTIVITY subfolder on the watch in mass storage mode)
  • USB mode →Garmin. This will keep the watch data screens up if you charge during recording. The battery capacity is 300mAh, so even a compact 3000mAh lipstick power bank should be good for a couple of recharges and the watch can be worn with the charger clip attached.

My test run was about 10h in navigation mode, temperatures around freezing, all of the above settings except for UltraTrack (off), Compass (on), recording rate (1Hz, standard). Battery was down to 40%, so the advertised 16h battery life seems to be quite correct.

24/01/2017

LuaLaTeX, TeXlive, beamer and multimedia

 


Sometimes you need beamer to be a bit more, er, powerpointy. E.g., use a TTF font, have a more or less blank page and cram some text, images and movies on there. LuaLaTeX to the rescue. I installed texlive-xetex and texlive-luatex, got myself a minimal beamer template, started to dump objects into tikzpictures and compiled with lualatex instead of pdflatex. Sadly, what worked fine on TeXLive 2012 at work failed at home with a lot of nasty PDF specific error messages due to some bug in TeXLive 2016. Apparently, to get beamer, multimedia and LuaLaTeX to play nicely together, you need to add a \RequirePackage{luatex85} as the first line in your document. So here's a minimal example in very bad taste.

%\RequirePackage{luatex85} %uncomment for texlive 2016
\documentclass[gray]{beamer}
\usepackage[english]{babel}
\usepackage{fontspec}
\setsansfont[Path = fonts/,
    Extension = .ttf,
    Ligatures = TeX,
    BoldFont = comicbd ]
{comic}%use \setmainfont for non-beamer
\usepackage{amsmath}
\usepackage{multimedia}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}{}
\setbeamertemplate{itemize items}[circle]
\begin{document}
\begin{frame}[plain]
\frametitle{Science is fun!}
\begin{columns} \begin{column}{.5\textwidth}
\begin{itemize} \item random equation! \end{itemize}
\begin{align*} \rho\left(\frac{\partial}{\partial t}+\vec{u}\cdot\vec{\nabla}\right)\vec{u} &= -\vec{\nabla} p + \eta \nabla^2\vec{u}\\
\vec{\nabla}\cdot\vec{u} &=0 \end{align*}
\end{column} \begin{column}{.5\textwidth} \movie{\includegraphics[width=\textwidth]{movieposter}}{demomovie.avi} \begin{itemize} \item random animation! \end{itemize}
\end{column} \end{columns}
\end{frame}
\end{document}
Notes: I kept the TTF fonts in a subfolder 'fonts' next to the .tex source file. Font names correspond to the ttf file names without extensions (i.e. comic.ttf, comicbd.ttf). LuaLaTeX also works with system fonts, but then you're at the mercy of your font manager. In that case, just \setsansfont{comic} should work as well.
Beamer's default font style is sans serif. For serif font styles, use \setmainfont instead.

14/07/2016

Reminder: password protect PDF files.

pdftk to the rescue!
pdftk inputfile.pdf output outputfile.pdf userpw somepassword

18/06/2016

If Plasma's network manager doesn't display available networks after suspend/lock screen/etc....

sudo service networking restart
sudo service network-manager restart
Bingo.

31/05/2016

Damn you, kscreen

Actually, I like kscreen. The desktop display configuration interface is clicky, draggy and intuitive, and apparently they store settings for specific external monitors by EDID and feed them into xrandr once you connect the monitor.
Enter my Zenbook, various microHDMI to VGA/HDMI dongles, external monitors and projectors. What happens, usually 10 minutes before an important presentation, on a bus without internet and my boss getting antsy, is KDE presenting me with a black screen and the mouse pointer stuck at the top screen edge. Panic mode fix: create a new user from the terminal. In the end I was stuck with 3 different temporary user accounts and no graphical interface unless the µHDMI to VGA dongle was plugged in. Don't judge me, I was overworked.
Still, the troublesome configuration had to be somewhere in my home directory, so I needed to do some more creative renaming, i.e. .kde to .notkde, restarting sddm and praying to the deity of the moment.
Kscreen's config files happened to be in ./local/share/kscreen, I just deleted them all, problem solved.
Got a kernel update in the process and now I need to consolidate user accounts…

03/02/2016

Three KDE5 quirks bugging me most right now

I recently upgraded to Kubuntu 15.10 (16.04 by now) and Plasma 5.
Plasma 5 is gorgeous, but still a bit experimental in places. Erm, make that six and counting.
  • Baloo desktop search. Once the index is written (takes hours on first run), it's actually usable. However, the config dialog in the system settings is incomplete. You're better off editing ~/.config/baloofilerc, as explained here:
    https://community.kde.org/Baloo/Configuration
    Also, entirely disabling baloo search knocked out Dolphin's nice in-browser file search.
  • Dolphin hangs on startup in the home directory when hidden files are set to visible and Kile is running at the same time. (caused by Kile's  ~/.lyxpipe.in and ~/.lyxpipe.out) Apparently fixed upstream: https://bugs.kde.org/show_bug.cgi?id=352828
  • The device notifier has lost the automount configuration. There's a hack using the kde4
    versions:
    Edit /usr/share/kde4/services/kded/device_automounter.desktop using the following line (value was 1 before): "X-KDE-Kded-phase=0"
    Use kcmshell4 kcmkded and kcmshell4 device_automounter_kcm to enable and configure automounting. Apparently fixed upstream as well.
    Source: https://forum.kde.org/viewtopic.php?f=289&t=126846
  • Dolphin context menu is missing the Ark extraction services. Fixable by sudo ln -s /usr/share/kde4/servicetypes/konqpopupmenuplugin.desktop /usr/share/kservicetypes5/
    Source: https://bugs.launchpad.net/ubuntu/+source/dolphin/+bug/1499530
  • Dolphin etc. doesn't remember changes in mime type associations. Apparently it reads from one mimeapps.list file and saves to a different one. The solution is to link both to the same file.
    ln -s ~/.local/share/applications/mimeapps.list ~/.config/mimeapps.list
    Source: https://bbs.archlinux.org/viewtopic.php?id=202636
  • Dolphin doesn't display PDF previews, even though they can be enabled in Preferences with kdegraphcis-thumbnailers installed.
    Workaround: sudo ln -s /usr/lib/x86_64-linux-gnu/plugins/* /usr/lib/x86_64-linux-gnu/qt5/plugins/ Sources: https://bugs.kde.org/show_bug.cgi?id=351913 http://osdir.com/ml/ubuntu-bugs/2016-04/msg19852.html