How to write random or dummy(Lorem lipsum) text in LaTeX?

Sometimes, we need random text or dummy text to create test documents or give examples. Many of us copy the text from a webpage and use it.

LaTeX has a package called lipsum to simplify this process, which allows you to access 150 paragraphs of Lorem lipsum dummy text.

In this tutorial, we will discuss the use of lipsum package in LaTeX.

Use lipsum in LaTeX

The lipsum package provides us with a command called \lipsum. Using this command in latex will print a few random paragraphs in the output.

You can also choose any one paragraph 1-150 as you need, for this, you have to pass an optional argument with the \lipsum command like this \lipsum[arg]. Take a look

\documentclass{article}
\usepackage{lipsum}
\begin{document}
  \textbf{1st paragraph}\\
  \lipsum[1]\\ % print 1st paragraph
  \textbf{2nd paragraph}\\
  \lipsum[2] % print 2nd paragraph 
\end{document}

Output :

Use lipsum for printing dummy paragraph.

If you need more than one paragraph at a time, you will get the result just by passing it in the argument.

If you pass [1-2] in the argument then the 1st and 2nd paragraphs will be printed in the output, and if you pass [1-3] then three paragraphs will be printed from one to three.

\documentclass{article}
\usepackage{lipsum}
\begin{document}
  \textbf{Printing 1 to 3 paragraphs}\\
  \lipsum[1-3] % [1-3] for print 1 to 3 paragraphs
\end{document}

Output :

printing multiple paragraphs by lipsum in latex.

In the example above you will see that the paragraphs are not covered together, there is a slight gap.

In this case, if you put an * like \lipsum*[arg] with the \lipsum[arg] command, there will be no gaps between the paragraphs.

\documentclass{article}
\usepackage{lipsum}
\begin{document}
  \textbf{Print without any gaps between the three paragraphs}\\
  \lipsum*[1-3] % * For print without any gaps between the three paragraphs
\end{document}

Output :

Print without gaps between paragraphs.

Access sentences from a paragraph by lipsum package

Sometimes, we don’t need the whole paragraph, in this case, you can also print a few sentences from any paragraph with the \lipsum command.

For this, you need a second argument, \lipsum[1][1-3] here is the first argument [1] and the second argument [1-3] means the first, second, and third sentences of the 1st paragraph will be printed in the output.

Below are a few examples to help you understand.

\documentclass{article}
\usepackage{lipsum}
\begin{document}
  \textbf{Print the 1st sentence of the first paragraph} \\
  \lipsum[1][1] \\ %[1][1]To print the 1st sentence of the first paragraph
  \textbf{Print the 1st,2nd,and 3rd sentences of the first paragraph} \\
  \lipsum[1][1-3] %[1][1-3]To print the 1st, 2nd, and 3rd sentences of the first paragraph
  \textbf{Print the 1st to 5th sentences of the 2nd paragraph} \\
  \lipsum[2][1-5] \\ %[2][1-5]To print the 1st,2nd,and 3rd sentences of the first paragraph
  \textbf{Print the 3rd to 10th sentences of the 5th paragraph} \\
  \lipsum[5][3-10] \\ %[5][3-10]To print the 3rd to 10th sentences of the 5th paragraph
\end{document}

Output :

Access sentences from a paragraph in latex.

Md Jidan Mondal

LaTeX expert with over 10 years of experience in document preparation and typesetting. Specializes in creating professional documents, reports, and presentations using LaTeX.

Leave a Comment

Your email address will not be published. Required fields are marked *