Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

lipsum, blindtext and kantlipsum all seem to default to producing paragraphs, whereas I want them to generate individual sentences. From the documentation, it looks as if it should be possible to make the random option in blindtext produce individual sentences, but I can't get that to work:

\documentclass{article} 
\usepackage[random]{blindtext}
\setcounter{blindtext}{1}
\begin{document}
\blindtext
\end{document}

I get

Package blindtext Warning: Option random not defined for english

Now, the documentation on random does say:

If the language does not support this option, the default text is used.

But it's a little surprising that it doesn't support English... am I doing something wrong?

share|improve this question

2 Answers 2

You can use the following variant of lipsum.sty that will produce sentences instead of paragraphs; save the following file as sentlipsum.sty in your current working directory or in your local tree:

%%
%% This is file `sentlipsum.sty',
%% A small variation of 'lipsum.sty' originally written by Patrick Happel
%%
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{sentlipsum}[2012/12/16 v1.0 150 sentences of Lorem Ipsum dummy text]
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\newcounter{sentlips@count}
\setcounter{sentlips@count}{0}

\ProcessOptions

\newcommand\sentlips@default{1-7}
\newcommand\setsentlipsumdefault[1]{%
  \renewcommand{\sentlips@default}{#1}}

\newcommand\sentlips@dosentlipsum{%
  \ifnum\value{sentlips@count}<\sentlips@max\relax%
    \addtocounter{sentlips@count}{1}%
    \csname sentlipsum@\roman{sentlips@count}\endcsname\ %
    \sentlips@dosentlipsum%
  \fi%
}

\newcommand\sentlipsum{\@sentlipsum}

\newcommand\@sentlipsum[1][\sentlips@default]{%
  \expandafter\sentlips@minmax\expandafter{#1}%
  \setcounter{sentlips@count}{\sentlips@min}%
  \addtocounter{sentlips@count}{-1}%
  \sentlips@dosentlipsum%
}

\def\sentlips@get#1-#2;{\def\sentlips@min{#1}\def\sentlips@max{#2}}
\def\sentlips@stripmax#1-{\edef\sentlips@max{#1}}
\def\sentlips@minmax#1{%
  \sentlips@get#1-\relax;%
  \edef\sentlips@tmpa{\sentlips@max}%
  \edef\sentlips@relax{\relax}%
  \ifx\sentlips@tmpa\sentlips@relax\edef\sentlips@max{\sentlips@min}%
  \else\expandafter\sentlips@stripmax\sentlips@max\fi%
}

\newcommand\sentlipsum@i{Lorem ipsum dolor sit amet, consectetuer
  adipiscing elit.}

\newcommand\sentlipsum@ii{Nam dui ligula, fringilla a, euismod sodales,
  sollicitudin vel, wisi.}

\newcommand\sentlipsum@iii{Nulla malesuada porttitor diam.}

\newcommand\sentlipsum@iv{Quisque ullamcorper placerat ipsum.}

\newcommand\sentlipsum@v{Fusce mauris et vestibulum luctus nibh at lectus.}

\newcommand\sentlipsum@vi{Ut lorem lorem, interdum
  eu, tincidunt sit amet, laoreet vitae, arcu.}

\newcommand\sentlipsum@vii{In hac habitasse platea
  dictumst.}

\newcommand\sentlipsum@viii{Pellentesque habitant morbi tristique senectus
  et netus et malesuada fames ac turpis egestas.}

\newcommand\sentlipsum@ix{Morbi luctus, wisi viverra faucibus pretium,
  nibh est placerat odio, nec commodo wisi enim eget quam.}

\newcommand\sentlipsum@x{Suspendisse vitae elit.}

\newcommand\sentlipsum@xi{Cum sociis natoque penatibus et
  magnis dis parturient montes, nascetur ridiculus mus.}

\newcommand\sentlipsum@xii{Fusce facilisis lacinia dui.}

\newcommand\sentlipsum@xiii{Nullam elementum, magna in cursus sodales, augue est scelerisque sapien, venenatis congue nulla arcu et pede.}

\newcommand\sentlipsum@xiv{Etiam ac leo a risus tristique nonummy.}

\newcommand\sentlipsum@xv{Praesent eros nulla, congue
  vitae, euismod ut, commodo a, wisi.}

\newcommand\sentlipsum@xvi{Nulla mattis luctus nulla.}

\newcommand\sentlipsum@xvii{Curabitur tellus magna, porttitor a, commodo
  a, commodo in, tortor.}

\newcommand\sentlipsum@xviii{Donec et nisl at wisi luctus bibendum.  Nam
  interdum tellus ac libero.}

\newcommand\sentlipsum@xix{Nulla non mauris vitae wisi posuere convallis.}

\newcommand\sentlipsum@xx{Nullam urna nulla, ullamcorper
  in, interdum sit amet, gravida ut, risus.}

\newcommand\sentlipsum@xxi{Etiam pede massa, dapibus vitae, rhoncus in,
  placerat posuere, odio.}

\newcommand\sentlipsum@xxii{Etiam suscipit aliquam arcu.}

\newcommand\sentlipsum@xxiii{Donec et nisl id sapien blandit mattis.}

\newcommand\sentlipsum@xxiv{Vestibulum pharetra nulla
  at lorem.}

\newcommand\sentlipsum@xxv{Vivamus eu tellus sed tellus consequat
  suscipit.}

\newcommand\sentlipsum@xxvi{Duis aliquet dui in est.}

\newcommand\sentlipsum@xxvii{Donec vel nibh ut felis consectetuer laoreet.}

\newcommand\sentlipsum@xxviii{Donec molestie, magna ut luctus ultrices,
  tellus arcu nonummy velit, sit amet pulvinar elit justo et mauris.}

\newcommand\sentlipsum@xxix{Cras dapibus, augue quis scelerisque
  ultricies, felis dolor placerat sem, id porta velit odio eu elit.}

\newcommand\sentlipsum@xxx{Sed mattis, erat sit amet gravida malesuada,
  elit augue egestas diam, tempus scelerisque nunc nisl vitae libero.}

\newcommand\sentlipsum@xxxi{Sed consequat tellus et tortor.}

\newcommand\sentlipsum@xxxii{Duis malesuada interdum
  arcu.}

\newcommand\sentlipsum@xxxiii{Sed eleifend, eros sit amet faucibus
  elementum, urna sapien consectetuer mauris, quis egestas leo justo
  non risus.}

\newcommand\sentlipsum@xxxiv{Nullam eleifend justo in nisl.}

\newcommand\sentlipsum@xxxv{Class aptent taciti sociosqu ad litora
  torquent per conubia nostra, per inceptos hymenaeos.}

\newcommand\sentlipsum@xxxvi{Nulla malesuada risus ut urna.}

\newcommand\sentlipsum@xxxvii{Donec tempus neque vitae est.  Aenean egestas
  odio sed risus ullamcorper ullamcorper.}

\newcommand\sentlipsum@xxxviii{Fusce suscipit cursus sem.}

\newcommand\sentlipsum@xxxix{Praesent sed neque id pede mollis rutrum.}

\newcommand\sentlipsum@xl{Sed gravida lectus ut purus.}

\newcommand\lipsum@xli{Vivamus non justo in dui mattis posuere.}

\newcommand\lipsum@xlii{In suscipit mauris a
  dolor pellentesque consectetuer.}

\newcommand\lipsum@xliii{Maecenas accumsan dapibus sapien.}

\newcommand\lipsum@xliv{Phasellus fringilla, metus id feugiat
  consectetuer, lacus wisi ultrices tellus, quis lobortis nibh lorem
  quis tortor.}

\newcommand\lipsum@xlv{Cras egestas ipsum a nisl.}

\newcommand\lipsum@xlvi{Vivamus fringilla, enim et commodo
  malesuada, tortor metus elementum ligula, nec aliquet est sapien ut
  lectus.}

\newcommand\lipsum@xlvii{Vivamus ante ante, mattis laoreet, posuere eget, congue vel, nunc.}

\newcommand\lipsum@xlviii{Quisque posuere metus viverra pede.}

\newcommand\lipsum@xlix{Vivamus augue purus, laoreet in, scelerisque vel,
  commodo id, wisi.}

\newcommand\lipsum@l{Quisque facilisis auctor sapien.}

\newcommand\lipsum@li{Aliquam volutpat auctor lorem et cras placerat est vitae lectus.}

\newcommand\lipsum@lii{Suspendisse porta fermentum mauris.}

\newcommand\lipsum@liii{Phasellus placerat vulputate quam.}

\newcommand\lipsum@liv{Maecenas ultrices mi
  sed diam.}

\newcommand\lipsum@lv{Nullam elit sapien, eleifend eu,
  commodo nec, semper sit amet, elit.}

\newcommand\lipsum@lvi{Morbi tincidunt posuere arcu.}

\newcommand\lipsum@lvii{Nunc interdum elementum urna.}

\newcommand\lipsum@lviii{Nulla sit amet nisl at
  sapien egestas pretium.}

\newcommand\lipsum@lix{Nunc tincidunt, risus quis bibendum
  facilisis, lorem purus rutrum neque, nec porta tortor urna quis
  orci.}

\newcommand\lipsum@lx{Vestibulum in leo eu erat tristique mattis.}

\endinput
%%
%% End of file `sentlipsum.sty'.

