% ^^A CTAN:macros/latex/contrib/supported/blindtext
%\iffalse
%<*package>
%\fi
\def\blindfileversion{V2.0}
\def\blindfiledate{2012/01/06}
% ^^A For index and changes, run:
% ^^A makeindex -s gglo.ist -o blindtext.gls blindtext.glo
% ^^A makeindex -s gind.ist -o blindtext.ind blindtext.idx
%
% \CheckSum{1786}
%%
%% \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         \~}
%%
% \DoNotIndex{\" , \-, \flqq,\frqq, \ ,\def, \begin, \end}
% \DoNotIndex{\csname,\endcsname, \expandafter, \global, \newcommand}
% \DoNotIndex{\advance, \blindfiledate, \blindfileversion, \MessageBreak}
% \DoNotIndex{\newcount, \newcounter, \newif, \or}
% \DoNotIndex{\if, \else, \fi, \ifcase, \ifdefined, \ifnum, \ifx, \loop, \repeat}
% \DoNotIndex{\heartsuit}
% \DoNotIndex{\NeedsTeXFormat, \providecommand, \ProvidesPackage, \relax, \RequirePackage}
% \DoNotIndex{\par, \chapter, \section, \subsection, \subsubsection, \paragraph, }
% \DoNotIndex{\selectlanguage, \stepcounter, \ss, \space, \setcounter}
% \DoNotIndex{\value, \typeout, \long, \renewcommand}
%
% \iffalse
%</package>
%<*driver>
\documentclass{ltxdoc}
\usepackage[ngerman,english]{babel}
\usepackage{blindtext}
\usepackage{makeidx}
\usepackage{varioref}
\IfFileExists{hyperref.sty}{\usepackage{hyperref}}{}
\CodelineIndex
\makeindex
%\OnlyDescription
\begin{document}
 \RecordChanges
 \DocInput{blindtext.dtx}
\end{document}
%</driver>
%
%<*package>
% \fi
%
% \newcommand*{\Lpack}[1]{\textsf {#1}}           ^^A typeset a package
% \newcommand*{\Lenv}[1]{\texttt {#1}}           ^^A typeset a package
%
% \title{Blindtext.sty:\\
%   Creating Dummy Text\\
%   \em Blindtext erzeugen}
%
% \date{\today, \blindfileversion}
% \author{Knut Lickert\thanks{
%       \url{http://tex.lickert.net/packages/blindtext/}}
% }
% \maketitle
%
%\begin{abstract}
%\selectlanguage{english}
%With this package you can create dummy text.
%Use \cmd{\blindtext} to get some text and
%\cmd{\Blindtext} to get a long text.
%With \cmd{\blinddocument} (or \cmd{\Blinddocument})
%you get complete dummy documents.
%
%Details can be found at \url{http://tex.lickert.net/packages/blindtext/index_en.html}.
%This File describes version \blindfileversion.
%
%\selectlanguage{ngerman}
%\em
%Mit diesem Paket kann man lange Texte erzeugen, ohne lange
%Texte einzugeben.
%Sinn ist die Erzeugung langer Beispieltexte, ohne den
%Quelltext lang zu machen.
%
%Details unter \url{http://tex.lickert.net/packages/blindtext/}.
%Dieses Dokument beschreibt Version \blindfileversion.
%\end{abstract}
%
% \tableofcontents
%
%\selectlanguage{english}
%\section{Overview/{\"U}bersicht}
%
%\begin{table}
%\renewcommand{\arraystretch}{1.1}
%\begin{tabular}{p{0.3\textwidth}*{2}{p{0.3\textwidth}}}\hline
%Command/Makro       & Englisch      & German    \\\hline
%\cmd{\blinddocument}   & create a document  & erzeugt ein Dokument\\
%\cmd{\Blinddocument}   & create a big document  & erzeugt ein gro{\ss}es Dokument\\
%\cmd{\blindtext}   & create text  & erzeugt Text\\
%\cmd{\Blindtext}   & create more text & erzeugt mehr Text\\
%\verb|\blindlist{env}|   & create a list  & erzeugt eine Liste\\
%\verb|\blindlistoptional|\newline\hspace*{2em}\verb|{env}|   & create a list with \verb|\item[]|  & erzeugt eine Liste mit \verb|\item[]|\\
%\verb|\blindlistlist|\newline\hspace*{2em}\verb|[level]{env}|   & create cascaded lists  & erzeugt geschachtelte Listen\\
%\verb|\Blindlist{env}|   & create a big list  & erzeugt eine gro{\ss}e Liste\\
%\verb|\Blindlistoptional|\newline\hspace*{2em}\verb|{env}|   & create a big list with \verb|\item[]|  & erzeugt eine gro{\ss}e Liste mit \verb|\item[]|\\
%\verb|\blinditemize|   & create an itemize list  & erzeugt eine itemize-Liste\\
%\verb|\blindenumerate|   & create an enumerate list  & erzeugt eine enume\-ra\-te-Liste\\
%\verb|\blinddescription|   & create a description list  & erzeugt eine des\-crip\-tion-Liste\\\hline
%$\sim$[x]   & Repetition & Wiederholungsfaktor\\
%\end{tabular}
%\caption{Command Overview/Kommando\"ubersicht}
%\end{table}
%
% \subsection{Create Documents}
% \DescribeMacro{\blinddocument}
% \cmd{\blinddocument} create a document with sections,
% subsections\ldots and lists (\Lenv{itemize},
% \Lenv{enumerate} and \Lenv{description}).
%
% \DescribeMacro{\Blinddocument}
% \cmd{\Blinddocument} create a
% document with bigger sections, subsections\ldots and longer
% lists.\par
%
% The smallest document to check the look of a class would be:
% \begin{quote}
% \begin{verbatim}
% \documentclass{<class>}
% \usepackage{blindtext}
% \begin{document}
%     \blinddocument
% \end{document}
% \end{verbatim}
% \end{quote}
%
% If you want to have a table of contents you have two ways:
% \begin{enumerate}
%    \item use the package option ``toc''
%    \item Just add the |\tableofcontents|-command in your testdocument.
%  \end{enumerate}
%
% \subsection{Package options}
% \subsubsection{Math Option}
% The \emph{math}-option activates math formula for |\blindtext|.
%
%  More see in section~\vref{sec:math} and \vref{sec:optionmath}.
%
% \subsubsection{Toc Option}
% Activate the table of contents for |\blinddoccument|.
%
% \subsubsection{Random Option}
% \label{sec:optionrandom}
% \changes{V2.0}{2011-12-28}{Add option random}
% The \emph{random}-option changes the default blind text to 
% a sequence of predefined sentences.
% The next paragraph starts with the next phrase from the previous paragraph.
%
% You may redefine the number of phrases per paragraph,
% details see table~\vref{tab:repetion}.
%
% \begin{table}
% \begin{minipage}{\textwidth}
% \begin{tabular}{llll}
%   Command           & Parameter(s) & Remark & Section\\\hline
%   \cmd{\blindtext} & \oarg{n}  & n repetition\textsuperscript{*}  &\ref{sec:blindtext}\\
%   \cmd{\Blindtext} & \oarg{x}\oarg{n} & x paragraphs with n repetitions&\ref{sec:blindtext}\\[1ex]
%   \multicolumn{3}{l}{\textbf{Global Redefinitions of Default} -- \cmd{\setcounter}\marg{Counter}\marg{n}}\\
%   Counter           & Parameter & Remark & Section\\\hline
%   blindtext          & \marg{n}  & n repetitions per paragraph\\
%   Blindtext          & \marg{n}  & n paragraph for \cmd{\Blindtext}\\
%   blindlist            & \marg{n}  & n items in list&\ref{sec:blindlists}\\
%   blindlistlevel      & \marg{n}  & depth of nested lists (max. 4)&\ref{sec:def:blindlists}\\
% \end{tabular}
% \footnotetext{* The default for \cmd{\blindtext} values depends on selected option
%     (\emph{random}: 17~sentences, \emph{pangram}:~5 pangrams, default:~1 text).}
% \end{minipage}
% \caption{Modifiying Repetion Factors}
% \label{tab:repetion}
% \end{table}
%
% If the language does not support this option, the default text is used.
%
% \subsubsection{Pangram Option}
% \label{sec:optionpangram}
% \changes{V2.0}{2012-01-02}{Add option pangram}
% The \emph{pangram}-option changes the default blind text to 
% a sequence of pangrams.
% A pangram, or holoalphabetic sentence, is a sentence using 
% every letter of the alphabet at least once.\footnote{\url{http://en.wikipedia.org/wiki/Pangram}}
%
% You may redefine the number of phrases per paragraph,
% details see table~\vref{tab:repetion}.
%
% If the language does not support this option, the default text is used.
%
% \subsubsection{Bible Option}
% \label{sec:optionbible}
% \changes{V2.0}{2011-12-27}{Add option bible}
% The \emph{bible}-option changes the default blind text to 
% texts from bible verse 3.14 (Genesis, Exodus, Leviticus, Numeri and Deuteronomium)
%
% \subsection{Get Some Text}
% \label{sec:blindtext}
% \DescribeMacro{\blindtext}
% \cmd{\blindtext}\oarg{x} create a text. The optional parameter define a
% repetition. Default for the repetition is one and can be modified
% with \cmd{\setcounter}\marg{blindtext} \marg{1}.
% See also table~\vref{tab:repetion}.
%
% \DescribeMacro{\Blindtext}
% \cmd{\Blindtext}\oarg{x}\oarg{y} create $x$ paragraphs with the text of
% \cmd{\blindtext}. The first optional parameter defines a
% repetition of the paragraphs. Default for the repetition is five
% and can be modified with \cmd{\setcounter}\marg{Blindtext}\marg{5}. The
% second optional parameter is given to \cmd{\blindtext}.
% See also table~\vref{tab:repetion}.
%
% \DescribeMacro{\parstart}
% \DescribeMacro{\parend}
% It is possible to add a start and end sequence for each paragraph.
%
% The two macros \cmd{\parstart} and \cmd{\parend} define a
% starting and ending sequence for each paragraph in
% \cmd{\Blindtext}.
%
% \changes{V2.0}{2011-12-09}{Default paragraph start}
% The paragraph start is redefined for each language change:
% First paragraphs get an empty start, the following paragraphs get
% different starting texts. 
% Advantage: Each paragraph in a paragraph sequence looks different.
% This feature must be supported by the language\footnote{
%   see redefinitions of \cmd{\blindtext@parstart}}
%
% \subsection{Get Some Lists}
% \label{sec:blindlists}
% \DescribeMacro{\blindlist}
% \cmd{\blindlist}\marg{env}\oarg{x} create a list, the type is defined by the
% obligatory parameter. The optional parameter defines a repetition.
% Default for the repetition is five and can be modified with
% \cmd{\setcounter}\marg{blindlist}\marg{x}.
%
% \DescribeMacro{\blindlistlist}
%  \cmd{\blindlistlist}\oarg{level}\marg{env}\oarg{x} creates cascaded lists up to
%  level \verb|level|, the type is defined by the second obligatory
%  parameter. The optional parameter defines a repetition. Default is the
%  same like in \cmd{\blindlist}.
%
% \DescribeMacro{\Blindlist}
% \cmd{\Blindlist}\marg{env}\oarg{x} create a list with long texts.
% The optional parameter defines a
% repetition. Default for the repetition is five and can be modified
% with \cmd{\setcounter}\marg{blindlist}\marg{x}.
%
% \DescribeMacro{\blindlistoptional}
% \cmd{\blindlistoptional}\marg{env}\oarg{x} create a list with \cmd{\item}\oarg{}. The
% list is defined by the obligatory parameter. The optional
% parameter defines a repetition. Default for the repetition is five
% and can be modified with \cmd{\setcounter}\marg{blindlist} \marg{x}.
%
% \DescribeMacro{\Blindlistoptional}
% \cmd{\Blindlistoptional} create a list like
% \cmd{\blindlistoptional} with long texts.
%
% \DescribeMacro{\blinditemize}
% \DescribeMacro{\blindenumerate}
% \DescribeMacro{\blinddescription}
% The commands \cmd{\blinditemize}, \cmd{\blindenumerate} and \cmd{\blinddescription}
% are abbreviations for \cmd{\blindlist}\marg{itemize}, \cmd{\blindlist}\marg{enumerate}
% and \cmd{\blindlist}\marg{description}.
%
% \DescribeMacro{\Blinditemize}
% \DescribeMacro{\Blindenumerate}
% \DescribeMacro{\Blinddescription}
% The commands \cmd{\Blinditemize}, \cmd{\Blindenumerate} and \cmd{\Blinddescription}
% are abbreviations for \cmd{\Blindlist}\marg{itemize}, \cmd{\Blindlist}\marg{enumerate}
% and \cmd{\Blindlist}\marg{description}.
%
%
% \subsection{Get Some Math in the Text}
% \label{sec:math}
% \marginpar{\hfill Option math}
% If you need a dummy text with math formula, you can add
% some math with the package option ``math''.
%
%\DescribeMacro{\blindmathpaper}
% |\blindmathpaper| built some text with formulas in between.
% This macro is used in |\blinddocument| if |\blindmathtrue| is set.
%
% If you need dummy text with and without math, you can (de)activate
% the math option with the following commands:
%
%\DescribeMacro{\blindmathtrue}
% With |\blindmathtrue| you set a flag, so the following blind text contains
% inline math.
%
%\DescribeMacro{\blindmathfalse}
% With |\blindmathfalse| you reset the flag for inline math
% inside the blind text.
%
% \subsection{Get Additional Markup in the Text}
% \DescribeMacro{\blindmarkup}
% If you want to test some markup in your dummy text you can redefine 
% |\blindmarkup|.
%
% |\blindmarkup| is a macro with one parameter and it set some 
% parts in your markup.
%
% Example:
% \begin{verbatim}
%   \renewcommand{\blindmarkup}[1]{\emph{#1}}
% \end{verbatim}
% 
% \section{FAQ/More features}
% 
% \subsection{Add Tabulars and Tables}
% Is it possible to add tabulars to blindtext?
%
% There are no plans to integrate tabulars in blindtext.
% Tabulars in text are no good idea, they should be integrated
% to tables-environment (tabular, may be a short description, caption).
%
% Tabulars need there own layout, I don't think you may define
% a table for each use in blindtext.
%
% You may define your own tabular/table and surround it with
% |\blindtext|.
%
% Example:
% \begin{verbatim}
% \Blindtext
% % Your tabular
% \Blindtext
% \end{verbatim}
%
% \subsection{Add Pictures and Figures }
% Is it possible to add pictures to blindtext?
%
% There are no plans to integrate pictures in blindtext.
%
% I don't think you may define
% a picture for each use in blindtext.
%
%
% \subsection{Key-Value-Options}
%
% You may change some defaults by redefining commands\footnote{macro \cmd{\blindmarkup}}
%        or numbers\footnote{|blindtext|, |Blindtext|, |blindlist| and |blindlistlevel|}.
% Would it be possible to define them as key-value options?
%
% In theory yes, but I don't want to add an additional dependency to other packages.
%
%
% \subsection{More Languages}
% The language xx is not supported - can you add it?
%
% If you want to have blindtext in another language, please provide me some texts.
%
% I need:
% \begin{itemize}
%  \item The language name (used in babel)
%  \item Some text for the paragraphs
%  \item Some (at least three) sentences for paragraph start.
%  \item The numbers as used in ``first, second\ldots''
%  \item Some sentences to be used with option \emph{random}.
%          You may tell a little story and the last sentence can be continued with 
%           the first sentence.
%  \item Some pangrams (See \url{http://en.wikipedia.org/wiki/List_of_pangrams}.
%  \item The following texts:
%  \begin{itemize}
%    \item item: ``item in a list''
%    \item heading: ``Heading on level''
%    \item lists: ``Lists''
%    \item listsEx: ``Example for list''
%    \item blindmath: ``Some blind text with math formulas''
%  \end{itemize}
% \end{itemize}

% \appendix
% \StopEventually
%
% \selectlanguage{english}
% \section{Implementation}
%    \changes{V1.8}{2009-01-27}{Adding a lot percent to avoid spaces.}
%
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{blindtext}[\blindfiledate\space\blindfileversion\space%
                 blindtext-Package]
\RequirePackage{xspace}
%    \end{macrocode}
%    \begin{macro}{\grqq}
%    \begin{macro}{\glqq}
% Just in case the German quote are not defined
%    \begin{macrocode}
\providecommand{\grqq}{}
\providecommand{\glqq}{}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%
%    \begin{macro}{\blind@checklanguage}
%    \changes{V1.6}{2006-08-02}{Check for defined language}
%    \changes{V2.0}{2011-12-31}{Text default lorem lipsum}
%    It is possible, that you use blindtext.sty with
%    undefined languages.
%    This macro checks if blindtext supports the language.
%    If it is not available, an error is reported and
%    the default lorem lipsum used.
%
%    If you don't load babel, the message may be confusing:
%    I get the warning ``welsh not defined''.\footnote{
%             \LaTeX\ loads babel on it's own to load hyphenations,
%             Welsch is the last language in alphabet.
%             }
%    \begin{macrocode}
\newcommand{\blind@checklanguage}{%
  \@ifundefined{blindtext@\languagename}{%
    \PackageWarning{blindtext}{\languagename\space not
      defined, using English instead.\MessageBreak
    }%
  }{}%
}
%    \end{macrocode}
%    \end{macro}
%
%
% \subsection{Counter and Supporting Macros}
% First we need some counters for the number of repetitions of the
% text and the paragraphs.
%    \begin{macrocode}
\newcounter{blindtext}\setcounter{blindtext}{1}
\newcounter{Blindtext}\setcounter{Blindtext}{5}
%    \end{macrocode}
%
% Define a counter for paragraph start sequence.
%    \begin{macrocode}
\newcounter{blind@countparstart}
%    \end{macrocode}
%
%    \begin{macro}{\blindtext}
%
% \verb|\blindtext[x]| writes a sentence x times.
% The default is stored in the counter \verb|blindtext|. This value
% can be changed with \verb|\setcounter{blindtext}{1}|.
%
%    \changes{V1.6}{2006-08-02}{Check for defined language}
%    \begin{macrocode}
\newcount\blind@countxx
\newcommand{\blindtext}[1][\value{blindtext}]{%
  \blind@checklanguage
  \setcounter{blind@randommax}{#1}%for option random
  \setcounter{blind@pangrammax}{#1}%for option pangram
  \blind@countxx=1 %
  \loop
    \blindtext@text\
  \ifnum\blind@countxx<#1\advance\blind@countxx by 1 %
  \repeat
}
%    \end{macrocode}
%    \end{macro}
%
% \subsection{Creating Text}
%    \begin{macro}{\Blindtext}
% \verb|\Blindtext[x][y]| execute $x\times$\verb|\blindtext[y]|. Each
% \verb|\blindtext[y]| built a paragraph.
% The default is stored in the counter \verb|Blindtext|. This value
% can be changed with \verb|\setcounter{Blindtext}{5}|.
% The counter \verb|blindtext@numBlindtext| stores the first
% optional parameter to be used in \verb|\blindtext@Blindtext|.
%    \changes{V1.6}{2006-08-02}{Check for defined language}
%    \begin{macrocode}
\newcount\blindtext@numBlindtext
\newcommand{\Blindtext}[1][\value{Blindtext}]{%
  \blind@checklanguage
  \blindtext@numBlindtext=#1\relax
  \blind@Blindtext
}
%    \end{macrocode}
%    \end{macro} %^^A Blindtext
%
% \begin{macro}{\blind@Blindtext}
% This macro continue \cmd{\Blindtext} with a second optional parameter.
%
% Each paragraph starts and end with a text, which can be defined with
% \verb|\starttext| or \verb|\endtext|.
%    \begin{macrocode}
\newcount\blind@countyy
\newcommand{\blind@Blindtext}[1][\value{blindtext}]{%
  \blind@countyy=1 %
  \loop
    {\blindtext@parstart\blindtext[{#1}]\blindtext@parend\par}%
  \ifnum\blind@countyy<\blindtext@numBlindtext\advance\blind@countyy by 1 %
  \repeat
}
%    \end{macrocode}
% \end{macro}%^^A {\blind@Blindtext}
%
% \begin{macro}{\parstart}
% \begin{macro}{\parend}
%    \begin{macrocode}
\newcommand{\blindtext@parstart}{}   % Text at start of paragraph
\newcommand{\blindtext@parend}{}     % Text at end   of paragraph
\newcommand{\parstart}[1]{\renewcommand{\blindtext@parstart}{#1}}
\newcommand{\parend}[1]{\renewcommand{\blindtext@parend}{#1}}
%    \end{macrocode}
% \end{macro}%^^A{\parstart}
% \end{macro}%^^A{\parend}
%
% \subsection{Lists}
% \label{sec:def:blindlists}
% Here I define some flags to decide in the lists if we have to
% create big items and if we need the optional parameter at
% \verb|\item|. These flags are reset in \verb|\blind@list|.\par
% The counter \verb|blindlist| define the default number of items in a list.
% The counter \verb|blindlistitem| is needed by \verb|\blindtext@count|
% to write a text like 'first', 'second'\ldots.
%    \begin{macrocode}
\newif\ifblind@long\blind@longfalse
\newif\ifblind@optional\blind@optionalfalse
\newcounter{blindlist}
\newcounter{blindlistlevel}% Up tu X level
\newcounter{blindlist@level}% internal counter
\newcount\blind@listitem
%    \end{macrocode}
%
% \begin{macro}{\blindlist}
% \begin{macro}{\blind@listtype}
% \verb|\blindlist{env}[x]| writes an env-list with $x$ items.
% The default is stored in the counter \verb|blindlist|. This value
% can be changed with \verb|\setcounter{blindlist}{1}|.
% The type of list is stored in \verb|\blind@listtype|.
%    \changes{V1.6}{2006-08-02}{Check for defined language}
%    \begin{macrocode}
%% ^^A-----------------------------------------------------------
\newcommand{\blindlist}[1]{%
  \blind@checklanguage
  \def\blind@listtype{#1}%
  \setcounter{blind@levelcount}{1}%
  \blind@list
}
%    \end{macrocode}
% \end{macro}%^^A{\blindlist}
% \end{macro}%^^A{\blind@listtype}
%
% \begin{macro}{\blind@list}
% This macro continue the macro \verb|\blindlist| and with the
% optional parameter. After the printout, we reset the flags and the
% counter for the list text.
%    \begin{macrocode}
\newcommand{\blind@list}[1][5]{%
  \setcounter{blindlist}{#1}%
  \stepcounter{blindlist@level}% depth of list
  \blind@listitem=1 %
  \begin{\blind@listtype}%
    \blind@items
  \end{\blind@listtype}%
  \blind@longfalse
  \blind@optionalfalse
}
%    \end{macrocode}
% \end{macro}%^^A {\blind@list}
%
% \begin{macro}{\blindlistlist}
% \verb|\blindlistlist[num]{env}[x]| writes cascaded lists up to level num.
%    \begin{macrocode}
\newcommand{\blindlistlist}[2][4]{%
  \setcounter{blindlistlevel}{#1}%
  \setcounter{blindlist@level}{0}% deepest reached level
  \setcounter{blind@levelcount}{1}% actual level for printout
  \def\blind@listtype{#2}%
  \blind@list
}
%    \end{macrocode}
% \end{macro}%^^A {\blindlistlist}
% \begin{macro}{\blindlistlistoptional}
% Like \verb|\blindlistlist[num]{env}[x]| but for environment with optional parameters.
%    \begin{macrocode}
\newcommand{\blindlistlistoptional}{%
  \blind@optionaltrue
  \blindlistlist
}
%    \end{macrocode}
% \end{macro}%^^A{\blindlistlistoptional}
%
% \begin{macro}{\blinditemize}
% \begin{macro}{\blindenumerate}
% Some default macros for the standard environments.
%    \begin{macrocode}
\newcommand{\blinditemize}{\blindlist{itemize}}
\newcommand{\blindenumerate}{\blindlist{enumerate}}
%    \end{macrocode}
% \end{macro}%^^A{\blinditemize}
% \end{macro}%^^A{\blindenumerate}
%
% \verb|\Blindlist[x]| write a list with $x$ items.
% The default is stored in the counter \verb|blindlist|. This value
% can be changed with \verb|\setcounter{blindlist}{1}|.
%
%
% \begin{macro}{\Blindlist}
%    \begin{macrocode}
\newcommand{\Blindlist}[1]{%
  \blind@longtrue
  \blindlist{#1}%
}
%    \end{macrocode}
% \end{macro}%^^A{\Blindlist}
%
% \begin{macro}{\Blinditemize}
% \begin{macro}{\Blindenumerate}
% Some default macros for the standard environments.
%    \begin{macrocode}
\newcommand{\Blinditemize}{\Blindlist{itemize}}
\newcommand{\Blindenumerate}{\Blindlist{enumerate}}
%    \end{macrocode}
% \end{macro}%^^A{\Blinditemize}
% \end{macro}%^^A{\Blindenumerate}
%
% \begin{macro}{\blindlistoptional}
% Here we start a list with \verb|\item[]|. So we set the flag for optional
% parameter and start the normal list.
%    \begin{macrocode}
\newcommand{\blindlistoptional}[1]{%
  \blind@optionaltrue
  \blindlist{#1}%
}
%    \end{macrocode}
% \end{macro}%^^A{\blindlistoptional}
%
% \begin{macro}{\Blindlistoptional}
% Now a big list with optional parameter at \verb|\item|.
%    \begin{macrocode}
\newcommand{\Blindlistoptional}[1]{%
  \blind@optionaltrue
  \blind@longtrue
  \blindlist{#1}%
}
%    \end{macrocode}
% \end{macro}%^^A{\blindlistoptional}
%
% \begin{macro}{\blinddescription}
% \begin{macro}{\Blinddescription}
% Some default macros for the standard environment description.
%\changes{1.7}{2006-12-01}{Replace counter listcount}
%    \begin{macrocode}
\newcommand{\blinddescription}{\blindlistoptional{description}}
\newcommand{\Blinddescription}{\Blindlistoptional{description}}
\newcounter{blind@listcount}
\newcounter{blind@levelcount}
%    \end{macrocode}
% \end{macro}%^^A{\blinddescription}
% \end{macro}%^^A{\Blinddescription}
%
% \begin{macro}{\blind@items}
% Here the \verb|\item| are written.
% A local counter is defined and the \verb|\item| is written. The
% type of \verb|\item| is influenced by the flags.
%    \begin{macrocode}
\newcommand{\blind@items}{%
  \setcounter{blind@listcount}{1}%
  \loop
  \ifblind@optional
    \ifblind@long
      \item[\blindtext@countitem] \blindtext@text
    \else
      \item[\blindtext@count] \blindtext@item
    \fi
    \else % \blind@optionalfalse
      \ifblind@long
        \item \blindtext@text
      \else
        \item \blindtext@countitem
      \fi
    \fi % \ifblind@optional
%    \end{macrocode}
% Loop for cascaded lists.
% \changes{V1.3}{2003-05-18}{Cascaded lists}
%    \begin{macrocode}
    {%
      \loop
      \ifnum\value{blindlistlevel}>\value{blindlist@level}%
        \stepcounter{blind@levelcount}%
        \blind@list[\value{blindlist}]\relax
        \addtocounter{blind@levelcount}{-1}%
        \setcounter{blind@listcount}{1}%
      \repeat
    }%
  \ifnum\value{blind@listcount}<\value{blindlist}%
    \stepcounter{blind@listcount}%
%    \end{macrocode}
% Correction for nested values.
%    \begin{macrocode}
%    \end{macrocode}
% Close the loop
%    \begin{macrocode}
  \repeat
}
%    \end{macrocode}
% \end{macro}%^^A{\blind@item}
%% ^^A-----------------------------------------------------------
% \subsection{Blind Text with Markup}
%    \changes{V1.9d}{2010-01-14}{Adding markup feature}
%    \begin{macro}{\blindmarkup}
%    \begin{macrocode}
\newcommand{\blindmarkup}[1]{#1}
%    \end{macrocode}
%    \end{macro}% ^^A \blindmarkup
%
%% ^^A-----------------------------------------------------------
% \subsection{Blind Text with Math}
%    \changes{V1.9}{2009-05-06}{Adding math}
% \subsubsection{Inline Math}
%    \begin{macro}{\blindtext@endsentence}
% Finish a sentence with a dot.
% This macro is redefined for blind text with inline math/formulas.
%    \begin{macrocode}
  \def\blindtext@endsentence{.\xspace}%
%    \end{macrocode}
%
% Counter to make some alternation of inline formulas.
%    \begin{macrocode}
  \newcount{\blind@mathformula}\blind@mathformula=0%
%    \end{macrocode}
%
% A flag to sign, if math formulas should be used in blind text.
%    \begin{macrocode}
\newif\ifblindmath
%    \end{macrocode}
%
%    \begin{macro}{\blindmathtrue}
% Make the following blind text with inline math.
% This redefine the logical variable |\ifblindmath|,
% to keep the flag we have to store and call the old definition.
%    \begin{macrocode}
\let\oldblindmathtrue\blindmathtrue
\renewcommand{\blindmathtrue}{
    \oldblindmathtrue
%    \end{macrocode}
% Make a formula each x sentence.
%    \begin{macrocode}
  \def\blindtext@endsentence{%
    \advance\blind@mathformula by 1%
    \ifcase\blind@mathformula%
    \or. \(\sin^2(\alpha) + \cos^2(\beta) = 1\)%
    \or\xspace\(E = mc^2\)%
    \or. \(\sqrt[n]{a} \cdot \sqrt[n]{b} =  \sqrt[n]{ab}\)%
    \or. \(\frac{\sqrt[n]{a}}{\sqrt[n]{b}} =  \sqrt[n]{\frac{a}{b}}\)%
    \or. \(a\sqrt[n]{b} = \sqrt[n]{a^n b}\)%
    \or. \(\mathrm{d}\Omega = \sin \vartheta \mathrm{d} \vartheta \mathrm{d}\varphi\)%
    \else\global\blind@mathformula=0%
    \fi%
    .\xspace}%
%    \end{macrocode}
%    \begin{macrocode}
  }%\blindmathtrue
%    \end{macrocode}
%    \end{macro}    %^^A \blindmathtrue
%
%    \begin{macro}{\blindmathfalse}
% Make the following blind text without inline math.
%    \begin{macrocode}
\let\oldblindmathfalse\blindmathfalse
\renewcommand{\blindmathfalse}{
    \oldblindmathfalse
%    \end{macrocode}
% Rebuild the normal sentence end.
%    \begin{macrocode}
  \def\blindtext@endsentence{.\xspace}%
%    \end{macrocode}
%    \begin{macrocode}
}%\includemath
%    \end{macrocode}
%    \end{macro}    %^^A \blindmathfalse
%    \end{macro}    %^^A\blindtext@endsentence
%
%
% \subsubsection{'Big' Formulas}
% Counter to make some alternation of 'big' formulas.
%    \begin{macrocode}
  \newcount{\blind@Mathformula}
  \blind@Mathformula=0%
%    \end{macrocode}
%    \begin{macro}{\blindtext@formula}
% Make a formula each x sentence.
%    \begin{macrocode}
  \def\blindtext@formula{%
    \advance\blind@Mathformula by 1%
    \ifcase\blind@Mathformula%
        \[\bar x = \frac{1}{n}\sum_{i=1}^{i=n} x_i = \frac{x_1 + x_2 + \dots{} + x_n}{n}\]
    \or \[ \int_0^\infty e^{-\alpha x^2} \mathrm{d}x =
            \frac12\sqrt{\int_{-\infty}^\infty e^{-\alpha x^2}}
            \mathrm{d}x\int_{-\infty}^\infty e^{-\alpha y^2}\mathrm{d}y =
            \frac12\sqrt{\frac{\pi}{\alpha}} \]
    \or \[ \sum_{k=0}^\infty a_0q^k = \lim_{n\to\infty}\sum_{k=0}^n a_0q^k =
            \lim_{n\to\infty} a_0\frac{1-q^{n+1}}{1-q} = \frac{a_0}{1-q}
        \]
    \or \[x_{1,2}=\frac{-b \pm \sqrt{b^2-4ac}}{2a} = \frac{-p \pm \sqrt{p^2-4q}}{2}\]
    \or \[ \frac{\partial^2 \Phi}{\partial x^2} + \frac{\partial^2 \Phi}{\partial y^2} +
            \frac{\partial^2 \Phi}{\partial z^2} =
            \frac{1}{c^2}\frac{\partial^2\Phi}{\partial t^2}
        \]
    \or \[\sqrt[n]{a} \cdot \sqrt[n]{b} =  \sqrt[n]{ab}\]
    \or \[\frac{\sqrt[n]{a}}{\sqrt[n]{b}} =  \sqrt[n]{\frac{a}{b}}\]
    \or \[a\sqrt[n]{b} = \sqrt[n]{a^n b}\]
    \global\blind@Mathformula=0%
    \fi%
}%
%    \end{macrocode}    %^^A \blindtext@formula
%    \end{macro}    %^^A \blindtext@formula
%
%% ^^A-----------------------------------------------------------
% \subsection{Create Complete Documents}
% A flag to sign, if the dummy documents should include a
% table of contents.
%    \begin{macrocode}
\newif\ifblindtoc
\blindtocfalse
%    \end{macrocode}
%
%    \begin{macro}{\blinddocument}
% \cmd{\blinddocument} adds a document with \verb|\chapter|,
% \verb|\section|\ldots, texts and lists (itemize, enumerate,
% description).
%    \begin{macrocode}
\newcommand{\blinddocument}{%
  \ifblindtoc\tableofcontents\fi
  \@ifundefined{chapter}{}{%
    \chapter{\blindtext@heading 0 (chapter)}%
    \blindtext
  }%
  \section{\blindtext@heading 1 (section)}%
    \blindtext
  \subsection{\blindtext@heading 2 (subsection)}%
    \blindtext
  \subsubsection{\blindtext@heading 3 (subsubsection)}%
    \blindtext
  \paragraph{\blindtext@heading 4 (paragraph)}%
    \blindtext
  \section{\blindtext@list}%
  \subsection{\blindtext@listEx (itemize)}%
    \blinditemize
  \subsubsection{\blindtext@listEx (4*itemize)}%
    \blindlistlist{itemize}[2]%
  \subsection{\blindtext@listEx (enumerate)}%
    \blindenumerate
  \subsubsection{\blindtext@listEx (4*enumerate)}%
    \blindlistlist{enumerate}[2]%
  \subsection{\blindtext@listEx (description)}%
    \blinddescription
  \subsubsection{\blindtext@listEx (4*description)}%
    \blindlistlistoptional{description}[2]%
}
%    \end{macrocode}
%    \end{macro}%^^A{\blinddocument}
%
%    \begin{macro}{\Blinddocument}
% \cmd{\blinddocument} adds a document with \verb|\chapter|,
% \verb|\section|\ldots, texts and lists (itemize, enumerate,
% description).
%    \begin{macrocode}
\newcommand{\Blinddocument}{%
  \ifblindtoc\tableofcontents\fi
  \@ifundefined{chapter}{}{%
    \chapter{\blindtext@heading 0 (chapter)}%
    \blindtext
  }%
  \section{\blindtext@heading 1 (section)}%
    \Blindtext
  \subsection{\blindtext@heading 2 (subsection)}%
    \Blindtext
  \subsubsection{\blindtext@heading 3 (subsection)}%
    \Blindtext
  \paragraph{\blindtext@heading 4 (paragraph)}%
    \Blindtext
  \section{\blindtext@list}%
  \subsection{\blindtext@listEx (itemize)}%
    \Blinditemize
  \subsubsection{\blindtext@listEx (4*itemize)}%
    \blind@longtrue
    \blindlistlist{itemize}[2]%
  \subsection{\blindtext@listEx (enumerate)}%
    \Blindenumerate
  \subsubsection{\blindtext@listEx (4*enumerate)}%
    \blind@longtrue
    \blindlistlist{enumerate}[2]%
  \subsection{\blindtext@listEx (description)}%
    \Blinddescription
  \subsubsection{\blindtext@listEx (4*description)}%
    \blind@longtrue
  \blindlistlistoptional{description}[2]%
  %
  \ifblindmath
      \section{\blindtext@blindmath}%
      \blindmathpaper%
  \fi%
}
%    \end{macrocode}
%    \end{macro}%^^A{\Blinddocument}
%
%    \begin{macro}{\blindmathpaper}
%    \changes{V1.9}{2009-05-06}{Adding math}
% Build some text with formulas in between.
%    \begin{macrocode}
\newcommand{\blindmathpaper}{
\blindtext
\blindtext@formula
\blindtext
\blindtext@formula
\blindtext
\blindtext@formula
\blindtext
\blindtext@formula
\blindtext
\blindtext@formula
\blindtext\relax%
}%\blindmathpaper
%    \end{macrocode}
%    \end{macro} %^^A \blindmathpaper
%
%
% \section{Option Processing}
% \subsection{Bible Option}
%    \label{sec:optionbible}
% \subsection{Bible Option}
%    \changes{V2.0}{2011-12-27}{Option bible}
%
% The option bible change the default blind text to texts from the bible.
%    \begin{macrocode}
\newif\ifblindbible
\DeclareOption{bible}{
  \blindbibletrue
}
%    \end{macrocode}
%
%
% \subsection{Random Option}
%    \changes{V2.0}{2011-12-27}{Option random}
%    \begin{macrocode}
\newif\ifblindrandom
%    \end{macrocode}
%    Define a counter for continues text change.
%    \begin{macrocode}
\newcounter{blind@randomcount}\setcounter{blind@randomcount}{0}
%    \end{macrocode}
%  Define a counter to define the number of sentences per paragraph when you use the random option.
%  blind@randommax is redefined in \cmd{blindtext}
%    \begin{macrocode}
\newcounter{blind@randommax}
%    \end{macrocode}
%
% The option random change the default blind text to texts from the random.
% Changes also the counter \emph{blindtext} (Default parameter for \cmd{blindtext}).
%    \begin{macrocode}
\DeclareOption{random}{
\blindrandomtrue
}
%    \end{macrocode}
%
%
% \subsection{Pangram Option}
%    \changes{V2.0}{2012-01-02}{Option pangram}
%    \begin{macrocode}
\newif\ifblindpangram
%    \end{macrocode}
%    Define a counter for continues text change.
%    \begin{macrocode}
\newcounter{blind@pangramcount}\setcounter{blind@pangramcount}{0}
%    \end{macrocode}
%  Define a counter to define the number of sentences per paragraph when you use the pangram option.
%  blind@pangrammax is redefined in \cmd{blindtext}
%    \begin{macrocode}
\newcounter{blind@pangrammax}
%    \end{macrocode}
%
% The option pangram change the default blind text to texts from the pangram.
% Changes also the counter \emph{blindtext} (Default parameter for \cmd{blindtext}).
%    \begin{macrocode}
\DeclareOption{pangram}{
\blindpangramtrue
}
%    \end{macrocode}
%
%
% \subsection{Math Option}
%    \label{sec:optionmath}
%    \changes{V1.9}{2009-06-06}{Option math}
% Activate the math formulas in the text.
%    \begin{macrocode}
\DeclareOption{math}{
    \blindmathtrue
}
%    \end{macrocode}
%
% \subsection{Toc Option}
%    \label{sec:optiontoc}
%    \changes{V1.9}{2009-06-14}{Option toc}
% Activate the table of contents for |\blinddoccument|.
%    \begin{macrocode}
\DeclareOption{toc}{
    \blindtoctrue
}
%    \end{macrocode}
%
% \section{Closing Actions}
% Activate the options
%    \begin{macrocode}
\ProcessOptions\relax
%    \end{macrocode}
%
%
%% ^^A-----------------------------------------------------------
% \section{The Texts}
%
%    \changes{V1.7}{2006-11-21}{Delete trailing spaces in language definitions.}
%
%    \begin{macro}{\blind@addtext}
% This macro adds the texts according to the language definitions.
% Four language packages are supported:
%\begin{itemize}
%  \item babel
%  \item polyglossia (see \url{http://tug.ctan.org/tex-archive/macros/xetex/latex/polyglossia/})
%  \item german
%  \item ngerman
%\end{itemize}
%
%Parameters:
%\begin{enumerate}
%  \item Language
%  \item The text definitions
%\end{enumerate}
%    \begin{macrocode}
\newcommand{\blind@addtext}[2]{%
%    \end{macrocode}
%   First we take care of the babel-package.
%    \begin{macrocode}
    \@ifpackageloaded{babel}{
        \expandafter\addto\csname extras#1\endcsname{#2}
    }{}%
%    \end{macrocode}
%    \changes{V1.9}{2009-06-03}{Support polyglossia}
% Polyglossia provides a complete Babel replacement for users of Xe\LaTeX.
%    \begin{macrocode}
    \@ifpackageloaded{polyglossia}{
        \expandafter\gappto\csname captions#1\endcsname {#2}
    }{}%
%    \end{macrocode}
%    \changes{V1.9}{2009-06-04}{Support (n)german}
% Now some special support for the (n)german-package.
%    \begin{macrocode}
    \@ifpackageloaded{ngerman}{
        \expandafter\g@addto@macro\csname captions#1\endcsname {#2}
    }{}%
    \@ifpackageloaded{german}{
        \expandafter\g@addto@macro\csname captions#1\endcsname {#2}
    }{}%
%    \end{macrocode}
%
%    \begin{macrocode}
}%\blind@addtext
%    \end{macrocode}
%    \end{macro}%^^A\blind@addtext
%
%
% \subsection{Default Without Language}
% First all default texts if no language is selected.
%
%    \begin{macrocode}
\def\blindtext@text{%
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam
    lobortis facilisis sem. Nullam nec mi et neque pharetra
    sollicitudin. Praesent imperdiet mi nec ante. Donec ullamcorper,
    felis non sodales commodo, lectus velit ultrices augue, a
    dignissim nibh lectus placerat pede. Vivamus nunc nunc, molestie
    ut, ultricies vel, semper in, velit. Ut porttitor. Praesent in
    sapien. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    Duis fringilla tristique neque. Sed interdum libero ut metus.
    Pellentesque placerat. Nam rutrum augue a leo. Morbi sed elit sit
    amet ante lobortis sollicitudin. Praesent blandit blandit mauris.
    Praesent lectus tellus, aliquet aliquam, luctus a, egestas a,
    turpis. Mauris lacinia lorem sit amet ipsum. Nunc quis urna dictum
    turpis accumsan semper.%
}
\def\blindtext@count{%
  \ifcase\blind@listitem\or
    First\or Second%...
  \else
    Last%
    \blind@listitem=0 %
  \fi
  \global\advance\blind@listitem by 1 %
}% \blindtext@count
\def\blindtext@item{itemtext}
\def\blindtext@countitem{\blindtext@count\ \blindtext@item}
\def\blindtext@heading{Heading on level\xspace}
\def\blindtext@list{Lists}
\def\blindtext@listEx{Example for list\xspace}
\def\blindtext@blindmath{Some blind text with math formulas}
%    \end{macrocode}
%</package>
%
% ^^A Add text documentations
% \input{blindtext_english.dtx}
% \input{blindtext_german.dtx}
% \input{blindtext_ngerman.dtx}
% \input{blindtext_american.dtx}
% \input{blindtext_catalan.dtx}
% \input{blindtext_latin.dtx}
% \input{blindtext_french.dtx}
%
%<*packageend>
% \section{Thanks}
% Thanks to Heiko Oberdiek and Arno Trautmann for corrections (Version 1.8)
%
% Thanks to Andrea Bergschneider for her idea with math formulas inside the text
% (and Arno Trautmann for his cooperation in realizing it).
% Thanks to Dennis Heidsieck for his hint with polygloss.
% (Version 1.9)
%
% Thanks to Joan Queralt Gil for the Catalanian translation.
% Thanks to Felix Lehmann for corrections of the documentation and German and English blind texts.
% (Version 2.0)
%
% \Finale
% \PrintIndex
% \PrintChanges
% \end{document}
%</packageend>
