25.11.12

Generating dummy text/blindtext with Latex for testing


I was often using any of the available “lorem ipsum” generators on the web while testing different things in Latex until I discovered that the Latex distribution provides packages generating blind text, which is definitely more convenient. With just a few lines of code, these packages will generate paragraphes, even whole documents with sections, paragraphs of text, lists, etc.
The first package that I will introduce is the “blindtext” package. First the language option as well as the package have to be loaded. Make sure you get the order right, otherwise your text might appear in latin by default.

1\usepackage[english]{babel}
2\usepackage{blindtext}

The language options english, (n)german and latin are available. French is also available, but in a preliminary version. Try it out yourself :-) .
Now you are ready to create a paragraph or even a whole document with just one line of code.
For few/more paragraphs of normal text:

1\blindtext
2\Blindtext

For a small/large document:
1\blinddocument
2\Blinddocument

In an arbitrary number of repetitions, e.g.

1\blindtext[5]

Furthermore,

1\blindlist{env}[x]

creates a list with “x” being the number of items generated. The environment can be set to itemize, enumerate or description.
A more direct way to generate lists is by using the commands:
1\blinditemize
2\blindenumerate
3\blinddescription

and their extended versions with capital letters are available. Similarly, the number of items is defined through the optional argument, e.g.

1\blindenumerate[10]

If you want math within the text, use

1\blindmathtrue
2\blindmathfalse

respectively.
It is also possible to generate text with math including formulas, using

1\blindmathpaper

The “lipsum” package is a more basic package. It generates a certain number of the standard “lorem ipsum” text:

1\usepackage{lipsum}
2...
3\lipsum
4\lipsum[3-56]

By default, the package will either generate slightly more than a single page (fist line). Alternatively, it generates an arbitrary number of paragraphs (second line).
For more information, please refer to the package information of the blindtextas well as the lipsum packages.

1 comentario:

  1. I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post.
    cyberlink photodirector

    ResponderEliminar