The main command is \sentlipsum and it behaves in a fashion similar to \lipsum (from the lipsum package): \sentlipsum produces seven sentences; \sentlipsum[<number>], where <number> is an integer between 1 and 60 produces the sentence whose number corresponds to <number>, and \sentlipsum[<number1>-<number2>] produces <number2>-<number1>+1 sentences, starting from the one associated to <number1> and ending with the one associated to <number2> (again, both numbers must be integers between 1 and 60).

\documentclass[parskip=full+]{scrartcl} 
\usepackage{sentlipsum}

\begin{document}

\sentlipsum

\sentlipsum[1]

\sentlipsum[23-26]

\end{document}

enter image description here

I only used scratcl and the parfill=full* option to quickly get a visual separation between paragraphs for the example.

share|improve this answer
    
It looks like you put in a lot of work to get that working... I feel rather bad about saying that the main point was to be able to use an ipsum variant in a compact MWE. –  Mohan Dec 17 '12 at 4:02
    
@Mohan in fact, I will be using this new variant a lot since I often need sentences instead of whole paragraphs for some of my answers and test codes, so the time used (it was not much, by the way) was well spent ;-) –  Gonzalo Medina Dec 17 '12 at 14:05

Here's a sentence generator based on kantlipsum:

\documentclass{article}
\usepackage{kantlipsum}
\usepackage{xparse}
\ExplSyntaxOn
\NewDocumentCommand{\kantsentences}{ O{1} m }
 {
  \kgl_sentences:nn { #1 } { #2 }
 }

\cs_new_protected:Npn \kgl_sentences:nn #1 #2
 {
  \group_begin:
   \cs_set_eq:NN \kgl_number:n \use_none:n
   \cs_set_eq:NN \kgl_par: \prg_do_nothing:
   \tl_gclear:N \g_tmpa_tl
   \prg_replicate:nn { #2/5 + 1 }
    {
     \tl_set:Nx \l_tmpa_tl { \seq_item:Nn \g_kgl_pars_seq {#1} }
     \tl_gput_right:Nx \g_tmpa_tl { \tl_use:N \l_tmpa_tl }
     \tl_gput_right:Nn \g_tmpa_tl { ~ }
    }
  \group_end:
  \seq_set_split:NnV \l_tmpa_seq {.} \g_tmpa_tl
  \int_step_inline:nnnn { 1 } { 1 } { #2 }
   {
    \seq_item:Nn \l_tmpa_seq { ##1 } .\par
   }
 }
\ExplSyntaxOff


\begin{document}

\section{Four sentences}

\kantsentences{4}

\section{Nine sentences}

\kantsentences[10]{9}

\end{document}

I use the fact that generally the Kantian paragraphs consist of seven sentences. So I divide the requested number by five and add one, then I gather this number of Kantian paragraphs in a unique token list, from which I extract the requested number of sentences.

The optional argument to \kantsentences is the initial Kantian paragraph (default 1).

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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