Archive for the ‘Tipps & Tricks’ Category.

Creating Dymo Labels with LaTeX

Today I purchased a Dymo 450 label printer. Of course I want to be able to print my labels from LaTeX, so I quickly created a test document.

Important: the correct label size must be set in the printer dialogue.

% For the 11354 label
\documentclass[14pt,ngerman]{scrartcl}
\usepackage[left=7.5mm,right=2mm,top=5mm,bottom=5mm,% 
paperwidth=57mm, paperheight=32mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{palatino}
 
\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}
 
\begin{document}
 
Max Mustermann \\ Musterweg 1 \\ 12345~Musterstadt
 
\end{document}

label1

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

„LaTeX Beginner’s Guide“ for free

Stefann Kottwitz, the autor, told me today that his „LaTeX Beginner’s Guide“ would be available for free today. More information is available from
LaTeX-Community.org or Packt

LaTeX Beginner's Guide

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

Looping with LaTeX — Generating Name Cards

Today I had to generate a few name cards, LaTeX and the pgffor command came very handy doing that. I am not entirely satisfied with this solution, since the margins are hardwired, so if you have a better way just tell me.

\documentclass[45pt,ngerman]{scrartcl}
\usepackage[left=1cm,right=1cm,top=1.5cm,bottom=0.5cm,a4paper]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{pgffor}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{lmodern}
\usetikzlibrary{positioning}
\pagestyle{empty}
\setlength{\parskip}{0pt}
\begin{document}
\centering

\foreach \x in {Manfred Mustermann, Gabi Mustermann, Manuela Mustermann}{
\begin{tikzpicture}
[mybox/.style={rectangle,black,xshift=0cm,yshift=0cm,minimum width=0.975\textwidth,font=\bfseries,draw=black,very thick,align=center, minimum height=0.475\textheight}]
\node at (0,0) [mybox] {\x};
\node at (0,0.475\textheight) [mybox] {};
\end{tikzpicture}\clearpage}

\end{document}

dann

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

Simple looping with LaTeX

Here’s a fairly easy example how to loop through a LaTeX collection/list with the help of the pgffor package

\documentclass[12pt,ngerman]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{pgffor}
\begin{document}

\begin{itemize}
\foreach \x in {Donald,Dagobert,Gustav,Goofy} {\item \x}
\end{itemize}

\end{document}

googy

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

Drawing Bezier Curves with TikZ

