Archive for the ‘Pakete’ Category.

Typesetting Chessboard with the chessboard package

I recently started Chess again, so I wanted to typeset some chessboards. With the chessboard package by Ulrike Fischer this is pretty much straight forward. Here’s a 2-page example what the package can do. It can do much more, I’ll post additional examples if I find some time.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[left=1cm,right=1cm,top=2cm,bottom=2cm]{geometry}
\usepackage{chessboard,xskak}
\usepackage{graphicx,booktabs}
\pagestyle{empty}
\setlength{\parindent}{0pt}
\begin{document}\centering
 
\scalebox{2}{\chessboard[setpieces={Ne4,Ka1,ka2}]}
 
\scalebox{2}{%
\setchessboard{showmover=false}
\newchessgame
\chessboard}
 
\scalebox{2}{%
\setchessboard{showmover=true}
\chessboard[setpieces={Ka1,ka2,Rb1,rb2,Nc1,nc2,Qd1,qd2,Be1,be2,Pf1,pf2,Qd3},
    pgfstyle=straightmove,
    arrow=stealth,
    linewidth=.25ex,
    padding=1ex,
    color=red!75!white,
    pgfstyle=straightmove,
    shortenstart=1ex,
    showmover=true,
    markmoves={d3-h7,d3-a6,d3-b1,d3-f1,d3-d8,d3-d1,d3-a3,d3-h3}]
}
 
Capital letters for white, small letters for black.
 
\begin{tabular}{cll} \toprule
Letter & English & German \\ \midrule
K & King & König \\
Q & Queen & Dame \\
R & Rook & Turm \\
N & Knight & Pferd \\
B & Bishop & Läufer \\
P & Pawn & Bauer \\ \bottomrule
\end{tabular}
 
\end{document}

chess

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

A simple exsheets/tasks Example

Here’s a simple example for the exsheets/tasks packages, taken from the tasks Documentation.

\documentclass[12pt,ngerman]{scrartcl}
 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{tasks}
\usepackage{exsheets}
 
\begin{document}
 
\settasks{
counter-format = qu.tsk,
item-indent = 2em,
label-width = 2em,
label-offset = 0pt
}
 
\begin{question}[type=exam]{4}
I have these two tasks for you. Shall we begin?
\begin{tasks}(2)
\task The first task: easy!
\task The second task: even more so!
\end{tasks}
\end{question}
 
\begin{solution}[print]
Now, let's see\ldots\ ah, yes:
\begin{tasks}
\task This is the first solution. Told you it was easy.
\task This is the second solution. And of course you knew that!
\end{tasks}
\end{solution}
 
\end{document}

ex

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

Short eso-pic example

Whenever I have to put something on an arbitrary position on a page, I like to use the eso-pic package. Here’s a short example how it works:

\documentclass[12pt,ngerman]{scrreprt}
 
\usepackage{eso-pic,rotating,graphicx}
\usepackage{blindtext}
 
\author{John Doe}
\title{Some Thesis}
 
\begin{document}
 
\AddToShipoutPicture*{\put(200,200){\rotatebox{45}{\scalebox{3}{Examiners copy}}}}
\maketitle
 
\blindtext
 
\end{document}
 
<a href="http://uweziegenhagen.de/wp-content/uploads/2014/02/eso.png"><img src="http://uweziegenhagen.de/wp-content/uploads/2014/02/eso.png" alt="eso" width="491" height="711" class="aligncenter size-full wp-image-2915" /></a>

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

Conditional typesetting based on the used Babel language

Here is a short piece of code that shows how the set document language may be evaluated during the LaTeX run. Credit goes to Heiko Oberdiek for his nice iflang package.

