8

I need to create just a specified number of sentences of dummy text (rather than a long paragraph). Can I use lipsum to do this? If not, then what can I use? The idea is to be able to create a MWE that doesn't contain a lot of distracting text in the source code, but allows me to use smaller numbers of sentences then I can get with \lipsum[n].

  • 1
    Then what? What do you mean? If you need a more specific amount than lipsum or blindtext or kantlipsum provide, you can just write arbitrary text or copy the relevant amount of text from those packages. – cfr Jul 11 '15 at 20:26
  • 3
    you can use your \mylipsum command: \newcommand{\mylipsum}{just dummy text} – touhami Jul 11 '15 at 20:36
3

One can defines command \mylipsum

\newcommand{\mylipsum}{just dummy text}

MWE

\documentclass{article}

\newcommand{\mylipsum}{just dummy text}
\newcommand{\Mylipsum}{\mylipsum{} \mylipsum}

\begin{document}
\mylipsum

\Mylipsum
\end{document}
10

With some help from xparse we can extract a rich supply of sentences from lipsum; precisely 1498, I guess they're sufficient.

\documentclass{article}
\usepackage{lipsum}
\usepackage{xparse}

% store a big set of sentences
\unpacklipsum[1-100] % it was \UnpackLipsum before version 2.0

\ExplSyntaxOn
% unpack \lipsumexp
\seq_new:N \g_lipsum_sentences_seq
\cs_generate_variant:Nn \seq_set_split:Nnn { NnV }
\seq_gset_split:NnV \g_lipsum_sentences_seq {.~} \lipsumexp

\NewDocumentCommand{\lipsumsentence}{>{\SplitArgument{1}{-}}O{1-7}}
 {
  \lipsumsentenceaux #1
 }
\NewDocumentCommand{\lipsumsentenceaux}{mm}
 {
  \IfNoValueTF { #2 }
   {
    \seq_item:Nn \g_lipsum_sentences_seq { #1 }.~
   }
   {
    \int_step_inline:nnnn { #1 } { 1 } { #2 }
     {
      \seq_item:Nn \g_lipsum_sentences_seq { ##1 }.~
     }
   }
 }
\ExplSyntaxOff

\begin{document}

\section{Seven sentences}

\lipsumsentence

\section{Three sentences}

\lipsumsentence[2-4]

\section{Some single sentences}

\lipsumsentence[1]

\lipsumsentence[2]

\lipsumsentence[3]

\lipsumsentence[4]

\lipsumsentence[5]

\end{document}

enter image description here

  • The code no longer compiles because \UnpackLipsum has been deprecated. – Troy Nov 29 '18 at 21:25
8
\newcount\zz
\loop
Hello world.
\advance\zz1
\ifnum\zz<10
\repeat

writes Hello world 10 times.

7

You can use a macro for the dummy text and a loop to repeat it, taking as an argument the number of repetitions. These commands work in any variety of TeX, but I illustrate their use in a LaTeX document.

\documentclass{article} 

% Define the dummy sentence, an ancient palindrome.
\def\sator{Sator Arepo tenet opera rotas.}

% Create a command to print the sentence repeatedly.
% Argument #1 is the number of times to repeat it.
\newcount\loopcounter
\def\dummysentences#1{%
    \loopcounter = #1
    \loop
        \sator\ %
        \advance\loopcounter by -1
        \ifnum\loopcounter > 0
    \repeat%
}

\begin{document}

\sator

\dummysentences{5}

\begin{itemize}
\item \sator
\item \dummysentences{3}
\item \dummysentences{2}
\end{itemize}

\end{document}

enter image description here

See also my answer here: Is there a dummy package like Lipsum or Blindtext for Tables and Figures?

  • ... and of course: \def\sator{\noindent\ttfamily sator\\ arepo\\ tenet\\ opera\\ rotas}. – jon Jul 11 '15 at 21:49
  • @jon See the command \satorfig from the package in the answer I link to. :) – musarithmia Jul 11 '15 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.