To visualize an example for cubic-Bezier CSS animations (http://cubic-bezier.com) I decided to try TikZ. That was in fact a pretty good idea, as — with the help of Google (and mostly tex.stackexchange.com) I managed to complete the following example in just a few minutes:

\documentclass{article}
\usepackage[paperwidth=5.5cm,paperheight=5.3cm,left=0cm,right=0cm,bottom=0cm,top=0.25cm]{geometry}
\usepackage{tikz}
\definecolor{fom}{RGB}{0,153,139}
\begin{document}
 
\begin{tikzpicture}[x=4cm,y=4cm]
\draw[line width=1pt,lightgray] (0,0) -- (1,1); % gray line for the linear animation path
\draw (0,0) -- (1,0) -- (1,1) -- (0,1) -- (0,0); % frame
\draw (0,0) -- (0.17,0.67); % (0,0) to 2. point
\draw (1,1) -- (0.83,0.67); % (1,1) to 3. point
 
\draw [magenta,fill=magenta](0.17,0.67) circle (.5ex); %circle 1
\draw [fom,fill=fom](0.83,0.67) circle (.5ex); % circle 2
 
\draw[line width=1pt] (0,0) .. controls (0.17,0.67) and (0.83,0.67) .. (1,1); % cubic bezier curve
 
% labels
\node[label={[label distance=0.0cm,text depth=-1ex,rotate=90]left:Fortschritt in \%}] at (-0.1,.8) {};
\node[label={[label distance=0.0cm,text depth=-1ex]right:Zeit-Achse}] at (0,-0.1) {};
\end{tikzpicture}
\end{document}

The result is pretty impressive.

bez

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

LaTeX \\ in externe Dateien schreiben

Ich hatte kürzlich die Notwendigkeit, Adressen wie die folgende aus KOMA Briefen in eine externe Datei zu schreiben:

\newcommand{\Anschrift}{John Doe \\ Berlin}

http://stackoverflow.com/questions/2115379/write-and-read-from-a-latex-temporary-file funktionierte leider nicht, da LaTeX das Schreiben der „\\“ bemängelte.

Auch der Weg über \unexpanded führte nicht weiter, da LaTeX dann nur den Befehl, nicht die Expansion in die Datei schreibt.

Die Lösung steckte dann in einer anderen Frage auf TSX: http://tex.stackexchange.com/questions/110883/writing-to-a-file

Das folgende Beispiel ist dabei rausgekommen:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{xpatch}
 
\makeatletter
% get a copy of `\protected@write
\let\protected@iwrite\protected@write
% patch the copy to add \immediate
\xpatchcmd{\protected@iwrite}{\write}{\immediate\write}{}{}
\makeatother
 
\newwrite\tempfile
\newcommand{\Anschrift}{John Doe \\ Berlin}
\immediate\openout\tempfile=Anschrift.txt
\makeatletter
\protected@iwrite\tempfile{\let\\\relax}{\Anschrift}
\immediate\closeout\tempfile
\makeatother
 
\begin{document}
 
\input{Anschrift.txt}
 
\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

Cross-referencing labels in other files

With the xr package one can pull labels from different files, however it is not possible to create hyperref-Hyperlinks with this package.

Fortunately there is a was around this challenge:

„Label-Dokument.tex“ with the label inside

%!TEX TS-program = Arara
% arara: pdflatex
\documentclass[12pt]{scrartcl}
 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\hypersetup{
    bookmarks=true,                     % show bookmarks bar
    unicode=false,                      % non - Latin characters in Acrobat’s bookmarks
    pdftoolbar=true,                        % show Acrobat’s toolbar
    pdfmenubar=true,                        % show Acrobat’s menu
    pdffitwindow=false,                 % window fit to page when opened
    pdfstartview={FitH},                    % fits the width of the page to the window
    pdftitle={Title},                        % title
    pdfauthor={Author},                 % author
    pdfsubject={Subject},                   % subject of the document
    pdfcreator={LaTeX},                   % creator of the document
    pdfproducer={LaTeX},             % producer of the document
    pdfkeywords={keyword1} {key2} {key3},   % list of keywords
    pdfnewwindow=true,                  % links in new window
    colorlinks=true,                        % false: boxed links; true: colored links
    linkcolor=blue,                          % color of internal links
    citecolor=blue,                          % color of internal links
    filecolor=blue,                     % color of file links
    urlcolor=blue                        % color of external links
}
\begin{document}
 
\section{Some Section}
 
In this file I am setting a label. \label{lab:label1}
 
\end{document}

„Ref-Dokument“ with the reference to „Label-Dokument“

%!TEX TS-program = Arara
% arara: pdflatex
\documentclass[12pt,ngerman]{scrartcl}
 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{graphicx}
\usepackage{hyperref}
\hypersetup{
    bookmarks=true,                     % show bookmarks bar
    unicode=false,                      % non - Latin characters in Acrobat’s bookmarks
    pdftoolbar=true,                        % show Acrobat’s toolbar
    pdfmenubar=true,                        % show Acrobat’s menu
    pdffitwindow=false,                 % window fit to page when opened
    pdfstartview={FitH},                    % fits the width of the page to the window
    pdftitle={Title},                        % title
    pdfauthor={Author},                 % author
    pdfsubject={Subject},                   % subject of the document
    pdfcreator={LaTeX},                   % creator of the document
    pdfproducer={LaTeX},             % producer of the document
    pdfkeywords={keyword1} {key2} {key3},   % list of keywords
    pdfnewwindow=true,                  % links in new window
    colorlinks=true,                        % false: boxed links; true: colored links
    linkcolor=blue,                          % color of internal links
    citecolor=blue,                          % color of internal links
    filecolor=blue,                     % color of file links
    urlcolor=blue                        % color of external links
}
\usepackage{zref-xr,zref-user}
\usepackage{nameref}
\zxrsetup{toltxlabel}
\zexternaldocument*{Label-Dokument}
\begin{document}
 
In this document I reference the external label in section \ref{lab:label1} on page \pageref{lab:label1} of the external document.
 
\end{document}

ref

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

Using LaTeX to generate PDFs for mobile phones and tablets

Here’s an example how LaTeX can be used to create PDF files for small screens. The following example is made for the Nokia Lumia 630 but can but easily adjusted.

%!TEX TS-program = LuaLaTeX
\documentclass[7pt,smallheadings]{scrartcl}
\usepackage[paperwidth=56mm,paperheight=92.5mm,top=1mm,left=1mm,bottom=1mm,right=3.5mm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{csquotes}
\usepackage{xkeyval,polyglossia}
\setmainlanguage[spelling=new]{german}
\usepackage{fontspec}
\setmainfont{Verdana}
\usepackage{microtype}
\usepackage{blindtext}
\pagestyle{plain}
\begin{document}
 
\section{Ein Abschnitt}
\subsection{Ein Unterabschnitt}
 
\blindtext[2]
 
\end{document}

lumia

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

Folien von der FrosCon 2014

Hier meine Folien vom heutigen LaTeX-Vortrag auf der FrosCon.

Froscon-2014-Folien (PDF)

TeX Dateien (zip)

Für Einsteiger in Sachen LaTeX sind folgende Dokumente interessant:

Als Buch für Einsteiger empfehle ich das Einführungsbuch von Herbert Voss: http://www.dante.de/index/Literatur/Einfuehrung.html

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

Testing TeX Live’s Aurial font

A few days ago I checked the LaTeX Font Catalogue and found a nice font, Aurial.

\documentclass[12pt,ngerman]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{aurical}
 
\begin{document}
 
\section{Fontlukas}\Fontlukas
 
 
\noindent Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dictum felis a nibh, eu condimentum lectus auctor. Cras quis euismod lorem. Aliquam in nisi felis. Etiam sit amet mauris at magna rhoncus commodo. Nulla neque ipsum, condimentum in nibh sed, eleifend consectetur est. Suspendisse ac laoreet urna. Vivamus sit amet tempor nunc, ac porta mi. Pha\-sellus et ligula ullamcorper, congue ligula non, porta purus. Etiam cursus eros ante, sit amet porta enim adipiscing sed. 
 
\section{Fontamici}\Fontamici
 
\noindent Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dictum felis a nibh, eu condimentum lectus auctor. Cras quis euismod lorem. Aliquam in nisi felis. Etiam sit amet mauris at magna rhoncus commodo. Nulla neque ipsum, condimentum in nibh sed, eleifend consectetur est. Suspendisse ac laoreet urna. Vivamus sit amet tempor nunc, ac porta mi. Pha\-sellus et ligula ullamcorper, congue ligula non, porta purus. Etiam cursus eros ante, sit amet porta enim adipiscing sed. 
\section{Fontlukas-bfseries} \Fontlukas\bfseries
 
\noindent Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dictum felis a nibh, eu condimentum lectus auctor. Cras quis euismod lorem. Aliquam in nisi felis. Etiam sit amet mauris at magna rhoncus commodo. Nulla neque ipsum, condimentum in nibh sed, eleifend consectetur est. Suspendisse ac laoreet urna. Vivamus sit amet tempor nunc, ac porta mi. Pha\-sellus et ligula ullamcorper, congue ligula non, porta purus. Etiam cursus eros ante, sit amet porta enim adipiscing sed. 
 
\section{Fontlukas-slshape} \Fontlukas\slshape
 
\noindent Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dictum felis a nibh, eu condimentum lectus auctor. Cras quis euismod lorem. Aliquam in nisi felis. Etiam sit amet mauris at magna rhoncus commodo. Nulla neque ipsum, condimentum in nibh sed, eleifend consectetur est. Suspendisse ac laoreet urna. Vivamus sit amet tempor nunc, ac porta mi. Pha\-sellus et ligula ullamcorper, congue ligula non, porta purus. Etiam cursus eros ante, sit amet porta enim adipiscing sed. 
 
\section{Fontlukas-bfseries-slshape} \Fontlukas\bfseries\slshape
 
\noindent Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dictum felis a nibh, eu condimentum lectus auctor. Cras quis euismod lorem. Aliquam in nisi felis. Etiam sit amet mauris at magna rhoncus commodo. Nulla neque ipsum, condimentum in nibh sed, eleifend consectetur est. Suspendisse ac laoreet urna. Vivamus sit amet tempor nunc, ac porta mi. Pha\-sellus et ligula ullamcorper, congue ligula non, porta purus. Etiam cursus eros ante, sit amet porta enim adipiscing sed. 
 
\end{document}

fonti

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