\documentclass[english]{scrartcl}
\usepackage{babel,iflang}
\newcommand{\tr}[2]{\IfLanguageName{ngerman}{#1}{#2}}
 
\begin{document}
 
\tr{Deutscher Text}{English text}
 
\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

Conditional typesetting with ifthen

ifthen.sty allows the definition of various interesting constructs to control, which parts of a document are printed. Here’s a short example for the use of boolean variables:

\documentclass{minimal}
 
\usepackage{ifthen}
\newboolean{somevariable}
\setboolean{somevariable}{false}
 
\begin{document}
 
\ifthenelse{\boolean{somevariable}}{Text if somevariable is true.}{Text if somevariable is false.}
 
\end{document}

ifthen (PDF)

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 boolean switches in LaTeX

Here’s a small example how to typeset conditional text. There may be other solutions available (see etoolbox or use LuaTeX), however I like ifthen.sty

\documentclass{minimal}
 
\usepackage{ifthen}
\newboolean{somevariable}
\setboolean{somevariable}{false}
 
\begin{document}
 
\ifthenelse{\boolean{somevariable}}{Text if somevariable is true.}{Text if somevariable is false.}
 
\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

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

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

BibLaTeX & biber workflow example

Here a simple example to illustrate the workflow with biblatex and biber (on TeX Live 2012). It also prints a second bibliography just for the books (one in this case)

literaturvz.bib contains:

@Article{lit1,
author = {Nabuurs, S.B. and Spronk, C.A.E.M.},
title = {Biomolecular Structure Determination by NMR Spectroscopy Allows for Major Errors},
year ={2006},
volume = {2},
journal = {PLoS Comput. Biology}}

@Article{lit2,
author = {Exner, T. E. and Mezey, P. G.},
title = {The Field-Adapted ADMA Approach: Introducing Point Charges},
year ={2004},
volume ={108},
journal = {J. Phys. Chem. A}}

@Article{lit3,
author = {Exner, T. E. and Mezey, P. G.},
title = {Ab Initio Quality Properties for Macromolecules Using the ADMA Approach},
year ={2003},
volume ={24},
journal = {J. Comp. Chem.}}

@Article{lit4,
author = {Barua, B. and Lin, J.C. and Williams, V.D.},
title = {The Trp-cage: optimizing the stability of a globular miniprotein},
year ={2008},
volume = {21},
journal = {Protein Engineering, Design \& Selection}}

@Article{weinhold,
author = {F. Weinhold and C.R. Landis},
title = {Natural Bond Orbitals and Extensions of Localized Bonding Concept},
year ={2001},
journal = {Chemistry in Europe: Research and Practice in Europe},
volume = {2},
number = {2},
pages = {91-104}}

@Manual{weinhold1,
author = {F. Weinhold},
title ={NBO 5.0 Program Manual; Natural Bond Orbital Analysis Programs}}

@Book{test1,
type = book,
author = {some author},
year = {2012},
title ={Some arbitrary book title},
publisher = {Some publisher}
}

@Misc{strassner,
author = {Th. Stra{\ss}ner},
year = {2007},
howpublished = {http://www.chm.tu-dresden.de/oc3/documents/oc3/populationsanalyse.pdf}}

@Booklet{gaussian03,
author = {{\AE}. Frisch and M.J. Frisch and G.W. Trucks},
title = {\textit{Gaussian 03}, User`s Reference},
year = {2003}}

@Manual{gaussian,
author = {M.J. Frisch and G.W. Trucks and H.B. Schlegel and G.E. Scuseria and M.A. Robb and J.R. Cheeseman and J.A. Montgomery Jr. and T. Vreven and K.N. Kudin and J.C. Burant and J.M. Millam and S.S. Iyengar and J. Tomasi and V. Barone and B. Mennucci and M. Cossi and G. Scalmani and N. Rega and G.A. Petersson and H. Nakatsuji and M. Hada and M. Ehara and K. Toyota and R. Fukuda and J. Hasegawa and M. Ishida and T. Nakajima and Y. Honda and O. Kitao and H. Nakai and M. Klene and X. Li and J.E. Knox and H.P. Hratchian and J.B. Cross and C. Adamo and J. Jaramillo and R. Gomperts and R.E. Stratmann and O. Yazyev and A.J. Austin and R. Cammi and C. Pomelli and J.W. Ochterski and P.Y. Ayala and K. Morokuma and G.A. Voth and P. Salvador and J.J. Dannenberg and V.G. Zakrzewski and S. Dapprich and A.D. Daniels and M.C. Strain and O. Farkas and D.K. Malick and A.D. Rabuck and K. Raghavachari and J.B. Foresman and J.V. Ortiz and Q. Cui and A.G. Baboul and S. Clifford and J. Cioslowski and B.B. Stefanov and G. Liu and A. Liashenko and P. Piskorz and I. Komaromi and R.L. Martin and D.J. Fox and T. Keith and M.A. Al-Laham and C.Y. Peng and A. Nanayakkara and M. Challacombe and P.M.W. Gill and B. Johnson and W. Chen and M.W. Wong and C. Gonzalez and J.A. Pople},
title ={Gaussian 03, Revison C.02},
year = {Gaussian, Inc., Wallingford CT, USA, 2004}}

The TeX document (filename is biblatex-test-biber.tex) contains:

\documentclass[11pt]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[german]{babel}

%\usepackage[style=authortitle-dw,backend=bibtex8]{biblatex}%authortitle-icomp
\usepackage[style=authortitle-icomp,backend=biber]{biblatex}%
\usepackage[babel,german=quotes]{csquotes}%guillemets

\addbibresource{literaturvz.bib}

\begin{document}

\cite{weinhold}

\clearpage

\parencite{weinhold}

\clearpage

\footcite[12]{weinhold}

\clearpage

\smartcite[12, smart]{weinhold}

\clearpage

\citeauthor{weinhold}

\clearpage

\citetitle{weinhold}

\clearpage

\citeyear{weinhold}

\nocite{*}

\printbibliography 

\printbibliography[title={Book references},type=book]

\end{document}

To create the final PDF run:

  1. pdflatex biblatex-test-biber
  2. biber biblatex-test-biber
  3. pdflatex biblatex-test-biber

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

Normpages with stdpage

Translators and correctors are usually paid on the number of standard pages, commonly having 60 characters per line and 30 lines per page. The stdpage package helps you generate those normpages. Here is a short example for the use of this package:

\documentclass[12pt,ngerman]{scrartcl}
 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{blindtext}
 
\usepackage{stdpage}
 
\begin{document}
 
\blindtext[5]
 
\end{document}

24.01

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