Directory macros/luatex/latex/robotkarol
robotkarol — Robot Karol worlds and block programs for teaching material
Version 3.10 (2026-09-24) — Anselm Wagner <anselm.wagner@posteo.de>
The robotkarol package draws worlds and Blockly-style block programs in the visual style of the German teaching environment Robot Karol Online (https://karol.arrrg.de/), for use in worksheets, exams, and slides. Colours and proportions were measured from the original interface and rebuilt with TikZ; no artwork is copied.
Features
karolweltenvironment: full 2-D worlds rendered either as a 3-D oblique view (with room frame, brick stacks, markers, walls, and the Karol avatar) or as a 2-D top view matching the original interface.\karolzeile: compact string notation for one-row worlds (\karolzeile{> Z 2 {2M} M Q}), drawn with the very same building blocks askarolwelt— a one-row world is visually akarolweltwithlaenge=1, only the input is shorter. Plus helpers for before/after pairs, empty grids, and legends.karolbloeckeenvironment and block commands (\bbefehl,\bwiederholemal,\bwenndannsonst, …) reproducing the Blockly editor: exact colours, flat design, condition plugs, number pills, ghost blocks and empty sockets for cloze exercises.- Inline blocks (
\ibefehl,\iwenndann,\iwiederholemal, …) set a single block into running text: the block's text baseline sits exactly on the surrounding baseline, the label takes the surrounding font size, and the notches are shallower so the block's height stays close to the line height. Blocks that would span several lines in a stack appear inline with their header only. - Start and goal states in one picture, the way the online tasks show them:
\ziegel[x=4, y=2, hinlegen]and\marke[x=2, y=2, loeschen]mark what is to appear and what is to go. Unchanged objects look as they always did, objects to be removed are crossed out, objects to be placed appear translucent with an arrow (a yellow cross for markers). The environment keyzustand=start|ziel|beidespicks the view, thekarolweltpaarenvironment puts start and goal side by side, andauftrag=aufraeumen/auftrag=aufbauenstate that the goal or the start is the empty world. nummernwrites the coordinates along the edges of akarolwelt, counted from 1 likex=andy=. Since version 3.10 the field numbers of\karolzeilecount from 1 as well (they used to start at 0), and so does itshervorhebenkey.- Two figures, switched with
\karolfigur{karol}(default) or\karolfigur{emma}(long hair and a flower). - The fonts of the online interface: labels in Noto Sans, program text in Hack (falling back to DejaVu Sans Mono when Hack is not installed). Load the package as
\usepackage[schrift=dokument]{robotkarol}to use the document's own\sffamily/\ttfamilyinstead — that also avoids loadingfontspec. - A toner-saving print mode:
\usepackage[druck]{robotkarol}— or\karolsetup{druck=true}at any point, group-local — redraws every view in greyscale. It is deliberately not minimal but sufficient: areas stay as light as possible while everything that carries meaning remains legible — brick stacks stay countable, markers stand out on the bricks they sit on, and a\bbefehlis still told apart from a\baufruf: the latter is hatched at 45°, since the two share the same shape and are told apart by colour alone in the original. \karolonline{2t7t}links to a task in Robot Karol Online: it typesetskarol.arrrg.de/#2t7t— what you actually have to type — and links it tohttps://karol.arrrg.de/#2t7t. This is why the package loadshyperref(at the very end of the preamble, so your own\usepackage[...]{hyperref}still works). Load the package as\usepackage[hyperref=false]{robotkarol}to prevent that; the command then sets the same text without a link.karolcodeenvironment for syntax-highlighted Karol source text and helpers for structograms (viastruktex).- All colours and dimensions adjustable through
\karolsetup.
Requirements
LuaLaTeX (the package warns if \directlua is missing), expl3, TikZ (including its patterns.meta library), listings, struktex, graphicx, and — unless loaded with schrift=dokument — fontspec and the Noto Sans fonts (both in TeX Live). Unless loaded with hyperref=false, it also loads hyperref.
Installation
Put robotkarol.sty where LaTeX finds it, e.g.
TEXMFHOME/tex/latex/robotkarol/robotkarol.sty
and refresh the file database (mktexlsr) if your distribution needs it. robotkarol.cwl is a command list for TeXstudio's auto-completion and belongs in that editor's completion/user directory; it is not needed to typeset documents.
Files
| File | Purpose |
|---|---|
robotkarol.sty |
the package |
robotkarol-doc.tex, robotkarol-doc.pdf |
manual (German, English abstract) |
robotkarol-beispiel.tex, robotkarol-beispiel.pdf |
example document |
robotkarol.cwl |
TeXstudio auto-completion |
Documentation
See robotkarol-doc.pdf (German, with an English abstract). A quick start:
\usepackage{robotkarol} ... \begin{karolwelt}[breite=5, laenge=3] \karol[x=1, y=2, richtung=osten] \ziegel[x=2, y=2, anzahl=4] \marke[x=5, y=2] \end{karolwelt} Karol checks \iwenndann{IstZiegel} and repeats \iwiederholemal{5}.
License
LaTeX Project Public License, version 1.3c or later (https://www.latex-project.org/lppl.txt). This work has the LPPL maintenance status maintained; the current maintainer is Anselm Wagner.
Copyright (C) 2026 Anselm Wagner <anselm.wagner@posteo.de>
Download the contents of this package in one zip archive (390.3k).
Robotkarol – Worlds and block programs of the German teaching environment Robot Karol
The package robotkarol draws worlds and Blockly-style block programs of the German teaching environment Robot Karol; 3D oblique or 2D top view; single blocks can be set inline in running text, aligned to the surrounding baseline; requires LuaLaTeX and expl3.
| Package | Robotkarol |
| Version | 3.10 2026-09-24 |
| Licenses | The LaTeX Project Public License 1.3c |
| Copyright | 2026 Anselm Wagner |
| Maintainer | Anselm Wagner |
| Contained in | TeX Live as robotkarol MiKTeX as robotkarol |
| Topics | LuaTeX PGF TikZ Teaching Diagrams |