CTAN Comprehensive TeX Archive Network

Verzeichnis macros/latex/contrib/wrapblock

README.md

wrapblock

An image beside its own text, which wraps around it and runs below, in .

\usepackage{wrapblock}
…
\begin{wrapblock}[side=l]{\includegraphics[width=4cm, alt={The setup}]{setup}}
  The text of the block: paragraphs, lists, equations.
\end{wrapblock}

The text of the block runs along the image, then takes the full width again below it; the text after the environment is full width. The block is closed: the image never spills over what follows.

The package gives the image no size of its own: the room taken from the text is the width and the height of the image as it is given. Only the width can be forced, with the width key.

Four properties that no existing wrapping package combines:

  • lists: a list beside the image is narrowed, at any depth, and a block may be the first thing in an \item (\item \begin{wrapblock}…);
  • page breaks: the image and the lines beside it stay on the same page; when the image does not fit at the bottom of a page, the text fills that bottom at full width and the image goes to the top of the next page; a text too short for that moves with its image to the next page, together with the heading before it, and the log says so;
  • both engines: pdf and Lua, with the same output;
  • tagged PDF: with \DocumentMetadata{tagging=on}, the structure is the one the same text would have without the package.

Three things to know (section 2 of the documentation):

  • the text should be at least as long as the image: when it is shorter, the block ends with vertical space down to the bottom of the image, since the text after the block never runs beside it;
  • near the bottom of a page, the text is typeset twice, once at full width in a box that is thrown away, to measure it. counters are put back, but any other global action is done twice: a count, an expl3 integer, an \immediate\write, the first use of an acronym (glossaries, acro). The key defer=false turns the measure off;
  • no verbatim in the block: its contents are read as an argument. Verbatim material can be set beforehand in an lrbox.

The package is written in expl3.

Contents

In the repository; the CTAN archive holds the package, the documentation and the examples in one folder, without the tests.

File Role
wrapblock.sty the package
doc/wrapblock-doc.tex, doc/wrapblock-doc.pdf the documentation, which ends with the whole code, commented; it compiles with both engines, and reads wrapblock.sty wherever finds it (TEXINPUTS=..: from doc/)
examples/ minimal examples, one per property: mwe-basic, mwe-lists, mwe-pagebreak, mwe-tagged; zsh examples/build.zsh compiles them with both engines
ctan.zsh builds the archive for CTAN, in ../wrapblock-construction/ctan/
tests/ the tests: zsh tests/run.zsh compiles each one with both engines, plain and tagged, and reports errors, tagging warnings and text overlapping an image; it needs python3 and pdftotext (poppler), and checks the tagged builds against PDF/UA-2 when verapdf is in the PATH

Installation

Copy wrapblock.sty into a tree (TEXMFHOME/tex/latex/wrapblock/). The package needs a kernel of June 2023 or later, which it checks, and pdf or Lua; it was tested with Live 2026 only. One correction, for a footnote before an image sent to the next page, needs a kernel of June 2025.

License

This work may be distributed and/or modified under the conditions of the Project Public License, version 1.3c or any later version.

Author and maintainer: Antonin Marchand.

Bugs

Report a bug, with a minimal example, at https://github.com/antnardo/wrapblock/issues.

Herunterladen des vollständigen Inhalts dieses Pakets in einem Zip-Archiv (385.2k).

Wrapblock – Wrap a closed block of text, including lists and equations, around an image

The package provides one environment, wrapblock, which sets an image beside a block of text: the text is narrowed along the image, then takes the full width again below it. The block is closed: the text that follows the environment never runs beside the image.

The text of the block may hold lists, nested to any depth, and displayed equations, and a block may be the first thing in a list item. The image and the lines beside it stay on the same page: when the image does not fit at the bottom of a page, the text fills that bottom at full width and the image goes to the top of the next page.

The package works with pdf and Lua, and leaves the structure of a tagged PDF as it would be without it. It needs a kernel of June 2023 or later. Related packages are wrapfig, wrapfig2 and wrapstuff.

PaketWrapblock
Fehlermeldungen
Repository
Version0.1.3 2026-11-18
LizenzenThe Project Public License 1.3c
Copyright2026 Antonin Marchand
BetreuerAntonin Marchand
ThemenTextfluss
Absatzformen
...
Gästebuch Seiten-Struktur Impressum Autor kontaktieren