tag:blogger.com,1999:blog-2791424442684555522024-03-13T23:21:00.687+01:00Miscellaneabraunerhttp://www.blogger.com/profile/06745755313587516149noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-279142444268455552.post-45947447189081968382014-12-13T14:55:00.000+01:002015-03-24T13:28:42.459+01:00Extended Introduction to Unprivileged LXC Containers<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">This is an extended introduction to unprivileged containers based on <a href="https://www.stgraber.org/2014/01/17/lxc-1-0-unprivileged-containers/" target="_blank">this post</a>.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Last updated on 2015-03-22T09:37+01:00. There have been some important changes how lxc works. Most important lxc is now able to run systemd-based unprivileged containers. This has been made possible by using lxcfs. lxcfs <span style="background-color: white; color: #333333;">is a simple userspace filesystem designed to workaround some current limitations of the Linux kernel. </span><span style="background-color: white; color: #333333;">Specifically, it's providing two main things</span></span><br />
<ul style="background-color: white; box-sizing: border-box; color: #333333; line-height: 20px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;"><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">A cgroupfs-like tree which is container aware and works using CGManager.</span></li>
<li style="box-sizing: border-box;"><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">A set of files which can be bind-mounted over their /proc originals <br style="box-sizing: border-box;" />to provide CGroup-aware values.</span></li>
</ul>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Required software with my setup in brackets:</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">(1) A working Linux environment. (</span><span style="font-family: Courier New, Courier, monospace;">Arch Linux</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">)</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">(2) A Linux kernel with user namespace enabled. (</span><span style="font-family: Courier New, Courier, monospace;">Kernel 3.19.2</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> compiled from source)</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">(3) </span><span style="font-family: Courier New, Courier, monospace;">lxc (lxc 1.1.1)</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">(4) </span><span style="font-family: Courier New, Courier, monospace;">cgmanager (cgmanager 0.36)</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">(5) </span><span style="font-family: Courier New, Courier, monospace;">lxcfs (lxcfs 0.6)</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<b><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Is your Kernel suited for unprivileged containers?</span></b><br />
<b><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></b>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">We can answer this question very easy by using <code>lxc-checkconfig</code>. If your output shows enabled on all fields you’re fine:</span><br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">[chb@conventiont ~]$ lxc-checkconfig
--- Namespaces ---
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: enabled
Network namespace: enabled
Multiple /dev/pts instances: enabled
--- Control groups ---
Cgroup: enabled
Cgroup clone_children flag: enabled
Cgroup device: enabled
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: enabled
Cgroup cpuset: enabled
--- Misc ---
Veth pair device: enabled
Macvlan: enabled
Vlan: enabled
File capabilities: enabled
Note : Before booting a new kernel, you can check its configuration
usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig</span></code></pre>
<b><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Assigning <code>subuid</code>s and <code>subgid</code>s to an the unprivileged user on the host which runs our unprivileged container</span></b><br />
<ol>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">create files necessary for assigning subuids and subgids should they not exist:</span><br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">sudo touch /etc/subuid
sudo touch /etc/subgid</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span></code></pre>
</li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">assign subuids for user</span><br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">sudo usermod --add-subuids 100000-165536 $USER</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span></code></pre>
</li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">assign subgids for user</span><br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">sudo usermod --add-subgids 100000-165536 $USER</span></code></pre>
</li>
</ol>
<div>
<span style="white-space: pre;"><b><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Starting </span><span style="font-family: Courier New, Courier, monospace;">cgmanager</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> and </span><span style="font-family: Courier New, Courier, monospace;">lxcfs</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> via </span><span style="font-family: Courier New, Courier, monospace;">systemd</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> service files</span></b></span></div>
<div>
<span style="white-space: pre;"><b><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></b></span></div>
<div style="text-align: justify;">
<div>
<span style="white-space: pre;"><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">We will need </span><span style="font-family: Courier New, Courier, monospace;">cgmanager</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> and </span><span style="font-family: Courier New, Courier, monospace;">lxcfs</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> in order to get </span><span style="font-family: Courier New, Courier, monospace;">systemd</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">-based unprivileged containers </span></span><br />
<span style="white-space: pre;"><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">to work. (Archlinux currently does not provide </span><span style="font-family: Courier New, Courier, monospace;">*.service</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> files for </span><span style="font-family: Courier New, Courier, monospace;">cgmanager</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> and </span><span style="font-family: Courier New, Courier, monospace;">lxcfs</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">. </span></span><br />
<span style="white-space: pre;"><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The required service files are listed in the next two paragraphs. You should copy and paste </span></span><br />
<span style="white-space: pre;"><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">them to their appropriate locations. The paths I give here are for Archlinux. They may differ </span></span><br />
<span style="white-space: pre;"><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">for your distribution.)</span></span></div>
</div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><span style="white-space: pre;"><br /></span></span></div>
<div>
<span style="white-space: pre;"><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">1. </span><span style="font-family: Courier New, Courier, monospace;">/usr/lib/systemd/system/cgmanager.service</span></span></div>
<div>
<span style="white-space: pre;"><b><span style="font-family: Courier New, Courier, monospace;"><br /></span></b></span></div>
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;">[Unit]
Description=Cgroup management daemon
ConditionVirtualization=!container
Before=cgproxy.service
After=local-fs.target
[Service]
Type=simple
ExecStart=/usr/bin/cgmanager -m name=systemd
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target</span> </span><br />
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">start and enable it with</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">sudo systemctl start cgmanager.service</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">sudo systemctl enable cgmanager.service</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">2. </span><span style="font-family: Courier New, Courier, monospace;">/usr/lib/systemd/system/lxcfs.service</span></div>
<div>
<div style="font-family: 'Courier New', Courier, monospace;">
[Unit]</div>
<div style="font-family: 'Courier New', Courier, monospace;">
Description=FUSE filesystem for LXC</div>
<div style="font-family: 'Courier New', Courier, monospace;">
ConditionVirtualization=!container</div>
<div style="font-family: 'Courier New', Courier, monospace;">
Before=lxc.service</div>
<div style="font-family: 'Courier New', Courier, monospace;">
After=cgmanager.service</div>
<div style="font-family: 'Courier New', Courier, monospace;">
Requires=cgmanager.service</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<br /></div>
<div style="font-family: 'Courier New', Courier, monospace;">
[Service]</div>
<div style="font-family: 'Courier New', Courier, monospace;">
ExecStart=/usr/bin/lxcfs -f -s -o allow_other /var/lib/lxcfs</div>
<div style="font-family: 'Courier New', Courier, monospace;">
KillMode=process</div>
<div style="font-family: 'Courier New', Courier, monospace;">
Restart=on-failure</div>
<div style="font-family: 'Courier New', Courier, monospace;">
ExecStopPost=-/bin/fusermount -u /var/lib/lxcfs</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<br /></div>
<div style="font-family: 'Courier New', Courier, monospace;">
[Install]</div>
<div style="font-family: 'Courier New', Courier, monospace;">
WantedBy=multi-user.target</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<br /></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">start and enable it with</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">sudo systemctl start lxcfs.service</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">sudo systemctl enable lxcfs.service</span></div>
<div>
<b style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; white-space: pre;"> </b><b style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; white-space: pre;"> </b></div>
<b><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Editing important files necessary for the creation of unprivileged containers</span></b><br />
<b><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></b>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Per default all files relevant to unprivileged containers will reside in the following folders:</span><br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">~/.config/lxc/lxc.conf
~/.config/lxc/default.conf
~/.local/share/lxc
~/.cache/lxc
/etc/lxc/lxc-usernet</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span></code></pre>
<ol>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">contents of <code>~/.config/lxc/default.conf:</code></span><br />
<pre><code><span style="font-family: Courier New, Courier, monospace;"># uid and gid mappings
lxc.id_map=u 0 100000 65536
lxc.id_map=g 0 100000 65536
# Network configuration
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.name = eth0
lxc.network.hwaddr = 00:16:3e:3a:f1:00
lxc.network.mtu = 1500
lxc.network.ipv4.gateway = 192.168.200.1
lxc.network.ipv4 = 192.168.200.0/24</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span></code></pre>
</li>
</ol>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Some notes about this. Under <code># uid and gid mappings</code> we map the <code>uid</code> and <code>gid</code> ranges from our host to different <code>uid</code> and <code>gid</code> ranges in the container. The <code>uid</code> and <code>gid</code> ranges in the container correspond to the <code>subuid</code>s and <code>subgid</code>s we assigned to our unprivileged user on the host. Hence, when a process or user escapes our container it will find itself unable to do serious harm to the host. I will illustrate this by contrasting processes as seen inside of the container with the same processes as seen from the host. </span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Suppose we’re starting a privileged <code>Debian Jessie</code> container which we created. We issue <code>sudo lxc-start -n jessie</code> to boot the container.</span><br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">Debian GNU/Linux 8 jessie console
</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span><span style="font-family: Courier New, Courier, monospace;">jessie login: root
Password:
Last login: Thu Dec 11 10:47:48 UTC 2014 on console
Linux jessie 3.17.6-ChB #1 SMP PREEMPT Tue Dec 9 20:18:53 UTC 2014 x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.</span><span style="font-family: Courier New, Courier, monospace;">
</span></code></pre>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">We look at the running processes as seen from inside the container:</span><br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">root@jessie:~# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.8 0.0 27864 4192 ? Ss 12:58 0:00 /sbin/init
root 21 0.5 0.0 32956 3920 ? Ss 12:59 0:00 /lib/systemd/systemd-journald
root 73 0.0 0.0 55160 5512 ? Ss 12:59 0:00 /usr/sbin/sshd -D
root 81 0.0 0.0 12656 1740 tty1 Ss+ 12:59 0:00 /sbin/agetty --noclear tty1 linux
root 82 0.0 0.0 12656 1728 tty2 Ss+ 12:59 0:00 /sbin/agetty --noclear tty2 linux
root 83 0.0 0.0 12656 1832 tty3 Ss+ 12:59 0:00 /sbin/agetty --noclear tty3 linux
root 84 0.0 0.0 12656 1768 tty4 Ss+ 12:59 0:00 /sbin/agetty --noclear tty4 linux
root 85 0.2 0.0 64900 3300 console Ss 12:59 0:00 /bin/login --
root 94 0.0 0.0 21876 3824 console S 12:59 0:00 -bash
root 98 0.0 0.0 19092 2528 console R+ 12:59 0:00 ps aux</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span></code></pre>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">We see that all processes so far are run by <code>root</code>. But what do the same processes look like as seen from the host?</span><br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">root 25914 0.0 0.0 69212 4780 pts/8 S+ 13:58 0:00 sudo lxc-start -n jessie
root 25915 0.0 0.0 30160 2952 pts/8 S+ 13:58 0:00 lxc-start -n jessie
root 25924 0.0 0.0 27864 4192 ? Ss 13:58 0:00 /sbin/init
root 25980 0.0 0.0 32956 3932 ? Ss 13:59 0:00 /lib/systemd/systemd-journald
root 26072 0.0 0.0 55160 5512 ? Ss 13:59 0:00 /usr/sbin/sshd -D
root 26086 0.0 0.0 12656 1740 pts/9 Ss+ 13:59 0:00 /sbin/agetty --noclear tty1 linux
root 26087 0.0 0.0 12656 1728 pts/10 Ss+ 13:59 0:00 /sbin/agetty --noclear tty2 linux
root 26088 0.0 0.0 12656 1832 pts/11 Ss+ 13:59 0:00 /sbin/agetty --noclear tty3 linux
root 26089 0.0 0.0 12656 1768 pts/13 Ss+ 13:59 0:00 /sbin/agetty --noclear tty4 linux
root 26090 0.0 0.0 64900 3300 pts/14 Ss 13:59 0:00 /bin/login --
root 26150 0.0 0.0 21876 3824 pts/14 S+ 13:59 0:00 -bash</span></code></pre>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">They are all run by root. Hence, any program that escapes the container could potentially become root on the host. So what does the mapping we just set up achieve? </span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">This time we will boot an unprivileged container we created. </span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br />
<code>lxc-start -n wheezy</code>:</span><br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">Debian GNU/Linux 7 wheezy console
wheezy login: root
Password:
Linux wheezy 3.17.6-ChB #1 SMP PREEMPT Tue Dec 9 20:18:53 UTC 2014 x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.</span></code></pre>
<pre><code><span style="font-family: Courier New, Courier, monospace;">
root@wheezy:~# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 10664 1636 ? Ss 13:07 0:00 init [3]
root 1131 0.0 0.0 14592 1788 tty1 Ss+ 13:07 0:00 /sbin/getty 38400 tty1 linux
root 1132 0.0 0.0 14592 1784 tty2 Ss+ 13:07 0:00 /sbin/getty 38400 tty2 linux
root 1133 0.0 0.0 14592 1684 tty3 Ss+ 13:07 0:00 /sbin/getty 38400 tty3 linux
root 1134 0.0 0.0 14592 1752 tty4 Ss+ 13:07 0:00 /sbin/getty 38400 tty4 linux
root 1135 0.0 0.0 52176 2480 console Ss 13:07 0:00 /bin/login --
root 1138 0.0 0.0 17896 3140 console S 13:07 0:00 -bash
root 1142 0.0 0.0 15324 1940 console R+ 13:08 0:00 ps aux</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span></code></pre>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">But what do these processes look like as seen from the host?:</span><br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">chb 31743 0.0 0.0 30160 3028 pts/0 S+ 14:07 0:00 lxc-start -n wheezy
100000 31788 0.0 0.0 10664 1636 ? Ss 14:07 0:00 init [3]
100000 472 0.0 0.0 14592 1788 pts/1 Ss+ 14:07 0:00 /sbin/getty 38400 tty1 linux
100000 473 0.0 0.0 14592 1784 pts/2 Ss+ 14:07 0:00 /sbin/getty 38400 tty2 linux
100000 474 0.0 0.0 14592 1684 pts/3 Ss+ 14:07 0:00 /sbin/getty 38400 tty3 linux
100000 475 0.0 0.0 14592 1752 pts/4 Ss+ 14:07 0:00 /sbin/getty 38400 tty4 linux
100000 525 0.0 0.0 52176 2480 pts/5 Ss 14:07 0:00 /bin/login --
100000 1131 0.0 0.0 17896 3140 pts/5 S+ 14:07 0:00 -bash</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span></code></pre>
<pre><code><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span></code></pre>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">We see that on the host, these processes are not owned by root but rather by a <code>subuid</code> which we assigned to our unprivileged user. Hence, a process that escapes the container could do a lot less harm on the host. That’s our goal! So let’s move on!</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Under <code># network configuration</code> I set some options in the file <code>~/.config/lxc/default.conf</code>:</span><br />
<pre><code><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> </span><span style="font-family: Courier New, Courier, monospace;"> # Network configuration
lxc.network.type = veth</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span></code></pre>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Here we are telling the container to set up a virtual ethernet interface which can share the network link on the physical interfaces on the host. </span><br />
<pre><code><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> </span><span style="font-family: Courier New, Courier, monospace;"> lxc.network.flags = up</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span></code></pre>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">We tell our container to bring up the interface.</span><br />
<pre><code><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> </span><span style="font-family: Courier New, Courier, monospace;"> lxc.network.link = br0</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span></code></pre>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">We tell our container the name of the bridge to use in order to be able to connect to the internet. (We will set this up in a follow up post.)</span><br />
<pre><code><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> </span><span style="font-family: Courier New, Courier, monospace;"> lxc.network.name = eth0</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span></code></pre>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">We tell our container to give the virtual ethernet interface inside of the container the name <code>eth0</code>.</span><br />
<pre><code><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> lxc.network.hwaddr = 00:16:3e:3a:f1:00
</span></code></pre>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">We will assign to every container a default <code>MAC</code> address. (I always use a dummy <code>MAC</code> address and edit by hand in the container <code>config</code>. I just like to have this line already set to some dumb value.)</span><br />
<pre><code><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> </span><span style="font-family: Courier New, Courier, monospace;"> lxc.network.mtu = 1500</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span></code></pre>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">We set the maximum allowed traffic.</span><br />
<pre><code><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> </span><span style="font-family: Courier New, Courier, monospace;"> lxc.network.ipv4.gateway = 192.168.200.1</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span></code></pre>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">We set the default gateway to use. It corresponds to the ip address of our bridge which we will set up in a later post.</span><br />
<pre><code><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> </span><span style="font-family: Courier New, Courier, monospace;"> lxc.network.ipv4 = 192.168.200.0/24</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span></code></pre>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">We set up a dummy ip address for the container. (I always use a dummy <code>ip</code> address and edit by hand in the container <code>config</code>. I just like to have this line already set to some dumb value.)</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">In the next post we will set up a bridge for our container.</span>
<br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<b><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Setting up a bridge for our container</span></b><br />
<b><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></b>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">In order for our container to connect to the outside world we will need a bridge on our host. I like to keep control over my system by using shell scripts most of the time. Here is one for creating a bridge:</span><br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">~/.config/lxc/bridge_create.sh</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span></code></pre>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">it contains</span><br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">#!/bin/bash
printf '\n\033[42mCreating br0\033[m\n\n' &&
brctl addbr br0 &&
ip addr add 192.168.200.1/24 dev br0 &&
ip link set dev br0 address 78:09:2d:cb:45:32 &&
ip link set dev br0 up &&
iptables -t nat -N LXC &&
iptables -t nat -A PREROUTING -m addrtype --dst-type LOCAL -j LXC &&
iptables -t nat -A OUTPUT -m addrtype --dst-type LOCAL ! --dst 127.0.0.0/8 -j LXC &&
iptables -t nat -A POSTROUTING -s 192.168.200.0/24 ! -o br0 -j MASQUERADE &&
iptables -A FORWARD -o br0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT &&
iptables -A FORWARD -i br0 ! -o br0 -j ACCEPT &&
iptables -A FORWARD -i br0 -o br0 -j ACCEPT &&
cat /proc/sys/net/ipv4/ip_forward &&
echo 1 > /proc/sys/net/ipv4/ip_forward &&
cat /proc/sys/net/ipv4/ip_forward &&
iptables -t nat -L -n</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span></code></pre>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">In this script we set up the bridge, bring it up, assign it an ip and a mac address and set appropriate temporary iptable rules. If you want to delete the bridge you can do this with the following script:</span><br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">~/.config/lxc/bridge_del.sh</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
</span></code></pre>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">with the contents:</span><br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">#!/bin/bash
printf '\n\033[42mDeleting br0\033[m\n\n' &&
ip link set dev br0 down &&
brctl delbr br0 &&
iptables -t nat -D PREROUTING -m addrtype --dst-type LOCAL -j LXC &&
iptables -t nat -D OUTPUT -m addrtype --dst-type LOCAL ! --dst 127.0.0.0/8 -j LXC &&
iptables -t nat -X LXC &&
iptables -t nat -D POSTROUTING -s 192.168.200.0/24 ! -o br0 -j MASQUERADE &&
iptables -D FORWARD -o br0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT &&
iptables -D FORWARD -i br0 ! -o br0 -j ACCEPT &&
iptables -D FORWARD -i br0 -o br0 -j ACCEPT &&
cat /proc/sys/net/ipv4/ip_forward &&
iptables -t nat -L -n</span></code></pre>
<b>Allowing our user to create a reasonable number of veth devices</b><br />
<b><br /></b>
For our user to be able to create <span style="font-family: Courier New, Courier, monospace;">veth </span>devices we need to allow him to do in the file <code><span style="font-family: Courier New, Courier, monospace;">/etc/lxc/lxc-usernet</span></code>. For each user who is supposed to run unprivileged containers it should contain a line like:<br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">USERNAME veth br0 100</span>
</code></pre>
Where <code><span style="font-family: Courier New, Courier, monospace;">USERNAME</span></code> is to be replaced by your user. With this line we tell <code><span style="font-family: Courier New, Courier, monospace;">lxc</span></code> that our user is allowed to create no more than 100 veth devices.<br />
<br />
<b>Creating cgroups</b><br />
<b><br /></b>
I will focus here on distros using <span style="font-family: Courier New, Courier, monospace;"><code>systemd</code> </span>as their default init daemon. There are essentially two ways to achieve what we want. Manually or semi-automatically with <code><span style="font-family: Courier New, Courier, monospace;">cgmanager</span></code>.<br />
<ol>
<li>Without <code>cgmanager</code><br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">#!/bin/bash
printf '\n\033[42mCreating cgroup hierarchy\033[m\n\n' &&
for d in /sys/fs/cgroup/*; do
f=$(basename $d)
echo "looking at $f"
if [ "$f" = "cpuset" ]; then
echo 1 | sudo tee -a $d/cgroup.clone_children;
elif [ "$f" = "memory" ]; then
echo 1 | sudo tee -a $d/memory.use_hierarchy;
fi
sudo mkdir -p $d/$USER
sudo chown -R $USER $d/$USER
# add current process to cgroup
echo $PPID > $d/$USER/tasks
done
</span></code></pre>
</li>
</ol>
You can put this in a script and name it <code><span style="font-family: Courier New, Courier, monospace;">cgroups_create.sh</span></code>. If you want to use it directly in the shell you need to change the last line <code><span style="font-family: Courier New, Courier, monospace;">echo $PPID > $d/$USER/tasks</span></code> to <span style="font-family: Courier New, Courier, monospace;"><code><span style="font-family: Courier New, Courier, monospace;">echo $$ > $d/$USER/tasks</span></code>.</span><br />
<ol>
<li>With <code><span style="font-family: Courier New, Courier, monospace;">cgmanager</span></code></li>
</ol>
We create the <code><span style="font-family: Courier New, Courier, monospace;">cgroup</span></code> hierarchy:<br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">sudo cgm create all $USER</span>
</code></pre>
We chown the directories we just created to our user:<br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">sudo cgm chown all $USER $(id -u) $(id -g)</span>
</code></pre>
We move the current process to the cgroup of our user:<br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">cgm movepid all $USER $$</span>
</code></pre>
<b>Creating and modifying our first unprivileged container</b><br />
<b><br /></b>
Let’s create a <code>Ubunutu Vivid</code> container by downloading the image:<br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">lxc-create -t download -n vivid -- -d ubuntu -r vivid -a amd64</span>
</code></pre>
When it has succesfully finished we will need to edit our <code>config</code> file for the container we just created:<br />
<code><span style="font-family: Courier New, Courier, monospace;">~/.local/share/lxc/vivid/config</span></code><br />
<pre><code><span style="font-family: Courier New, Courier, monospace;"># Template used to create this container: /usr/share/lxc/templates/lxc-download
# Parameters passed to the template: -d ubuntu -r vivid -a amd64
# For additional config options, please look at lxc.container.conf(5)
# Distribution configuration
lxc.include = /usr/share/lxc/config/ubuntu.common.conf
lxc.include = /usr/share/lxc/config/ubuntu.userns.conf
lxc.arch = x86_64
# Container specific configuration
lxc.id_map = u 0 100000 65536
lxc.id_map = g 0 100000 65536
lxc.rootfs = /home/chb/.local/share/lxc/vivid/rootfs
lxc.utsname = vivid
# Network configuration
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.name = eth0
lxc.network.hwaddr = 00:16:3e:3a:f1:02
lxc.network.mtu = 1500
lxc.network.ipv4.gateway = 192.168.200.1
lxc.network.ipv4 = 192.168.200.2/24</span>
</code></pre>
In comparison to <code><span style="font-family: Courier New, Courier, monospace;">~/.config/lxc/default.conf</span></code> we just changed the last digits of <span style="font-family: Courier New, Courier, monospace;"><code>lxc.network.hwaddr = 00:16:3e:3a:f1:02</code> </span>and of <code><span style="font-family: Courier New, Courier, monospace;">lxc.network.ipv4 = 192.168.200.2/24</span></code> to create a unique mac and ip.<br />
Before we can bring up our container we need to edit two further files under the containers <code><span style="font-family: Courier New, Courier, monospace;">rootfs</span></code>.<br />
<span style="font-family: Courier New, Courier, monospace;"><code>~/.local/share/lxc/vivid/rootfs/etc/network/interfaces</code>:</span><br />
It will contain the lines:<br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp</span>
</code></pre>
We change the last line from <code><span style="font-family: Courier New, Courier, monospace;">dhcp</span></code> to <code><span style="font-family: Courier New, Courier, monospace;">manual</span></code>. <br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">auto eth0
iface eth0 inet manual</span>
</code></pre>
<pre><code><span style="font-family: Courier New, Courier, monospace;">dns-nameserver 8.8.8.8 8.8.4.4</span></code></pre>
Otherwise our container will take a long time booting because he will try to assign an ip address which we already did in the container’s <code>config</code> file.<br />
Next we will put our containers <code><span style="font-family: Courier New, Courier, monospace;">hostname</span></code> into the containters <code><span style="font-family: Courier New, Courier, monospace;">~/.local/share/lxc/vivid/rootfs/etc/hosts</span></code> file unless it is already there. Add this line at the end:<br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">127.0.0.1 vivid</span>
</code></pre>
<b>Starting our unprivileged container</b><br />
<pre><code><span style="font-family: Courier New, Courier, monospace;">lxc-start -n vivid</span>
</code></pre>
and done.</div>
braunerhttp://www.blogger.com/profile/06745755313587516149noreply@blogger.com0tag:blogger.com,1999:blog-279142444268455552.post-9286763650131185362014-05-07T10:53:00.000+02:002014-05-07T10:53:26.373+02:00Pentadactyl: The better Vim Monster for FirefoxMost people who love Vim have like the idea of bringing vim-like behaviour to browsers. The quality of actual implementations have been mixed. There are some extensions for Chrome which in my opinion all lack functionality. And there is dwb which is a complete browser based on vim-like-behaviour (Which is really nice but dwb likes to crash and hang quite a lot.). And there is Vimperator, the Firefox monster. A slow, creaky beast. I used it as it was the best option so far but it has some serious flaws. Fortunately, most of the developers behind Vimperator have forked their own project: <b>Pentadactyl</b> It is an amazing extension for Firefox. It is faster and more like Vim than Vimperator. You should give it a try!<br />
<br />
<br />
Check out Pentadactyl here:<br />
(1) Homepage: <a href="http://5digits.org/pentadactyl/">http://5digits.org/pentadactyl/</a><br />
(2) Google Code: <a href="https://code.google.com/p/dactyl/">https://code.google.com/p/dactyl/</a><br />
(3) Firefox plugin: <a href="https://addons.mozilla.org/en-US/firefox/addon/pentadactyl/">https://addons.mozilla.org/en-US/firefox/addon/pentadactyl/</a><br />
<br />
Take care,<br />
Christianbraunerhttp://www.blogger.com/profile/06745755313587516149noreply@blogger.com0tag:blogger.com,1999:blog-279142444268455552.post-60973913227207457242014-04-30T18:29:00.000+02:002014-05-07T10:54:05.392+02:00tslime.vim: Send commands from vim to a running tmux sessionAs I am doing a lot of programming in R and Julia and my favourite text editor for such repl sessions is Vim it was only logical to look into possible ways to combine Vim and different repl sessions at the same time. I only placed the following condition on such a solution: It must be as simple as possible. I found tslime.vim but thought it lacked some features. Thus, I forked it and added some changes I thought would make it even better. One of my main objectives is to keep it as simple as possible (asap). This means the script does not pull in any dependencies or requires the presence of any other programming language. Here is the summary of what this script does:<br />
<br />
It is a simple vim script to send portion of text from a vim buffer to a
running tmux session.<br />
It is based on slime.vim <a href="http://technotales.wordpress.com/2007/10/03/like-slime-for-vim/">http://technotales.wordpress.com/2007/10/03/like-slime-for-vim/</a>,
but use tmux instead of screen. However, compared to tmux, screen doesn't
have the notion of panes. So, the script was adapted to take panes into
account.<br />
<b>Note:</b> If you use version of tmux ealier than 1.3, you should use the stable
branch. The version available in that branch isn't aware of panes so it
will paste to pane 0 of the window.<br />
<br />
(1) This fork provides the ability to send multiple keys to a tmux target
at once.<br />
(2) The tmux target is set on buffer basis. This means that every tab in
Vim can have its own tmux target. (E.g. you could have a tab in which you
edit a Python script and send text and keys to a Python repl and another
tab in which you edit an R script and send text and keys to an R repl. See picture.)<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWwNOec_jgxiZ_i63apcPImsRrrLFTg6Al2IZQjQAY68tE405tNm5Vk_ZZ3SHIhpWUcJS0VhHZgyRErgJalBtzsgGFfyjE8UxcyBiDO2g1GkMhjpOHwzvjLbshsOWDsmMDnOXwQyDIdGI/s1600/screenshot-0.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWwNOec_jgxiZ_i63apcPImsRrrLFTg6Al2IZQjQAY68tE405tNm5Vk_ZZ3SHIhpWUcJS0VhHZgyRErgJalBtzsgGFfyjE8UxcyBiDO2g1GkMhjpOHwzvjLbshsOWDsmMDnOXwQyDIdGI/s1600/screenshot-0.jpg" height="176" width="320" /></a></div>
<br />
<br />
(3) This fork allows you to refer to panes either via their dynamic
identifier which is a simple number. Or via their unique identifier which
is a number prefixed with <code>%</code>.<br />
<br />
a) Demonstrative Reference/Dynamic Reference: If you choose to refer to a
pane via its dynamic identifier the target of any given send function in
this script will change when you insert a new pane before the pane you
used.<br />
<br />
b) Proper Name/Static Reference: If you choose to refer to a pane via its
unique identifier the target of any given send function in this script
will stay fixed.<br />
<br />
Tip: You can find out the unique identifier of a pane by either passing
<code>tmux list-panes -t x</code> where <code>x</code> is the name of the session. Or (the
easier way) you let the unique identifier of every pane be shown in your
tmux status bar with the option <code>#D</code>; e.g.: <code>set -g status-left #D</code>. (All
possible options about what to display in the statusbar can be found via
<code>man tmux</code> or some internet searching.)<br />
<br />
(4) In this fork of tslime.vim, keybindings are not set automatically
for you. Instead, you can map whatever you'd like to one of the
plugin-specific bindings in your <code>.vimrc</code> file.<br />
<br />
The script can be downloaded here: <a href="https://github.com/lord-garbage/tslime.vim">https://github.com/lord-garbage/tslime.vim</a><br />
<br />
<br />
Take care,<br />
Christian <br />
<a class="anchor" href="https://github.com/lord-garbage/tslime.vim#setting-keybindings" name="user-content-setting-keybindings"></a>braunerhttp://www.blogger.com/profile/06745755313587516149noreply@blogger.com0tag:blogger.com,1999:blog-279142444268455552.post-3346458630057574272014-02-23T17:12:00.000+01:002014-02-23T19:23:57.799+01:00Prevent Google Hangouts from auto-adjusting volume levelsA lot of users have noticed that Google Hangouts auto-adjusts your microphone and volume level. This is quite annoying leading to most unpleasant problems while hanging out (on Google). But there is an easy workaround for GNU/Linux-distributions. Got to<span style="font-family: Georgia, "Times New Roman", serif;"> ~/.config/google-googletalkplugin/ and edit the file named “options”</span>. In it you will find the following variables:<br />
<br />
<span style="font-family: Georgia,"Times New Roman",serif;">audio-flags= </span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">audio-input=<br />audio-output=<br />known-audio-flags=</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">video-capture=</span><br />
<br />
Now, set audio-flags from its current value (most likely 16) to 1:<br />
<br />
<span style="font-family: Georgia,"Times New Roman",serif;">audio-flags=1</span><br />
<br />
Reboot your system and your done.<br />
<br />
P.S.: Here is an optional test to see if it worked. Before changing the value in <span style="font-family: Georgia,"Times New Roman",serif;">~/.config/google-googletalkplugin/options</span> open a terminal and type alsamixer. Then press F4 to go to the capture devices sections. There you will see a bar entitled “capture” set it to a high value such as 90 or so. Then open Google Hangout with a friend (or not - that doesn’t really matter). Say a couple of loud things and observe how Google adjusts the level as shown in the capture bar.<br />
<br />
Now go on and make the changes as explained above. (Don’t forget to reboot.) Then repeat the test-procedure I just explained and observe that Google won’t adjust the level as shown in the capture bar anymore.<br />
<br />
Take Care<br />
Christianbraunerhttp://www.blogger.com/profile/06745755313587516149noreply@blogger.com1tag:blogger.com,1999:blog-279142444268455552.post-50106005021998237282014-02-08T21:57:00.000+01:002014-02-10T12:22:57.683+01:00Mutt and Ethan Schoonover’s solarized color schemeI am a huge fan of <a href="http://ethanschoonover.com/solarized" target="_blank">Ethan Schoonover’s solarized color palette</a>. Basically, I use it with every application which allows me to do so: xterm, dwm and of course the mighty mutt. But as some people have noticed when mutt is compiled against ncurses not all colors of the solarized scheme are displayed correctly. To wit:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdHviy4tw-y5mgezzN-RRcNAoBz_ePMGhqBDliFTCgHyCh-N-EmcRDaaYDCd55sHSAcTUG9U-U0Bq-AxXdrl0l-BtriBjdpSDPm_gxXF6G4AKx3oLgT6_5gs-cQHrlhPbynVaLxdfmmWE/s1600/screenshot-0a.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdHviy4tw-y5mgezzN-RRcNAoBz_ePMGhqBDliFTCgHyCh-N-EmcRDaaYDCd55sHSAcTUG9U-U0Bq-AxXdrl0l-BtriBjdpSDPm_gxXF6G4AKx3oLgT6_5gs-cQHrlhPbynVaLxdfmmWE/s1600/screenshot-0a.jpg" height="195" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Names and Subjects blackened.</td></tr>
</tbody></table>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
I use the light solarized scheme. So obviously the background should not be, well..., black. (One obvious solution would be to compile mutt against slang. Not a solution I prefer as I do not want to install another package. Keeping a minimal system etc. etc. blabla... Ncurses is good enough.)<br />
<br />
I found the problem in my case to be my xterm background. I already use the solarized light scheme in xterm. Hence, the colors that get called by the mutt color scheme file seem to conflict with the background of my xterm. (Just my crude approximation of the problem.) This can be avoided by substituting some color definitions in the mutt solarized color file. The solution is to replace a lot of the very specific color specifications of the colorscheme by the value <span style="font-family: "Courier New", Courier, monospace;">default</span>. <span style="font-family: inherit;">I have done this in the file you can download <a href="https://drive.google.com/file/d/0B_UAut69TSAiVVBtYUxfRTg3VG8/edit?usp=sharing" target="_blank">here</a>.</span> Although, this is only a solution for the light solarized 256 color scheme (And maybe even one only for my specific case.) it may give a hint that leads to a final solution.<br />
<br />
After substituting the correct value:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAZA_qG8WMnjmH1RMWoCxyN4nghccyckDfln8KY8ezuSGI5j-teql6UtPgo70csf6WMU4NVBQzfkAJXljttKyZq9CnYG3rXRIXBJfyrYqM7o-hgJeYekREfDXNjdeyjRSewakQtwLqWz8/s1600/screenshot1-0b.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAZA_qG8WMnjmH1RMWoCxyN4nghccyckDfln8KY8ezuSGI5j-teql6UtPgo70csf6WMU4NVBQzfkAJXljttKyZq9CnYG3rXRIXBJfyrYqM7o-hgJeYekREfDXNjdeyjRSewakQtwLqWz8/s1600/screenshot1-0b.jpg" height="195" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Names and Subjects blackened.</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
Take care,<br />
Christianbraunerhttp://www.blogger.com/profile/06745755313587516149noreply@blogger.com1Tübingen, Germany48.5216364 9.057644799999934548.3533654 8.7349212999999342 48.689907399999996 9.3803682999999349tag:blogger.com,1999:blog-279142444268455552.post-35767963089677283282013-11-20T11:18:00.002+01:002013-11-20T12:08:06.449+01:00Copy from Vim to the clipboard without +xterm_clipboard enabledThe easiest way to copy from terminal-based Vim to the system clipboard without the <span style="font-family: "Courier New",Courier,monospace;">+xterm_clipboard</span> option compiled in your version is to edit your <span style="font-family: "Courier New",Courier,monospace;">~/.vimrc</span> for a Linux system or, if you’re using Windows for whatever strange reason (joking), to edit your <span style="font-family: "Courier New",Courier,monospace;">_vimrc</span> file. The advantage is that you won’t need to recompile your own version of vim. Just comment out the following line:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">set mouse=a</span><br />
<br />
with<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">" set mouse=a</span><br />
<br />
The cost is obvious, you will not be able to use the mouse in Vim. Hence, whereas before you could use the mouse to select portions of text in Vim and yank it to some buffer via <span style="font-family: "Courier New", Courier, monospace;">y <span style="font-family: Verdana,sans-serif;">or</span></span> <span style="font-family: Georgia,"Times New Roman",serif;">yy</span> <span style="font-family: inherit;">you will now not be able to do so.</span> Instead the highlighted text will now be treated the same way text is treated you select in your terminal or in other applications that do not have their own clipboards. Thus, you can copy the highlighted text in your terminal with the command (at least on Linux) <span style="font-family: "Courier New", Courier, monospace;">ctrl+shift+C<span style="font-family: Verdana, sans-serif;"> to the system clipboard and it is now available to other applications besides Vim.</span></span><br />
<br />
If you have been using the mouse in Vim until now, commenting out the mouse-usage option in your <span style="font-family: "Courier New",Courier,monospace;">~/.vimrc</span> file is a good opportunity to familiarize yourself with the beauties of a purely keyboard controlled editor. I would suggest that only now you can really start using Vim the way it was designed to be used. And while you’re at it you should really read this: <span style="color: blue;"><a href="http://www.moolenaar.net/habits.html" target="_blank">Vim: Seven habits of effective text editing</a>.</span> Believe me, if you plan on using Vim or even if you have been using Vim for a long time but haven’t read this it is time well spent.<br />
<br />
Linux hint: Another thing I deem useful is to enable copy on select in your terminal. By doing this you will save the time you need to press <span style="font-family: "Courier New", Courier, monospace;">ctrl+shift+C<span style="font-family: inherit;">.</span></span><br />
<br />
Take Care,<br />
Christianbraunerhttp://www.blogger.com/profile/06745755313587516149noreply@blogger.com0Tübingen, Germany48.5216364 9.057644799999934548.3533654 8.7349212999999342 48.689907399999996 9.3803682999999349tag:blogger.com,1999:blog-279142444268455552.post-85752045866545313772013-09-05T15:34:00.000+02:002013-09-07T11:30:34.562+02:00Spotify for OpenSuse 12.3: *.rpm package creation instructions and precompiled *.rpm package<div style="text-align: justify;">
Once again: Spotify has been available as a beta version for Linux for some time now but as far as I know only for *.deb (Quick remark: I use the symbol “*” as a string variable that in a specific situation needs to be replaced by the actual name of the package or file I'm referring to.) based distributions. I recently switched to OpenSuse 12.3 for technical reasons and wanted to install Spotify. This time I decided to post instructions on how to compile a *.rpm package from the most current *.deb package and at the same time provide a precompiled package. Here are the instructions:</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
0. Issue the command:</div>
<div style="text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">script spotify.log</span></div>
<div style="text-align: justify;">
<span style="font-family: inherit;">to create a *.log file that serves as a documentation for what you did. (This step is optional and is only done in order to help you to reverse any changes you made to your system if you decide to uninstall Spotify later e. g. if a native OpenSuse package should be available at some point. I usually create *.log files with </span><span style="font-family: Courier New, Courier, monospace;">script </span><span style="font-family: inherit;">to be able to reverse any changes I made that bypassed the software management system. Here it will be helpful because you can remove the symlinks you're going to create at the end of the installation process.)</span></div>
<div style="text-align: justify;">
<span style="font-family: inherit;"><br /></span></div>
<div style="text-align: justify;">
1. Download the current *.deb package from <a href="http://repository.spotify.com/pool/non-free/s/spotify/" target="_blank"><span style="color: #0b5394;">http://repository.spotify.com/pool/non-free/s/spotify/</span></a>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
2. Make sure that you have the “alien” and “rpm-build” packages installed on your *.rpm based distro.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
3. Issue the following command: </div>
<div style="text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">sudo alien -r *.deb</span></div>
<div style="text-align: justify;">
<span style="font-family: inherit;">The command should exit with:</span></div>
<div style="text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">*.rpm generated</span></div>
<div style="text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div style="text-align: justify;">
4. Next use:</div>
<div style="text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">sudo zypper install *.rpm</span></div>
<div style="text-align: justify;">
During the installation (at least on OpenSuse 12.3) you will run into the following problem:</div>
<div style="text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">Problem: nothing provides libcrypto.so.0.9.8(OPENSSL_0.9.8)(64bit) needed by spotify-client-0.9.1.55.gbdd3b79.203-2.x86_64</span></div>
<div style="text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;"> Solution 1: do not install spotify-client-0.9.1.55.gbdd3b79.203-2.x86_64</span></div>
<div style="text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;"> Solution 2: break spotify-client-0.9.1.55.gbdd3b79.203-2.x86_64 by ignoring some of its dependencies</span></div>
<div style="text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">Choose from above solutions by number or cancel [1/2/c] (c):</span></div>
<div style="text-align: justify;">
<span style="font-family: inherit;">Choose </span><span style="font-family: Courier New, Courier, monospace;">2</span><span style="font-family: inherit;">.</span></div>
<div style="text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div style="text-align: justify;">
5. Set necessary symlinks:</div>
<div style="text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">sudo ln -s </span><span style="background-color: #f9f9f9; font-family: monospace, Courier; font-size: 13px; line-height: 1.3em;">/usr/lib64/libnss3.so /usr/lib64/libnss3.so.1d</span></div>
<div style="text-align: justify;">
<span style="font-family: 'Courier New', Courier, monospace;">sudo ln -s </span><span style="background-color: #f9f9f9; font-family: monospace, Courier; font-size: 13px; line-height: 1.3em;">/usr/lib64/libnssutil3.so /usr/lib64/libnssutil3.so.1d</span></div>
<div style="text-align: justify;">
<span style="font-family: 'Courier New', Courier, monospace;">sudo ln -s </span><span style="background-color: #f9f9f9; font-family: monospace, Courier; font-size: 13px; line-height: 1.3em;">/usr/lib64/libsmime3.so /usr/lib64/libsmime3.so.1d</span></div>
<div style="text-align: justify;">
<span style="font-family: 'Courier New', Courier, monospace;">sudo ln -s </span><span style="background-color: #f9f9f9; font-family: monospace, Courier; font-size: 13px; line-height: 1.3em;">libplc4.so /usr/lib64/libplc4.so.0d</span></div>
<div style="text-align: justify;">
<span style="font-family: 'Courier New', Courier, monospace;">sudo ln -s </span><span style="background-color: #f9f9f9; font-family: monospace, Courier; font-size: 13px; line-height: 1.3em;">libnspr4.so /usr/lib64/libnspr4.so.0d</span></div>
<div style="text-align: justify;">
<span style="background-color: #f9f9f9; font-family: monospace, Courier; font-size: 13px; line-height: 1.3em;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: inherit;"><span style="line-height: 16.890625px;">6. Issue the command:</span></span></div>
<div style="text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;"><span style="line-height: 16.890625px;">exit</span></span></div>
<div style="text-align: justify;">
<span style="line-height: 16.890625px;"><span style="font-family: inherit;">This will stop the </span><span style="font-family: Courier New, Courier, monospace;">script </span><span style="font-family: inherit;">command started in step 0 and finish the creation of the </span><span style="font-family: Courier New, Courier, monospace;">spotify.log</span><span style="font-family: inherit;"> file</span><span style="font-family: inherit;">.</span></span></div>
<div style="text-align: justify;">
<span style="line-height: 16.890625px;"><span style="font-family: inherit;"><br /></span></span></div>
<div style="text-align: justify;">
<span style="line-height: 16.890625px;"><span style="font-family: inherit;">If you want the easy solution:</span></span></div>
<div style="text-align: justify;">
<span style="line-height: 16.890625px;"><span style="font-family: inherit;">Download the precompiled package <a href="https://docs.google.com/file/d/0B_UAut69TSAiQThwZWhlb3VHTTg/edit?usp=sharing" target="_blank"><span style="color: #0b5394;">here</span></a>. Then only create the symlinks as is explained under 5.</span></span></div>
<div style="text-align: justify;">
<span style="line-height: 16.890625px;"><span style="font-family: inherit;"><br /></span></span></div>
<div style="text-align: justify;">
<span style="line-height: 16.890625px;"><span style="font-family: inherit;"><br /></span></span></div>
<div style="text-align: justify;">
Take Care,</div>
<div style="text-align: justify;">
Christian</div>
braunerhttp://www.blogger.com/profile/06745755313587516149noreply@blogger.com0tag:blogger.com,1999:blog-279142444268455552.post-86387096297088223142013-07-24T15:16:00.000+02:002013-07-24T15:19:39.153+02:00Spotify for Fedora 19A quick update: Spotify has been available as a beta version for Linux for some time now but as far as I know only for *.deb based distributions. If you wanted to install Spotify on *.rpm based distros you needed to compile it from source. I’m glad to announce this is no longer necessary. Find a precompiled package for Fedora 19 (the distro I use) <a href="https://docs.google.com/file/d/0B_UAut69TSAicTFDU01QOVlXc2s/edit?usp=sharing" target="_blank"><span style="color: #3d85c6;">here</span></a>.<br />
<br />
Take Care,<br />
Christianbraunerhttp://www.blogger.com/profile/06745755313587516149noreply@blogger.com0Bielefeld, Germany52.0212965 8.530296599999928751.7085705 7.8848495999999288 52.334022499999996 9.17574359999993tag:blogger.com,1999:blog-279142444268455552.post-55627613317741717932013-06-21T23:22:00.001+02:002014-08-15T09:54:05.146+02:00Vim’s conceal feature and syntax file for all symbols defined by the unicode-math package<div style="text-align: justify;">
<span style="font-family: 'Trebuchet MS', sans-serif;">When writing Latex documents my editor of choice is Vim. I do not use any kind of additional plugins (not even the latex plugin) but only rely on the basic setup. I like to keep things as pure as possible. Thanks to </span><a href="http://b4winckler.wordpress.com/2010/08/07/using-the-conceal-vim-feature-with-latex/" style="font-family: 'Trebuchet MS', sans-serif;" target="_blank"><span style="color: #3d85c6;">Björn Winckler’s</span></a><span style="font-family: 'Trebuchet MS', sans-serif;"> blog my love for Vim has grown even more as it allows you a rudimentary version of Emacs inline formula display via the conceal feature. How this is done you should read on </span><a href="http://b4winckler.wordpress.com/2010/08/07/using-the-conceal-vim-feature-with-latex/" style="font-family: 'Trebuchet MS', sans-serif;" target="_blank"><span style="background-color: white; color: #3d85c6;">Björn’s blog</span></a><span style="font-family: 'Trebuchet MS', sans-serif;">. Instead, I will show you how to make use of Vim’s conceal feature in combination with the unicode-math package (requires LuaLaTeX engine). The <a href="http://ctan.org/pkg/unicode-math" target="_blank"><span style="color: #3d85c6;">unicode-math package</span></a> tries to give a command for every mathematical and logical symbol that is commonly used in modern mathematics and logic and therefore can be considered a necessary complement to the <a href="http://www.stixfonts.org/" target="_blank"><span style="color: #3d85c6;">STIX-project</span></a>. (To wit: here’s the <a href="ftp://ftp.mpi-sb.mpg.de/pub/tex/mirror/ftp.dante.de/pub/tex/macros/latex/contrib/unicode-math/unimath-symbols.pdf" target="_blank"><span style="color: #3d85c6;">list</span></a> of all symbols so far defined by the package.) Of course most editors even the newest ones are slow to get a grip on luatex and on new packages like unicode-math. For the unicode-math package this basically means that they do not conceal the command and show you the symbol it calls in the source code like they do with standard mathematical latex commands. (E.g. most editors will allow you to conceal the command </span><span style="font-family: Courier New, Courier, monospace;">\to</span><span style="font-family: 'Trebuchet MS', sans-serif;"> but they will not allow you to conceal </span><span style="font-family: Courier New, Courier, monospace;">\downzigzagarrow</span><span style="font-family: 'Trebuchet MS', sans-serif;"> which is available via the unicode-math package) This also applies to Vim... At least it did so far. Some weeks ago I took the time to compile a tex.vim syntax file for Vim with a mapping of all commands defined by the unicode-math package to the symbols they stand for in the source code. Some important things to note about that:</span></div>
<div style="text-align: justify;">
<span style="font-family: 'Trebuchet MS', sans-serif;">(1) Trivial: As far as I can see you can only use my syntax file if you use Vim to edit your latex documents.</span></div>
<div style="text-align: justify;">
<span style="font-family: 'Trebuchet MS', sans-serif;">(2) Not Vim specific (Just replace “Vim” with your editor of choice which includes a conceal feature.): The Vim conceal feature only works with fonts that do contain the relevant symbol. Hence, the command actually being not just concealed but replaced by the right symbol is conditional on which font you use in your editor.</span></div>
<div style="text-align: justify;">
<span style="font-family: 'Trebuchet MS', sans-serif;">(3) Analogous (and trivial): Commands defined by the unicode-math package will only lead to the output of a symbol in the compiled document if the used font contains the relevant symbol.</span></div>
<div style="text-align: justify;">
<span style="font-family: 'Trebuchet MS', sans-serif;">(4) If you’re working on a rather long file that includes a lot of formulas and you use the conceal command </span><span style="font-family: Courier New, Courier, monospace;">set col=2</span><span style="font-family: 'Trebuchet MS', sans-serif;">, you may experience a considerable negative impact on scrolling speed. I had this problem with a calculus script and some philosophy related stuff. Here are some observations about how to diminish the problem and how not to solve it (Please go back in the line and notice the “not”.):</span></div>
<div style="text-align: justify;">
<span style="font-family: 'Trebuchet MS', sans-serif;">(4.1) How to not solve it: My <u>tex.vim</u> (Henceforth, I will refer to the one I created as <u>tex.vim</u>.<u>)</u> file resides in my </span><span style="font-family: Courier New, Courier, monospace;">/home/username/.vim/after/syntax/</span><span style="font-family: 'Trebuchet MS', sans-serif;"> folder (I’m using Linux as you may now have noticed. Surprise.) and my suspicion was that Vim was having trouble dealing with two distinct syntax files for one and the same language in two different locations. So I just copied everything in my </span><u style="font-family: 'Trebuchet MS', sans-serif;">tex.vim</u><span style="font-family: 'Trebuchet MS', sans-serif;"> file to the original tex.vim file that Vim is shipped with and erased my </span><u style="font-family: 'Trebuchet MS', sans-serif;">tex.vim</u><span style="font-family: 'Trebuchet MS', sans-serif;"> </span><span style="font-family: 'Trebuchet MS', sans-serif;">file. To put it simply: That didn’t solve anything. So I reversed it.</span></div>
<div style="text-align: justify;">
<span style="font-family: 'Trebuchet MS', sans-serif;">(4.2) Wild guess: My Laptop is too slow. (Works better on newer computers.)</span></div>
<div style="text-align: justify;">
<span style="font-family: Trebuchet MS, sans-serif;">(4.3) If (4.2) applies to you then I can only advise you to use a small font-size. That helps a little. But that’s about it so far. Anyone who has a decent idea: Share it!!!</span></div>
<div style="text-align: justify;">
<span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="font-family: 'Trebuchet MS', sans-serif;">Installation Instructions:</span><br />
<span style="font-family: Trebuchet MS, sans-serif;">On the <a href="http://www.vim.org/scripts/script.php?script_id=4626" target="_blank"><span style="color: #3d85c6;">offical Vim scripts page</span></a> I offer a *.tar file which contains two files: tex.vim and tex.vim~</span><br />
<span style="font-family: Trebuchet MS, sans-serif;">The two files give you two mutually exclusive options (at least if you want to avoid a monster-slow-down-your-scrolling-speed-scenario).</span><br />
<span style="font-family: Trebuchet MS, sans-serif;">Option 1: Take the file named </span><span style="font-family: 'Trebuchet MS', sans-serif;">“</span><span style="font-family: Trebuchet MS, sans-serif;">tex.vim</span><span style="font-family: 'Trebuchet MS', sans-serif;">”</span><span style="font-family: Trebuchet MS, sans-serif;"> and copy it to your local Vim folder. In the Linux case this should be (</span><span style="font-family: Courier New, Courier, monospace;">/usr)/home/username/.vim/after/syntax/</span><span style="font-family: inherit;">.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;">Option 2: Take the file named </span><span style="font-family: 'Trebuchet MS', sans-serif;">“t</span><span style="font-family: Trebuchet MS, sans-serif;">ex.vim~</span><span style="font-family: 'Trebuchet MS', sans-serif;">”</span><span style="font-family: Trebuchet MS, sans-serif;"> and rename it to </span><span style="font-family: 'Trebuchet MS', sans-serif;">“t</span><span style="font-family: Trebuchet MS, sans-serif;">ex.vim</span><span style="font-family: 'Trebuchet MS', sans-serif;">”</span><span style="font-family: Trebuchet MS, sans-serif;"> and replace the original tex.vim syntax file standardly shipped with Vim. Again, in the Linux case the relevant file to replace should reside in </span><span style="font-family: Courier New, Courier, monospace;">/usr/share/vim/vim73/syntax/</span><span style="font-family: Trebuchet MS, sans-serif;">.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="font-family: Trebuchet MS, sans-serif;">Note that the two files are not substitutable for each other. The file named </span><span style="font-family: 'Trebuchet MS', sans-serif;">“t</span><span style="font-family: Trebuchet MS, sans-serif;">ex.vim</span><span style="font-family: 'Trebuchet MS', sans-serif;">”</span><span style="font-family: Trebuchet MS, sans-serif;"> just contains the mapping between the unicode-math commands and the symbols while the </span><span style="font-family: 'Trebuchet MS', sans-serif;">“t</span><span style="font-family: Trebuchet MS, sans-serif;">ex.vim~</span><span style="font-family: 'Trebuchet MS', sans-serif;">”</span><span style="font-family: Trebuchet MS, sans-serif;"> file contains the whole setup of syntax highlighting for TeX and LaTeX documents and for simplicity comes with a different syntax in order to achieve the mapping.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="font-family: Trebuchet MS, sans-serif;">Both options are equally good as far as I can see. But I suggest you use Option 1 in case anything substantial and interesting should change in the standard tex.vim syntax file in the future.</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: 'Trebuchet MS', sans-serif;">You can download Option 1 and Option 2 file from the <a href="http://www.vim.org/scripts/script.php?script_id=4626" target="_blank"><span style="color: #3d85c6;">offical Vim scripts page</span></a> as a *.tar file. I hope this helps some people.</span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<span style="font-family: Trebuchet MS, sans-serif;">Take Care,</span></div>
<div style="text-align: justify;">
<span style="font-family: Trebuchet MS, sans-serif;">Christian</span></div>
<div style="text-align: justify;">
<span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span></div>
braunerhttp://www.blogger.com/profile/06745755313587516149noreply@blogger.com0Bielefeld, Germany52.0212965 8.530296599999928751.7085705 7.8848495999999288 52.334022499999996 9.17574359999993tag:blogger.com,1999:blog-279142444268455552.post-82008631207689266302013-06-21T12:00:00.001+02:002013-06-21T22:24:41.355+02:00(Lua)LaTeX Presentations<div style="text-align: justify;">
One main advantage of Latex has always been that you're free to go with it in any direction you like given some basic knowledge of how it works. My presentations with Latex have never used the beamer class for the simple reason that you can extensively customize a document that uses the scrartcl class of the Koma script as a base. This will give you a host of advantages. Two of them being that (1) with a few simple steps you can convert papers to presentations and presentations to papers and (2) you can use the LuaLaTeX engine to compile (which you cannot do with the beamer package) and therefore all the glorious typographic advantages like choosing any font you want (which is awesome when you need to have any kind of complex formulas in your presentation). But the rationale behind preferring presentations made in scrartcl over presentations made with the beamer package is best explained by <a href="http://tug.org/pracjourn/2010-2/hofert/scientific_presentations_practex.pdf">Marius Hofert and Markus Kohm</a>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The two basic steps to achieve a solid base to start working from are:</div>
<div style="text-align: justify;">
(a)</div>
<div style="text-align: justify;">
<div>
\documentclass</div>
<div>
[</div>
<div>
DIV=11,</div>
<div>
paper=128mm:96mm,</div>
<div>
fontsize=11pt,</div>
<div>
pagesize,</div>
<div>
parskip=half-, % paragraphs are separated by half a line</div>
<div>
numbers=noendperiod, % no periods after section numbers</div>
<div>
captions=nooneline</div>
<div>
]</div>
<div>
{scrartcl}</div>
<div>
<br /></div>
<div>
Different presentation slide sizes include:</div>
<div>
<div>
%128mm:96mm(like beamer)</div>
<div>
%144mm:90mm(16:10),</div>
<div>
%120mm:96mm(16:9),</div>
<div>
%160mm:90mm(HDTV 720p/i),</div>
<div>
%192mm:108mm(HDTV 1080p/i)</div>
</div>
<div>
<br /></div>
<div>
(b)</div>
<div>
<div>
\usepackage{setspace}</div>
<div>
\linespread{1.12} % enlarge line space</div>
<div>
<br /></div>
<div>
\usepackage</div>
<div>
[</div>
<div>
includeheadfoot,</div>
<div>
top=3.5mm,</div>
<div>
bottom=3.5mm,</div>
<div>
left=5.5mm,</div>
<div>
right=5.5mm,</div>
<div>
headsep=6.5mm,</div>
<div>
footskip=8.5mm</div>
<div>
]</div>
<div>
{geometry}</div>
</div>
<div>
<br /></div>
<div>
Coloring and all kinds of fancy stuff you might (think) you need for a good presentation can be added by using the tikz package. You will find some ideas in the article by <a href="http://tug.org/pracjourn/2010-2/hofert/scientific_presentations_practex.pdf">Marius Hofert and Markus Kohm</a>.</div>
<div>
<br /></div>
<div>
Hint: In order to finish a slide and put the content on the next slide use the \clearpage command.</div>
<div>
<br /></div>
<div>
Take care,</div>
<div>
Christian</div>
</div>
braunerhttp://www.blogger.com/profile/06745755313587516149noreply@blogger.com0Bielefeld, Germany52.0212965 8.530296599999928751.7085705 7.8848495999999288 52.334022499999996 9.17574359999993tag:blogger.com,1999:blog-279142444268455552.post-88569378292906702162013-06-20T13:18:00.000+02:002013-06-21T18:45:52.458+02:00LuaLaTeX: Biblatex and Polyglossia<div style="text-align: justify;">
Using LuaLaTeX in connection with Biblatex has not been a problem for some time now... as long as you’ve been using Babel. But with the new Polyglossia package, support for LuaLaTeX has finally been added. Unfortunately version 2.6 of Biblatex is incompatible with Polyglossia. It will give you an error saying something along the lines of „there’s no Babel blablabla“ or any other convenient excuse for making a devoted Luatexnician miserable. As I am one of those who really wanted to use Polyglossia and Biblatex in combination with LuaLaTeX here is the solution:</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
(1) Download v.<span style="background-color: white; color: #444444; font-family: arial, sans-serif; font-size: x-small; line-height: 16px;">≧</span>2.7 of Biblatex from <a href="http://sourceforge.net/projects/biblatex/">http://sourceforge.net/projects/biblatex/</a></div>
<div style="text-align: justify;">
[Texlive 2013 currently only ships with v.2.6 of Biblatex.]</div>
<div style="text-align: justify;">
(2) After unpacking you will have three folders:</div>
<div style="text-align: justify;">
docs/</div>
<div style="text-align: justify;">
tex/latex/biblatex/</div>
<div style="text-align: justify;">
tex/bibtex/</div>
<div style="text-align: justify;">
(3) Navigate to texlive/texmf-dist/tex/latex/ and replace the folder biblatex/ with the downloaded folder</div>
<div style="text-align: justify;">
(4) Analogous for the other two folders.</div>
<div style="text-align: justify;">
(5) And that’s it. Biblatex should now be working with Polyglossia.</div>
<div style="text-align: justify;">
[If it doesn’t make sure that you load Polyglossia after the Fontspec package and all its options. Furthermore, even though Babel will not be used anymore by Biblatex, you still need to load the Csquotes package immediately before loading the Biblatex package if you’re typesetting your bibliography in a language that uses different quotation marks than in American English (e.g. the German „“ and ‚‘).]</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Take Care,</div>
<div style="text-align: justify;">
Christian<br />
<br /></div>
<div style="text-align: justify;">
<br /></div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-41917142-1', 'chbrauner.blogspot.de');
ga('send', 'pageview');
</script>braunerhttp://www.blogger.com/profile/06745755313587516149noreply@blogger.com0Bielefeld, Germany52.0212965 8.530296599999928751.7085705 7.8848495999999288 52.334022499999996 9.17574359999993