Posts tagged ‘LaTeX’

Managing multi-language LaTeX documents

I’d like to maintain one of my presentation in German as well as in English without having to deal with multiple documents. As I use babel anyway, I of course want to use the language defined for it.

I asked in TSX and egreg came up with the perfect solution, Heiko Oberdiek’s iflang package.

\documentclass[ngerman]{scrartcl}
\usepackage{babel,iflang}
\newcommand{\tr}[2]{\IfLanguageName{ngerman}{#1}{#2}}
 
\begin{document}
 
\tr{Deutscher Text}{English text}
 
\end{document}

This solution works well, in the case of five or ten languages I’d probably use a template engine.

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Visualizing Graphs mit Graphviz (and LaTeX) – Part I

This entry is part 1 of 2 in the series GraphViz

This is the first article in a series to describe Graphviz, an amazing tool to generate org charts and relationship diagrams, and ways to work with it from LaTeX. (I need to compile a huge set of slides so my intention is to save some time by automating the process)

I knew of its existence for quite a while but never managed to take anough time to get a closer look. Driven by my job however (the setup of a Private Equity fund of funds involves different legal entities) I decided to give it a try.

Graphviz was developed at the famous AT&T labs and released under Eclipse Public License. It consists of a set of binary tools that are able tranform Graphviz’s description language DOT into graphics.

Until further notice I will use dot, one of the binaries, to transform the examples into PNG. There are other converters like neato, which differ from dot in the way they calculate the distances between the nodes, etc.

Working with Graphviz involves defining nodes and edges between them. See the following, non-minimal example. I use a digraph (other types like e.g. graph are available but I didn’t look up the differences so far), define two nodes a and b and and edge between them.

digraph G{
a [label="Node A"];
b [label="Node B"];
a->b[label=" An edge"];
}

Using the command dot -Tpng nameoffile.gv I get the following PNG:

basic.gv

The above example is a bit more sophisticated than the minimal working example:

digraph G{
hello->world;
}

minimal.gv

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

TeXing with Gummi

There’s a new player in the game of LaTeX editors: Gummi. It was recommeded to me yesterday during the Berlin Linuxtag. The most striking feature is the auto-compile feature. No need to push a button, if it does not detect the user to enter text for more than 2 seconds of, Gummi tries to compile the document in the background. I’ll do some further testing, but so far I like what I saw.

Installation under Xubuntu:

  1. Open a terminal and enter: sudo add-apt-repository ppa:gummi/gummi, see https://launchpad.net/~texworks/+archive/ppa for details.
  2. Run the following command:
    sudo apt-get --no-install-recommends install gummi
    

Some links:

Image (from the Gummi website)

gummi060-1

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Installing TeXworks from PPA under (X)ubuntu

Due to the dependenciesmy Xubuntu wanted to install lots of packages from the Ubuntu TeX Live repository. I didn’t check explicitly but based on earlier experiences it’s safe to assume that it would be outdated. Besides that I had already installed TeX Live 2012. The solution was to check which packages Xubuntu wanted to install and to kick out everything not related with TeXworks.

The following worked smoothl (updated 2016-05-29)y:

  1. Open a terminal and enter: sudo add-apt-repository ppa:texworks/ppa, see https://launchpad.net/~texworks/+archive/ppa for details.
  2. Run the following command:
    sudo apt-get --no-install-recommends install fonts-lato fonts-lmodern javascript-common libjs-jquery libmng2 libmysqlclient20 libpoppler-qt4-4 libpotrace0 libptexenc1 libqt4-dbus libqt4-declarative libqt4-network libqt4-script libqt4-scripttools libqt4-sql libqt4-sql-mysql libqt4-xml libqt4-xmlpatterns libqtcore4 libqtdbus4 libqtgui4 libruby2.3 libsynctex1 libtexlua52 libtexluajit2 libzzip-0-13 lmodern mysql-common qdbus qt-at-spi qtchooser qtcore4-l10n rake ruby ruby-did-you-mean ruby-minitest ruby-net-telnet ruby-power-assert ruby-test-unit ruby2.3 rubygems-integration
    
  3. As of April 2018 the following works nicely:

    sudo apt-get --no-install-recommends install texworks fonts-lato javascript-common libjs-jquery libpoppler-qt5-1 libptexenc1 libqt5concurrent5 libqt5script5 libqt5scripttools5 libqt5xml5 libruby2.3 libsynctex1 libtexlua52 libtexluajit2 libzzip-0-13 rake ruby ruby-did-you-mean ruby-minitest ruby-net-telnet ruby-power-assert ruby-test-unit ruby2.3 rubygems-integration texworks-help-en texworks-scripting-lua texworks-scripting-python
    

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Slides for my ‚Sphinx‘ presentation in Giessen

Here are the slides for my presentation on ‚Sphinx‘, the Python-based publishing tool.

UweZiegenhagen-Sphinx (PDF)

HTML Export example

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Slides for my „Adventures in LaTeX Land“ presentation, Gießen 2013

These are the German slides for my presentation at the 2013 Gießen German TeX Users Conference. It shows examples for the following packages.

PDF, German

  • arara
  • censor
  • menukeys
  • ocgx
  • progressbar
  • pgfgantt
  • romanbar
  • parnotes
  • smartdiagram
  • tikzsymbols

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Neue Version der Herleitung der Linearen Regression verfügbar

Nach Hinweisen auf einen kleinen Fehler (danke Axel!) in meiner Herleitung der Gleichung für die lineare Regression habe eben eine neue Version hochgeladen: linreg.pdf.

Zusätzlich zur Fehlerbeseitigung habe ich mehr erläuternde Kommentare und Formeln hinzugefügt. Selbstredend wurde das Dokument in LaTeX gesetzt; es ist auch ein schönes Beispiel, was mit LaTeX & Co geht:

– die Grafik wurde in Metapost erstellt (heute würde ich sicher TikZ nehmen)
– alle Quelldateien sind im PDF-Container hinterlegt und verlinkt.

Wenn ich mal passenden R-Code finde (Hinweise werden gern entgegen genommen) werde ich noch mehr Beispiele für die Auswirkungen von Anstieg und Achsenabschnitt der Regressionsgeraden auf die Quadratsumme einfügen.

Update 24.06.2018: Ich bin mit den Dateien nach Github umgezogen: https://github.com/UweZiegenhagen/Introduction_Linear_Regression

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Modifying selected text with Autohotkey

Autohotkey is an amazing tool to define hotkeys such as s# that get automatically expanded to \section{}. On earlier occasions I had already written some blog posts on this topic. Today (encouraged by a question on tex.stackexchange) I managed to compile a short script, which takes some selected text, inserts a specific command and pastes the selected text again. Quite helpful if one want’s to define a shortcut to e.g. make the selected text bold.

F4::
Send ^c
Send \command{{}{}}{LEFT}
Send ^v
Return

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Calendars with Excel and pgfgantt, Part II

Since the last example of my pgfgantt-calendar generated a PDF with 1,60m width I decided to switch to a quarterly calendar. It took me quite a while to figure out the necessary Excel formulas (one may even find easier ways) but it works.

The green part contains some basic variables, e.g. when a quarter starts and ends. In the red part you just enter your dates. The violet part generates the entries for pgfgantt, the red box holds the copy&paste-ready entries for the TeX code. The code is able to handle events exceeding a single quarter.

23.01

Excel Code

final PDF

\documentclass{article}
\usepackage[landscape,a3paper,left=1cm,right=1cm,top=1cm,bottom=1cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{pgfgantt}
\usetikzlibrary{calendar}
 
\protected\def\aaa#1{%
\pgfcalendarifdate{2012-12-31+#1}{weekend}% Test if it's a weekend
{\textcolor{red}{\pgfcalendarifdateday}}% Typeset with red color
{\pgfcalendarifdateday}% Or just the number
}
 
\protected\def\bbb#1{%
\pgfcalendarifdate{2013-03-31+#1}{weekend}% Test if it's a weekend
{\textcolor{red}{\pgfcalendarifdateday}}% Typeset with red color
{\pgfcalendarifdateday}% Or just the number
}
 
\protected\def\ccc#1{%
\pgfcalendarifdate{2013-06-30+#1}{weekend}% Test if it's a weekend
{\textcolor{red}{\pgfcalendarifdateday}}% Typeset with red color
{\pgfcalendarifdateday}% Or just the number
}
 
\protected\def\ddd#1{%
\pgfcalendarifdate{2013-09-30+#1}{weekend}% Test if it's a weekend
{\textcolor{red}{\pgfcalendarifdateday}}% Typeset with red color
{\pgfcalendarifdateday}% Or just the number
}
 
 
\begin{document}
\begin{flushright}
%\begin{tikzpicture}[scale=0.5, every node/.style={scale=0.25}]
\begin{ganttchart}[hgrid, vgrid, x unit=0.4cm]{90}
\gantttitle{1. Quartal}{90} \\
\gantttitlelist[
title list options={var=\y, evaluate=\y as \x using {"\aaa{\y}"}}
]{1,...,90}{1} \\
\ganttbar[bar/.style={fill=red}]{Neujahr}{1}{1}\\
\ganttbar[bar/.style={fill=yellow}]{Feiertag}{42}{42}\\
\ganttbar[bar/.style={fill=red}]{Feiertag}{88}{88}\\
\ganttbar[bar/.style={fill=green}]{Frühling}{79}{90}\\
\end{ganttchart}\vspace*{1cm}
 
\begin{ganttchart}[hgrid, vgrid, x unit=0.4cm]{91}
\gantttitle{2. Quartal}{91} \\
\gantttitlelist[
title list options={var=\y, evaluate=\y as \x using {"\bbb{\y}"}}
]{1,...,91}{1} \\
\ganttbar[bar/.style={fill=yellow}]{Feiertag}{1}{1}\\
\ganttbar[bar/.style={fill=red}]{Tag der Arbeit}{31}{31}\\
\ganttbar[bar/.style={fill=yellow}]{Herrentag}{39}{39}\\
\ganttbar[bar/.style={fill=green}]{Frühling}{1}{81}\\
\ganttbar[bar/.style={fill=yellow}]{Sommer}{82}{91}\\
\end{ganttchart}\vspace*{1cm}
 
\clearpage
 
\begin{ganttchart}[hgrid, vgrid, x unit=0.4cm]{92}
\gantttitle{3. Quartal}{92} \\
\gantttitlelist[
title list options={var=\y, evaluate=\y as \x using {"\aaa{\y}"}}
]{1,...,92}{1} \\
\ganttbar[bar/.style={fill=yellow}]{Sommer}{1}{83}\\
\ganttbar[bar/.style={fill=brown}]{Herbst}{84}{92}\\
\end{ganttchart}\vspace*{1cm}
 
\begin{ganttchart}[hgrid, vgrid, x unit=0.4cm]{92}
\gantttitle{4. Quartal}{92} \\
\gantttitlelist[
title list options={var=\y, evaluate=\y as \x using {"\aaa{\y}"}}
]{1,...,92}{1} \\
\ganttbar[bar/.style={fill=brown}]{Herbst}{1}{81}\\
\end{ganttchart}
 
\end{flushright}
\end{document}

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Kommentare in LaTeX ein- und ausblenden

Was ich in LaTeX vermisse, ist der Überarbeiten Modus von MS Office. Alle Hacks, die etwas ähnliches in LaTeX umsetzen, sind nicht so integriert wie in Word. Hier aber mal ein Beispiel, was mit LaTeX geht. Den Hinweis auf comment.sty habe ich auf der EuroTeX in Breskens von L. Arnold aufgeschnappt, zusätzlich bot http://www.astro.gla.ac.uk/~matthew/blog/?p=376 einen guten Überblick über das Paket.

Im folgenden Beispiel nutze ich das ifdraft Paket, um zu prüfen, ob „draft“ gesetzt wurde. Wenn dies der Fall ist, werden die drei Kommentar-Umgebungen eingeblendet, ansonsten nicht.

\documentclass[ngerman,draft]{article}
%\documentclass[ngerman]{article}
\usepackage{ifdraft}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{xcolor}
\usepackage{comment}
 
\ifdraft{%
\includecomment{versiona}%
\includecomment{versionb}%
\specialcomment{notea}{\begingroup\sffamily\color{red}}{\endgroup}
}{%
\excludecomment{versiona}%
\excludecomment{versionb}%
\excludecomment{notea}%
}
 
\begin{document}
 
Hallo Text. Durch Setzen der Klassenoption \texttt{draft} werden alle Kommentare eingeblendet.
 
 
\begin{versiona}
Hallo, ich bin der Text zu Version A.
\end{versiona}
 
 
\begin{versionb}
Hallo, ich bin der Text zu Version B.
\end{versionb}
 
\begin{notea}
Ich bin eine Note A.
\end{notea}
 
\end{document}

Ich denke, hieraus lassen sich noch einige schöne Anwendungen bauen.

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website