summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ragged2e/ragged2e.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/ragged2e/ragged2e.dtx')
-rw-r--r--macros/latex/contrib/ragged2e/ragged2e.dtx1397
1 files changed, 1397 insertions, 0 deletions
diff --git a/macros/latex/contrib/ragged2e/ragged2e.dtx b/macros/latex/contrib/ragged2e/ragged2e.dtx
new file mode 100644
index 0000000000..dd30514ccb
--- /dev/null
+++ b/macros/latex/contrib/ragged2e/ragged2e.dtx
@@ -0,0 +1,1397 @@
+% \iffalse
+\NeedsTeXFormat{LaTeX2e}[2017/03/29]
+%<package>\ProvidesPackage{ragged2e}
+%<package> [2019/07/28 v2.2 ragged2e Package (MS)]
+%
+%<*driver>
+\ProvidesFile{ragged2e.drv}
+ [2019/03/26 v1.09 Driver for ragged2e Package (MS)]
+\documentclass[a4paper]{ltxdoc}
+\usepackage[T1]{fontenc}
+\usepackage{lmodern}
+\usepackage{microtype}
+\usepackage{url} % in latex/contrib/other/misc
+\usepackage{array}
+\usepackage{tabularx}
+\usepackage{gitinfo2}
+\usepackage{hypdoc}
+\usepackage{geometry}
+% booktabs.sty is in latex/contrib/supported/booktab
+\IfFileExists{booktabs.sty}{%
+ \usepackage{booktabs}%
+ }{%
+ \PackageWarning{ragged2e}%
+ {booktabs.sty is missing.\MessageBreak
+ I'm emulating the needed commands, but you should\MessageBreak
+ install it for better results}%
+ \let\toprule\hline
+ \let\midrule\hline
+ \let\bottomrule\hline
+ }
+\IfFileExists{footmisc.sty}{%
+ \usepackage[document]{ragged2e}[2003/01/26]
+ }{%
+ \PackageWarning{ragged2e}%
+ {footmisc.sty is missing.\MessageBreak
+ You should install it for better results}%
+ \usepackage[raggedrightboxes]{ragged2e}[2003/01/26]
+ }
+\setlength{\RaggedRightRightskip}{0pt plus 4em}%
+\GetFileInfo{ragged2e.sty}
+\EnableCrossrefs
+\RecordChanges % Gather update information
+%%\DisableCrossrefs% Say \DisableCrossrefs if index is ready
+\CodelineIndex % Index code by line number
+%\OnlyDescription % comment out for implementation details
+%%\OldMakeIndex % use if your MakeIndex is pre-v2.9
+\setcounter{IndexColumns}{2}
+% onecolumn glossary
+\makeatletter
+ \renewenvironment{theglossary}{%
+ \glossary@prologue
+ \setlength\emergencystretch{5em}
+ \GlossaryParms \let\item\@idxitem \ignorespaces}{}
+ \makeatother
+\setlength{\IndexMin}{40ex}
+\setlength{\columnseprule}{.4pt}
+\addtolength{\oddsidemargin}{3cm}
+\addtolength{\textwidth}{-3cm}
+\begin{document}
+ \DocInput{ragged2e.dtx}
+ \PrintIndex\PrintChanges
+ % Make sure that the index is not printed twice
+ % (ltxdoc.cfg might have a second \PrintIndex command)
+ \let\PrintChanges\relax
+ \let\PrintIndex\relax
+\end{document}
+%</driver>
+%
+%% Copyright 1996..2019 by Martin Schr\"oder.
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `unmaintained'.
+%
+% This work consists of the files ragged2e.dtx and ragged2e.ins
+% and the derived file ragged2e.sty.
+%
+% \fi
+%
+% \CheckSum{478}
+%
+%% \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 \~}
+%%
+%% \iffalse meta-comment
+%% ===================================================================
+%% @LaTeX-style-file{
+%% author = {Martin Schr\"oder},
+%% version = "2.2",
+%% date = "26 Mar 2019",
+%% filename = "ragged2e.sty",
+%% address = {Martin Schr\"oder
+%% Unterstra\"se 31
+%% 47051 Duisburg
+%% Germany}
+%% email = "martin@oneiros.de",
+% codetable = "ISO/ASCII",
+% keywords = "raggedright",
+% dependences = "everysel",
+% supported = "yes",
+%% docstring = "LaTeX package which defines new commands
+%% \Centering, \RaggedLeft, \RaggedRight and
+%% \justifying and new environments Center,
+%% FlushLeft, FlushRight and justify, which
+%% set ragged text and are easily configurable
+%% to allow hyphenation.
+%% Uses the everysel package.
+%% "
+%% }
+%% ===================================================================
+%% \fi
+%
+% \pagestyle{headings}
+%
+% \newcommand*{\file}[1] {\texttt{#1}}
+% \newcommand{\plain} {\texttt{plain}}
+% \newcommand{\bs} {\texttt{\symbol{'134}}}
+% \newcommand*{\env}[1] {\textsf{#1}}
+% \newcommand*{\option}[1] {\textsf{#1}}
+% \newcommand*{\package}[1] {\textsf{#1}}
+% \newcommand*{\NEWfeature}[1]{%
+% \hskip 1sp \marginpar{\small\sffamily\raggedright
+% New feature\\#1}}
+% \newcommand*{\NEWdescription}[1]{%
+% \hskip 1sp \marginpar{\small\sffamily\raggedright
+% New description\\#1}}
+%
+% \changes{v1.00}{1996/05/30}{New from \package{raggedright} V 1.21}
+% \changes{v1.01}{1998/08/09}{Documentation improved}
+% \changes{v1.02}{1999/06/08}{Moved to LPPL}
+% \changes{v2.00}{2003/01/04}{Incorporated \package{raggedr}}
+% \changes{v2.2}{2019/03/26}{Require a new version of \LaTeX (2017/03/29)}
+%
+% \hyphenation{flush-left rag-ged rag-ged-right}
+%
+% \newenvironment{Quote}{^^A
+% \begin{quote}^^A
+% \small^^A
+% \fussy^^A
+% }{^^A
+% \end{quote}^^A
+% }
+%
+% \renewcommand{\thefootnote}{\ensuremath{\fnsymbol{footnote}}}
+%
+% ^^A -----------------------------
+%
+% \changes{v2.2}{2019/03/26}{Move to git/gitlab, use \package{svninfo2}}
+%
+% \title{\unskip
+% The \textsf{ragged2e}-package^^A
+% \thanks{^^A
+% The version number of this file is \fileversion,
+% revision~\#\gitAbbrevHash, last revised \protect\gitAuthorIsoDate.}^^A
+% }
+% \author{Martin Schr\"oder\\[0.5ex]
+% \normalsize Unterstra\ss{}e 31\\
+% \normalsize 47051 Duisburg\\
+% \normalsize Germany\\
+% \normalsize \texttt{martin@oneiros.de}\\
+% \normalsize \url{https://gitlab.com/hagenbuch/ragged2e}}
+% \date{\filedate}
+% \maketitle
+%
+% ^^A -----------------------------
+%
+% \begin{abstract}
+% This package provides new commands and environments for setting
+% ragged text which are easy to configure to allow hyphenation.
+% An earlier attempt to do this was the style
+% \package{raggedright}\,\cite{raggedri} by the same author.
+% \end{abstract}
+%
+%
+% ^^A -----------------------------
+%
+% \tableofcontents
+%
+% ^^A -----------------------------
+%
+% \begin{multicols}{2}
+% \fussy
+%
+% \setlength{\parskip}{^^A
+% .3\baselineskip plus.05\baselineskip minus.05\baselineskip}
+%
+% \section{Status of this package}
+% \changes{v2.2}{2019/07/28}{Change maintenance status of package}
+% ^^A
+% This package is \emph{unmaintained}.
+%
+% I will not actively work on this package anymore. I \emph{may}
+% merge merge requests to the repository on Gitlab
+% (\url{https://gitlab.com/hagenbuch/ragged2e}). If you want to
+% become the maintainer of this package, contact me and I may hand
+% over the repository to you. Or fork the package on Gitlab.
+%
+% I will \emph{not} upload new versions to CTAN.
+%
+% \section{The problem}
+% ^^A
+% \LaTeX{} has three commands (\cs{centering}, \cs{raggedleft}, and
+% \cs{raggedright}) and three environments (\env{center},
+% \env{flushleft}, and \env{flushright}) to typeset ragged text.
+% The environments are based upon the commands (\env{center} uses
+% \cs{centering}, \env{flushleft} \cs{raggedright}, and
+% \env{flushright} \cs{raggedleft}).
+%
+% These commands have, however, one serious flaw: they render
+% hyphenation almost impossible, and thus the text looks \emph{too}
+% ragged, as the following example shows:
+% \setcounter{unbalance}{2}
+% \begin{multicols}{2}
+% \small\fussy
+% \raggedright
+% \cs{raggedright}:\\
+% ``The \LaTeX{} document preparation system is a special version
+% of Donald Knuth's \TeX{} program.
+% \TeX{} is a sophisticated program designed to produce
+% high-quality typesetting, especially for mathematical text.''
+% \cite[p\@. xiii]{lamport86}
+%
+% \newpage
+% \RaggedRight
+% \cs{RaggedRight}:\\
+% ``The \LaTeX{} document preparation system is a special version
+% of Donald Knuth's \TeX{} program.
+% \TeX{} is a sophisticated program designed to produce
+% high-quality typesetting, especially for mathematical text.''
+% \cite[p\@. xiii]{lamport86}
+% \end{multicols}
+%
+% \setcounter{unbalance}{0}
+%
+% ^^A -----------------------------
+%
+% \section{Old ``solutions''}
+%
+% ^^A -----------------------------
+%
+% \subsection{\LaTeX}
+% ^^A
+% \LaTeX{} defines e.\,g.\ \cs{raggedright} as follows:
+% \begin{macrocode}
+%<*latex>
+\def\raggedright{%
+ \let\\=\@centercr
+ \@rightskip\@flushglue
+ \rightskip\@rightskip
+ \leftskip\z@
+ \parindent\z@}
+% \end{macrocode}
+% Initially, \cs{@flushglue} is defined as
+% \begin{macrocode}
+\@flushglue = 0pt plus 1fil
+%</latex>
+% \end{macrocode}
+%
+% Thus the \cs{rightskip} is set to |0pt plus 1fil|.
+% Knuth, however warns \cite[p\@. 101]{KnuthTeXa}:
+% \begin{Quote}
+% ``For example, a person can set \cs{rightskip=0pt plus 1fil},
+% and every line will be filled with space to the right.
+% But this isn't a particularly good way to make ragged-right
+% margins, because the infinte stretchability will assign zero
+% badness to lines that are very short.
+% To do a decent job of ragged-right setting, the trick is to set
+% \cs{rightskip} so that it will stretch enough to make line breaks
+% possible, yet not too much, because short lines should be
+% considered bad.
+% Furthermore the spaces between words should be fixed so that
+% they do not stretch or shrink.''
+% \end{Quote}
+%
+% ^^A -----------------------------
+%
+% \subsection{\plain{}}
+% ^^A
+% \plain{} \TeX{} defines an special version of
+% \cs{raggedright}, which operates the way Knuth describes it;
+% but which can not be used whith \LaTeX, because \LaTeX{} redefines
+% \cs{raggedright}.
+% \begin{macrocode}
+%<*plain>
+\def\raggedright{%
+ \rightskip\z@ plus2em
+ \spaceskip.3333em
+ \xspaceskip.5em\relax}
+% \end{macrocode}
+%
+% \plain{} provides also a version of \cs{raggedright} for typewriter
+% fonts
+% \begin{macrocode}
+\def\ttraggedright{%
+ \tt
+ \rightskip\z@ plus2em\relax}
+%</plain>
+% \end{macrocode}
+%
+% \end{multicols}
+% \setlength{\parskip}{^^A
+% .3\baselineskip plus.05\baselineskip minus.05\baselineskip}
+%
+% ^^A -----------------------------
+%
+% \section{Our solution}
+%
+% Since the \plain{} solution can not be used with \LaTeX, we have to
+% redefine it and make it possible to configure it for personal
+% preferences.
+%
+% ^^A -----------------------------
+%
+% \subsection{The macros}
+% ^^A
+% \DescribeMacro{\Centering}
+% \DescribeMacro{\RaggedLeft}
+% \DescribeMacro{\RaggedRight}
+% \cs{Centering}, \cs{RaggedLeft}, and \cs{RaggedRight} can be used in
+% the same way as \cs{centering}, \cs{raggedleft}, and
+% \cs{raggedright}:
+% Just type the command, and after that the whole text will be set
+% centered, ragged-left or ragged-right.
+%
+% For example, we switched on \cs{RaggedRight} on the top of this
+% text, and consequently this text was set
+% ragged-right.\footnote{^^A
+% For this documentation we also set \cs{RaggedRightRightskip}
+% higher than usual (|0pt plus 4em| instead of |0pt plus 2em|)
+% because of all the long command names which make linebreaking
+% difficult.}
+%
+% \DescribeMacro{\justifying}
+% \NEWfeature{2003/01/04}%
+% \cs{justifying} switches back to justified text after ragged text
+% has been switched on.
+% \changes{v2.00}{2003/01/04}{New command \cs{justifying}}
+%
+% The new commands \cs{Centering}, \cs{RaggedLeft}, and
+% \cs{RaggedRight} are fully compatible with their counterparts in
+% \LaTeX, but implement the \plain{} solution and can be easily
+% configured using the following parameters:
+%
+% ^^A -----------------------------
+%
+% \subsection{The parameters}
+% ^^A
+% \changes{v2.00}{2003/01/25}{Removed \cs{RaggedSpaceskip} and
+% \cs{RaggedXSpaceskip}}%
+% \begin{tabularx}{\linewidth}{lX}\toprule
+% Command & Uses\tabularnewline \midrule
+% \cs{Centering} & \cs{CenteringLeftskip},
+% \cs{CenteringRightskip},
+% \cs{CenteringParfillskip},
+% \cs{CenteringParindent}
+% \tabularnewline
+% \cs{RaggedLeft} & \cs{RaggedLeftLeftskip},
+% \cs{RaggedLeftRightskip},
+% \cs{RaggedLeftParfillskip},
+% \cs{RaggedLeftParindent}
+% \tabularnewline
+% \cs{RaggedRight} & \cs{RaggedRightLeftskip},
+% \cs{RaggedRightRightskip},
+% \cs{RaggedRightParfillskip},
+% \cs{RaggedRightParindent}
+% \tabularnewline
+% \cs{justifying} & \cs{JustifyingParfillskip},
+% \cs{JustifyingParindent}
+% \tabularnewline
+% \bottomrule
+% \end{tabularx}
+%
+% All Parameters can be set with \cs{setlength}, e.\,g.\
+% \begin{Quote}
+% |\setlength{\RaggedRightRightskip}{0pt plus 1em}|
+% \end{Quote}
+% sets \cs{RaggedRightRightskip} to |0pt plus 1em|.
+%
+% \DescribeMacro{\CenteringLeftskip}
+% \DescribeMacro{\RaggedLeftLeftskip}
+% \DescribeMacro{\RaggedRightLeftskip}
+% These are the \cs{leftskip}s inserted by \cs{Centering},
+% \cs{RaggedLeft}, and \cs{RaggedRight}.
+% \begin{Quote}
+% \setlength{\tabcolsep}{.25em}
+% \begin{tabularx}{\linewidth}{lX}
+% ``\cs{leftskip} & (glue at left of justified lines)''
+% \cite[p.~274]{KnuthTeXa}
+% \end{tabularx}
+% \end{Quote}
+% \cs{leftskip} must be set to a finite value, to make hyphenation
+% possible.
+% Setting it to infinite values like |0pt plus 1fil| makes
+% hyphenation almost impossible.
+%
+% \DescribeMacro{\CenteringRightskip}
+% \DescribeMacro{\RaggedLeftRightskip}
+% \DescribeMacro{\RaggedRightRightskip}
+% These are the \cs{rightskip}s inserted by \cs{Centering},
+% \cs{RaggedLeft}, and \cs{RaggedRight}.
+% \begin{Quote}
+% \setlength{\tabcolsep}{.25em}
+% \begin{tabularx}{\linewidth}{lX}
+% ``\cs{rightskip} & (glue at right of justified lines)''
+% \cite[p.~274]{KnuthTeXa}
+% \end{tabularx}
+% \end{Quote}
+% \cs{rightskip} must be set to a finite value, to make hyphenation
+% possible.
+% Setting it to infinite values like |0pt plus 1fil| makes
+% hyphenation almost impossible.
+%
+% \DescribeMacro{\CenteringParfillskip}
+% \DescribeMacro{\RaggedLeftParfillskip}
+% \DescribeMacro{\RaggedRightParfillskip}
+% \DescribeMacro{\JustifyingParfillskip}
+% These are the \cs{parfillskip}s inserted by \cs{Centering},
+% \cs{RaggedLeft}, \cs{RaggedRight}, and \cs{justifying}.
+% \begin{Quote}
+% \setlength{\tabcolsep}{.25em}
+% \begin{tabularx}{\linewidth}{lX}
+% ``\cs{parfillskip} & (additional \cs{rightskip} at end of paragraphs)''
+% \cite[p.~274]{KnuthTeXa}
+% \end{tabularx}
+% \end{Quote}
+% The normal setting for \cs{parfillskip} is |0pt plus 1fil|; the
+% parameters are provided for testing combinations of
+% \cs{}\{|left|$\mid$|right|\}|skip| and \cs{parfillskip}.
+%
+% \DescribeMacro{\CenteringParindent}
+% \DescribeMacro{\RaggedLeftParindent}
+% \DescribeMacro{\RaggedRightParindent}
+% \DescribeMacro{\JustifyingParindent}
+% These are the \cs{parindent}s used by \cs{Centering},
+% \cs{RaggedLeft}, \cs{RaggedRight}, and \cs{justifying}.
+% \begin{Quote}
+% \setlength{\tabcolsep}{.25em}
+% \begin{tabularx}{\linewidth}{lX}
+% ``\cs{parindent} & (width of \cs{indent})''
+% \cite[p.~274]{KnuthTeXa}
+% \end{tabularx}
+% \end{Quote}
+% \cs{parindent} is the indent of the first line of a paragraph and
+% should be set to |0pt|, since indented lines in ragged text
+% do not look good.
+%
+% The parameters have the following initial setting:
+% \begin{center}
+% \begin{tabularx}{\linewidth}{l>{\ttfamily}X>{\ttfamily}X}\toprule
+% Parameter & \normalfont\LaTeX{} setting
+% & \normalfont\package{ragged2e} setting\footnotemark\\
+% \midrule
+% \cs{CenteringLeftskip} & 0pt plus 1fil
+% & 0pt plus 2em\\
+% \cs{RaggedLeftLeftskip} & 0pt plus 1fil
+% & 0pt plus 2em\\
+% \cs{RaggedRightLeftskip} & 0pt plus 0pt minus 0pt
+% & 0pt plus 0pt minus 0pt\\
+% \cs{CenteringRightskip} & 0pt plus 1fil
+% & 0pt plus 2em\\
+% \cs{RaggedLeftRightskip} & 0pt plus 0pt minus 0pt
+% & 0pt plus 0pt minus 0pt \\
+% \cs{RaggedRightRightskip} & 0pt plus 1fil
+% & 0pt plus 2em\\
+% \cs{CenteringParfillskip} & 0pt plus 0pt minus 0pt
+% & 0pt plus 0pt minus 0pt \\
+% \cs{RaggedLeftParfillskip} & 0pt plus 0pt minus 0pt
+% & 0pt plus 0pt minus 0pt \\
+% \cs{RaggedRightParfillskip}& 0pt plus 1fil
+% & 0pt plus 1fil\\
+% \cs{CenteringParindent} & 0pt
+% & 0pt \\
+% \cs{RaggedLeftParindent} & 0pt
+% & 0pt \\
+% \cs{RaggedRightParindent} & 0pt
+% & 0pt \\
+% \cs{JustifyingParfillskip} &
+% & 0pt plus 1fil \tabularnewline
+% \cs{JustifyingParindent} &
+% & \cs{parindent} \tabularnewline
+% \bottomrule
+% \end{tabularx}
+% \end{center}
+% \footnotetext{^^A
+% For proportional and monospaced fonts.}
+%
+% ^^A -----------------------------
+%
+% \subsection{The environments}
+% ^^A
+% \DescribeEnv{Center}
+% \env{Center} is fully compatible with \env{center}, but uses
+% \cs{Centering} instead of \cs{centering}.
+%
+% \DescribeEnv{FlushLeft}
+% \env{FlushLeft} is fully compatible with \env{flushleft}, but uses
+% \cs{RaggedRight} instead of \cs{raggedright}.
+%
+% \DescribeEnv{FlushRight}
+% \env{FlushRight} is fully compatible with \env{flushright}, but uses
+% \cs{RaggedLeft} instead of \cs{raggedleft}.
+%
+% \DescribeEnv{justify}
+% \NEWfeature{2003/01/04}%
+% \env{justify} is like the other environments but uses \cs{justifying}.
+% \changes{v2.00}{2003/01/04}{New environment \env{justify}}
+%
+% E.\,g.\ \env{FlushLeft} can be used in the same way as
+% \env{flushleft}:
+% \begin{verse}
+% \small
+% |\begin{FlushLeft}|\\
+% \meta{text, which is set ragged-right}\\
+% |\end{FlushLeft}|
+% \end{verse}
+%
+% ^^A -----------------------------
+%
+% \section{Options}
+% ^^A
+% This package has the following options:
+% \changes{v2.00}{2003/01/04}{Allow all-lowercase versions of
+% options and removed documentation of
+% mixed-case versions.}
+% \nopagebreak
+% \begin{description}
+% \item[\normalfont\option{originalcommands}]
+% The \LaTeX-commands \cs{centering}, \cs{raggedleft}, and
+% \cs{raggedright} and the \LaTeX-environments \env{center},
+% \env{flushleft}, and \env{flushright} remain unchanged.\newline
+% It is the default.
+% \item[\normalfont\option{newcommands}]
+% The \LaTeX-commands \cs{centering}, \cs{raggedleft}, and
+% \cs{raggedright} and the \LaTeX-environments \env{center},
+% \env{flushleft}, and \env{flushright} are set equal to their
+% counterparts defined by \package{ragged2e}.
+% Thus \cs{raggedright} invokes \cs{RaggedRight}.
+% The original commands can be accessed unter the Names
+% \cs{LaTeX}\meta{original name}, e.\,g.\ \cs{LaTeXraggedright}.
+% \item[\normalfont\option{originalparameters}]
+% The parameters used by the commands implemented by
+% \package{ragged2e} are initialized with the default settings
+% used by \LaTeX.
+% \item[\normalfont\option{newparameters}]
+% The parameters used by the commands implemented by
+% \package{ragged2e} are initialized with the default settings
+% defined by \package{ragged2e}.\newline
+% It is the default.
+% \item[\normalfont\option{raggedrightboxes}]
+% \changes{v2.00}{2003/01/04}{New option \option{raggedrightboxes}}
+% \NEWfeature{2003/01/18}
+% All \cs{parbox}es, \env{minipage}s, \cs{marginpar}s and
+% |p|-columns of \env{tabular}s and \env{array}s are
+% automatically set using \cs{RaggedRight}.
+% \item[\normalfont\option{footnotes}]
+% \changes{v2.00}{2003/01/18}{New option \option{footnotes}}
+% \NEWfeature{2003/01/18}
+% This options sets all footnotes ragged-right by loading the
+% \package{footmisc}\,\cite{footmisc} package with the
+% \option{ragged} option.
+% \item[\normalfont\option{document}]
+% \changes{v2.00}{2003/01/18}{New option \option{document}}
+% \NEWfeature{2003/01/18}
+% This options sets the complete document ragged-right by
+% executing a \cs{RaggedRight} at \cs{begin\{document\}} and
+% the \option{raggedrightboxes} and the \option{footnotes}
+% options.
+% \end{description}
+% All other options are passed to the \package{footmisc} package if
+% the \option{footnotes} option is selected.
+%
+%
+% ^^A -----------------------------
+%
+% \section{Required packages}
+% ^^A
+% \changes{v2.1}{2003/10/08}{document that \option{document} needs
+% \package{footmisc}}
+% This package requires the following packages:
+% \begin{description}
+% \item[\normalfont\package{everysel}\,\cite{everysel}]
+% It is used to distinguish between monospaced and proportional
+% fonts.
+% \item[\normalfont\package{footmisc}\,\cite{footmisc}]
+% It is used by the \option{footnotes} and the
+% \option{document} options; at least version~5.00 (2002/08/28)
+% is needed.
+% \end{description}
+%
+%
+% ^^A -----------------------------
+%
+% \StopEventually{^^A
+%
+%
+% ^^A -----------------------------
+%
+% \section{Acknowledgements}
+% ^^A
+% A first version of this package for \LaTeX2.09 was named
+% \package{raggedri}\,\cite{raggedri}.
+% Laurent Siebenmann (\url{lcs@topo.math.u-psud.fr}) with his
+% style \package{ragged.sty}\,\cite{ragged} provided the final impulse
+% for this new implementation.\newline
+% The code for \cs{justifying}, \env{justify} and the overloading of
+% \cs{@arrayparboxrestore} is incorporated from the
+% \package{raggedr}\,\cite{raggedr} package by James Kilfinger
+% (\url{mapdn@csv.warwick.ac.uk}).\newline
+% Without the constant nagging of Rainer Sieger
+% (\url{rsieger@awi-bremerhaven.de}) this package might not
+% be.\newline
+% Markus Kohm (\url{markus.kohm@gmx.de}) provided the code for
+% \cs{@gnewline}.\newline
+% Frank Mittelbach (\url{frank.mittelbach@latex-project.org})
+% provided the impetus for version~2.00.\newline
+% Rolf Niepraschk (\url{Rolf.Niepraschk@gmx.de}) and Hubert G\"a\ss{}lein
+% found many bugs and provided fixes for them and code for new
+% features.\newline
+% Jordan Firth (\url{jafirth@ncsu.edu}) provided the final push for
+% version~2.2.
+%
+% ^^A -----------------------------
+%
+% \newcommand{\noopsort}[1]{} \newcommand{\printfirst}[2]{##1}
+% \newcommand{\singleletter}[1]{##1} \newcommand{\switchargs}[2]{##2##1}
+% \begin{thebibliography}{1}
+%
+% \bibitem{ltmiscen}
+% Johannes Braams, David Carlisle, Alan Jeffrey, Leslie Lamport, Frank
+% Mittelbach, Chris Rowley, and Rainer Sch{\"o}pf.
+% \newblock ltmiscen.dtx.
+% \newblock Part of the {\LaTeX}-distribution.
+%
+% \bibitem{footmisc}
+% Robin Fairbairns.
+% \newblock \texttt{footmisc} --- a portmanteau package for
+% customising footnotes in \LaTeXe.
+% \newblock \url{CTAN: tex-archive/macros/latex/contrib/supported/footmisc/footmisc.dtx}.
+%
+% \bibitem{raggedr}
+% James Kilfiger.
+% \newblock \url{CTAN: tex-archive/macros/latex/contrib/other/misc/raggedr.sty}.
+% \newblock \LaTeXe{} package.
+%
+% \bibitem{KnuthTeXa}
+% Donald~E. Knuth.
+% \newblock \emph{The {\TeX}Book}, volume~A of \emph{Computers \& Typesetting}.
+% \newblock Ad{\-d}i{\-s}on-Wes{\-l}ey, Reading, MA, USA, {\noopsort{1986a}}1986.
+%
+% \bibitem{lamport86}
+% Leslie Lamport.
+% \newblock \emph{\LaTeX: A Document Preparation System}.
+% \newblock Ad{\-d}i{\-s}on-Wes{\-l}ey, Reading, MA, USA, first edition, 1986.
+%
+% \bibitem{cmfonts}
+% Frank Mittelbach and Rainer Sch{\"o}pf.
+% \newblock The file {\texttt{cmfonts.fdd}} for use with {\LaTeXe}.
+% \newblock Part of the {\LaTeX}-distribution.
+%
+% \bibitem{everysel}
+% Martin Schr{\"o}der.
+% \newblock The \package{everysel}-package.
+% \newblock \url{CTAN: tex-archive/macros/latex/contrib/supported/ms/everysel.dtx}.
+% \newblock \LaTeXe{} package.
+%
+% \bibitem{raggedri}
+% Martin Schr{\"o}der.
+% \newblock The \package{raggedri} document option.
+% \newblock Was in \url{CTAN: tex-archive/macros/latex209/contrib/raggedright}.
+% \newblock \LaTeX2.09 style, outdated.
+%
+% \bibitem{ragged}
+% Laurent Siebenmann.
+% \newblock \texttt{ragged.sty}.
+% \newblock \url{CTAN: tex-archive/macros/generic/ragged.sty}.
+% \newblock generic macro file for \texttt{plain} and \LaTeX.
+%
+% \end{thebibliography}
+% }
+%
+% ^^A -----------------------------
+%
+% \section{The implementation}
+% \changes{v2.00}{2003/01/10}{Removed spaces and unneeded braces
+% from \cs{setlength}; replaced
+% \texttt{plus} with \cs{@plus}}
+% \changes{v2.02}{2003/02/24}{Removed \cs{setlength}}
+% \changes{v2.02}{2003/02/24}{Use \cs{@flushglue}}
+%
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+%
+%
+% ^^A -----------------------------
+%
+% \subsection{Initial Code}
+% ^^A
+% \begin{macro}{\if@raggedtwoe@originalcommands}
+% \cs{if@raggedtwoe@originalcommands} is used to flag the use of the
+% \option{originalcommands} or \option{newcommands} option.
+% \begin{macrocode}
+\newif\if@raggedtwoe@originalcommands
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\if@raggedtwoe@originalparameters}
+% \cs{if@raggedtwoe@originalparameters} is used to flag the use of the
+% \option{originalparameters} or \option{newparameters} option.
+% \begin{macrocode}
+\newif\if@raggedtwoe@originalparameters
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\if@raggedtwoe@footmisc}
+% \cs{if@raggedtwoe@footmisc} is used to flag the use of the
+% \option{footnotes} option.
+% \changes{v2.00}{2003/01/18}{New macro}%
+% \begin{macrocode}
+\newif\if@raggedtwoe@footmisc
+% \end{macrocode}
+% \end{macro}
+%
+%
+% ^^A -----------------------------
+%
+% \subsection{Declaration of options}
+%
+%
+% ^^A -----------------------------
+%
+% \subsubsection{\option{originalcommands} option}
+% ^^A
+% The \option{originalcommands} and \option{newcommands} options
+% control the meaning of the \LaTeX-commands for ragged text:
+% If \option{newcommands} is used the \LaTeX-commands are set equal
+% to the commands defined by \package{ragged2e}.
+% \changes{v2.00}{2003/01/04}{Allow all-lowercase versions of options}
+% \begin{macrocode}
+\DeclareOption{OriginalCommands}{\@raggedtwoe@originalcommandstrue}
+\DeclareOption{originalcommands}{\@raggedtwoe@originalcommandstrue}
+\DeclareOption{NewCommands}{\@raggedtwoe@originalcommandsfalse}
+\DeclareOption{newcommands}{\@raggedtwoe@originalcommandsfalse}
+% \end{macrocode}
+%
+%
+% ^^A -----------------------------
+%
+% \subsubsection{\option{originalparameters} option}
+% ^^A
+% The \option{originalparameters} and \option{newparameters} options
+% control the defaults for the parameters used by the commands
+% implemented by \package{ragged2e}:
+% If \option{newparameters} is used the parameters are set to the
+% values defined by \package{ragged2e}.
+% \changes{v2.00}{2003/01/04}{Allow all-lowercase versions of options}
+% \begin{macrocode}
+\DeclareOption{OriginalParameters}{\@raggedtwoe@originalparameterstrue}
+\DeclareOption{originalparameters}{\@raggedtwoe@originalparameterstrue}
+\DeclareOption{NewParameters}{\@raggedtwoe@originalparametersfalse}
+\DeclareOption{newparameters}{\@raggedtwoe@originalparametersfalse}
+% \end{macrocode}
+%
+%
+% ^^A -----------------------------
+%
+% \subsubsection{\option{raggedrightboxes} option}
+% ^^A
+% \changes{v2.00}{2003/01/04}{New option \option{raggedrightboxes}}%
+% The option \option{raggedrightboxes} sets all
+% \cs{parbox}es, \env{minipage}s, \cs{marginpar}s and |p|-columns of
+% \env{tabular}s and \env{array}s using \cs{RaggedRight}.
+% This is done by redefining \cs{@arrayparboxrestore}.
+% \begin{macro}{\@raggedtwoe@raggedrightboxes@opt}
+% \cs{@raggedtwoe@raggedrightboxes@opt} is the code executed via
+% \cs{DeclareOption}.
+% \changes{v2.00}{2003/01/18}{New macro}%
+% \changes{v2.2}{2019/03/26}{Definition of \cs{@arrayparboxrestore}
+% has changed}%
+% \begin{macrocode}
+\newcommand*{\@raggedtwoe@raggedrightboxes@opt}{
+% \end{macrocode}
+% First we check if \cs{@arrayparboxrestore} is unchanged.
+% \begin{macrocode}
+ \CheckCommand*{\@arrayparboxrestore}{%
+ \let\if@nobreak\iffalse
+ \let\if@noskipsec\iffalse
+ \let\par\@@par
+ \let\-\@dischyph
+ \let\'\@acci\let\`\@accii\let\=\@acciii
+ \parindent\z@ \parskip\z@skip
+ \everypar{}%
+ \linewidth\hsize
+ \@totalleftmargin\z@
+ \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
+ \parfillskip\@flushglue
+ \lineskip\normallineskip
+ \lineskiplimit\normallineskiplimit
+ \baselineskip\normalbaselineskip
+ \sloppy}%
+% \end{macrocode}
+% Then we redefine it by removing the setting of \cs{leftskip},
+% \cs{rightskip}, \cs{@rightskip} and \cs{parfillskip} and instead
+% calling \cs{RaggedRight}.
+% \changes{v2.04}{2003/03/02}{The setting of \cs{parindent} is
+% superfluous}%
+% \begin{macrocode}
+ \renewcommand{\@arrayparboxrestore}{%
+ \let\if@nobreak\iffalse
+ \let\if@noskipsec\iffalse
+ \let\par\@@par
+ \let\-\@dischyph
+ \let\'\@acci\let\`\@accii\let\=\@acciii
+ \parskip\z@skip
+ \everypar{}%
+ \linewidth\hsize
+ \@totalleftmargin\z@
+ \RaggedRight
+ \lineskip\normallineskip
+ \baselineskip\normalbaselineskip
+ \lineskiplimit\normallineskiplimit
+ \sloppy}%
+% \end{macrocode}
+% Now we self-destroy so the command can be called more than once
+% without causing harm (and it also frees up some space).
+% \begin{macrocode}
+ \let\@raggedtwoe@raggedrightboxes@opt\relax
+ }
+% \end{macrocode}
+% \end{macro}
+% Finally the declaration of the option.
+% \begin{macrocode}
+\DeclareOption{raggedrightboxes}{\@raggedtwoe@raggedrightboxes@opt}
+% \end{macrocode}
+%
+%
+% ^^A -----------------------------
+%
+% \subsubsection{\option{footnotes} option}
+% ^^A
+% \changes{v2.00}{2003/01/18}{New option \option{footnotes}}%
+% \changes{v2.02}{2003/02/24}{Bugfix: \cs{if@raggedtwoe@footmisctrue}
+% \ensuremath{\rightarrow} \cs{@raggedtwoe@footmisctrue}}%
+% \changes{v2.03}{2003/02/26}{Bugfix: \option{footnotes} was actually
+% \option{raggedrightboxes}}
+% The option \option{footnotes} just sets a flag
+% (\cs{if@raggedtwoe@footmisc}) to load the \option{footmisc}
+% package and passes the option \option{ragged} to it.
+% \begin{macrocode}
+\DeclareOption{footnotes}{%
+ \@raggedtwoe@footmisctrue
+ \PassOptionsToPackage{ragged}{footmisc}%
+ }
+% \end{macrocode}
+%
+%
+% ^^A -----------------------------
+%
+% \subsubsection{\option{document} option}
+% ^^A
+% \changes{v2.00}{2003/01/18}{New option \option{document}}%
+% The option \option{document} sets the complete document
+% ragged-right by executing \cs{RaggedRight} via \cs{AtBeginDocument}
+% and also executing the \option{raggedrightboxes} option.
+% \begin{macro}{\@raggedtwoe@abdhook}
+% \cs{@raggedtwoe@abdhook} is the code executed via
+% \cs{AtBeginDocument}: Give a message on the terminal, execute
+% \cs{RaggedRight} and self-destroy.
+% We also make \cs{@tocrmarg} flexible; otherwise long lines in the
+% table of contents (and similar tables) would not be broken because
+% the spaceskip is rigid.
+% \changes{v2.00}{2003/01/18}{New macro}%
+% \changes{v2.04}{2003/03/02}{Set \cs{@tocrmarg} and use
+% \cs{PackageInfo}}%
+% \changes{v2.1}{2006/07/23}{bugfix: Use \cs{@tocrmarg} only if it's
+% defined}%
+% \begin{macrocode}
+\newcommand{\@raggedtwoe@abdhook}{%
+ \PackageInfo{ragged2e}{ABD: executing \string\RaggedRight}%
+ \RaggedRight
+ \@ifundefined{@tocrmarg}{}{\edef\@tocrmarg{\@tocrmarg plus 2em}}%
+ \let\@raggedtwoe@abdhook\relax
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@raggedtwoe@document@opt}
+% \cs{@raggedtwoe@document@opt} is the code executed via
+% \cs{DeclareOption}: Insert the code into \cs{AtBeginDocument},
+% execute the \option{raggedrightboxes} and \option{footnotes} options
+% and self-destroy.
+% \changes{v2.00}{2003/01/18}{New macro}%
+% \begin{macrocode}
+\newcommand{\@raggedtwoe@document@opt}{%
+ \AtBeginDocument{\@raggedtwoe@abdhook}%
+ \@raggedtwoe@raggedrightboxes@opt
+ \@raggedtwoe@footmisctrue
+ \let\@raggedtwoe@document@opt\relax
+ }
+% \end{macrocode}
+% \end{macro}
+% Finally the declaration of the option.
+% \begin{macrocode}
+\DeclareOption{document}{\@raggedtwoe@document@opt}
+% \end{macrocode}
+%
+%
+% ^^A -----------------------------
+%
+% \subsubsection{Other options}
+% ^^A
+% \changes{v2.00}{2003/01/18}{Pass all other options to
+% \package{footmisc} if it's loaded}%
+% All unused options are passed to the \package{footmisc} package if
+% the \option{footnotes} option is selected; otherwise the usual error
+% is raised.
+% \begin{macrocode}
+\DeclareOption*{%
+ \if@raggedtwoe@footmisc
+ \PassOptionsToPackage{\CurrentOption}{footmisc}%
+ \else
+ \OptionNotUsed
+ \fi
+ }
+% \end{macrocode}
+%
+%
+%% ^^A -----------------------------
+%
+% \subsection{Executing options}
+% ^^A
+% The default options are \option{originalcommands} and
+% \option{newparameters}.
+% \begin{macrocode}
+\ExecuteOptions{originalcommands,newparameters}
+\ProcessOptions\relax
+% \end{macrocode}
+%
+%
+% ^^A -----------------------------
+%
+% \subsection{Loading packages}
+% ^^A
+% We need the \package{everysel} package.
+% \changes{v2.00}{2003/01/18}{Load the \package{footmisc} package}%
+% \begin{macrocode}
+\RequirePackage{everysel}
+% \end{macrocode}
+% If the option \option{footnotes} is selected, we load the
+% \package{footmisc} package after we are finished (\package{footmisc}
+% detects our presence by looking for the definition of
+% \cs{RaggedRight}, so we can not load it just now).
+% \changes{v2.1}{2003/10/08}{bugfix: Load \package{footmisc}
+% directly and not via \cs{AtEndOfPackage} (bug found by Axel
+% Sommerfeldt)}
+% \begin{macrocode}
+\if@raggedtwoe@footmisc
+ \RequirePackage{footmisc}[2002/08/28]
+\fi
+% \end{macrocode}
+%
+%
+% ^^A -----------------------------
+%
+% \subsection{Allocations}
+% ^^A
+% \changes{v2.00}{2003/01/25}{Removed \cs{RaggedSpaceskip} and
+% \cs{RaggedXSpaceskip}}%
+% \begin{macro}{\CenteringLeftskip}
+% \begin{macro}{\RaggedLeftLeftskip}
+% \begin{macro}{\RaggedRightLeftskip}
+% \begin{macro}{\CenteringRightskip}
+% \begin{macro}{\RaggedLeftRightskip}
+% \begin{macro}{\RaggedRightRightskip}
+% \begin{macro}{\CenteringParfillskip}
+% \begin{macro}{\RaggedLeftParfillskip}
+% \begin{macro}{\RaggedRightParfillskip}
+% \begin{macro}{\JustifyingParfillskip}
+% \changes{v2.00}{2003/01/18}{New macro}
+% \begin{macro}{\CenteringParindent}
+% \begin{macro}{\RaggedLeftParindent}
+% \begin{macro}{\RaggedRightParindent}
+% \begin{macro}{\JustifyingParindent}
+% \changes{v2.00}{2003/01/18}{New macro}
+% First we allocate the parameters
+% \begin{macrocode}
+\newlength{\CenteringLeftskip}
+\newlength{\RaggedLeftLeftskip}
+\newlength{\RaggedRightLeftskip}
+\newlength{\CenteringRightskip}
+\newlength{\RaggedLeftRightskip}
+\newlength{\RaggedRightRightskip}
+\newlength{\CenteringParfillskip}
+\newlength{\RaggedLeftParfillskip}
+\newlength{\RaggedRightParfillskip}
+\newlength{\JustifyingParfillskip}
+\newlength{\CenteringParindent}
+\newlength{\RaggedLeftParindent}
+\newlength{\RaggedRightParindent}
+\newlength{\JustifyingParindent}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% ^^A -----------------------------
+%
+% \subsection{Initializations}
+% ^^A
+% Depending on \cs{if@raggedtwoe@originalparameters} we initialize the
+% parameters with the values \LaTeX{} uses for its own commands or with
+% our new parameters.
+% \changes{v2.04}{2003/03/02}{Initialize \cs{JustifyingParindent}
+% with \cs{parindent}}
+% \changes{v2.04}{2003/03/02}{Insert missing \textbackslash}
+% \begin{macrocode}
+\if@raggedtwoe@originalparameters
+ \CenteringLeftskip\@flushglue
+ \RaggedLeftLeftskip\@flushglue
+ \RaggedRightLeftskip\z@skip
+ \CenteringRightskip\@flushglue
+ \RaggedLeftRightskip\z@skip
+ \RaggedRightRightskip\@flushglue
+ \CenteringParfillskip\z@skip
+ \RaggedLeftParfillskip\z@skip
+ \RaggedRightParfillskip\@flushglue
+ \CenteringParindent\z@
+ \RaggedLeftParindent\z@
+ \RaggedRightParindent\z@
+\else
+ \CenteringLeftskip\z@\@plus\tw@ em
+ \RaggedLeftLeftskip\z@\@plus\tw@ em
+ \RaggedRightLeftskip\z@skip
+ \CenteringRightskip\z@\@plus\tw@ em
+ \RaggedLeftRightskip\z@skip
+ \RaggedRightRightskip\z@\@plus\tw@ em
+ \CenteringParfillskip\z@skip
+ \RaggedLeftParfillskip\z@skip
+ \RaggedRightParfillskip\@flushglue
+ \CenteringParindent\z@
+ \RaggedLeftParindent\z@
+ \RaggedRightParindent\z@
+\fi
+\JustifyingParfillskip\@flushglue
+\JustifyingParindent\parindent
+% \end{macrocode}
+%
+%
+% ^^A -----------------------------
+%
+% \subsection{Distinguishing between monospaced and proportional fonts}
+% ^^A
+% To set ragged text with proportional fonts \emph{and} monospaced
+% fonts correctly, we must distinguish between these two kinds of
+% fonts \emph{everytime} a font is loaded.
+% Otherwise the settings for e.\,g.\ a proportional fonts would be
+% in effect if you start \cs{RaggedRight} in \cs{rmfamily} and
+% then switch to \cs{ttfamily}.
+%
+% The goal is to have a rigid interword space in all fonts.
+% \TeX's interword space is |\fontdimen2 plus \fontdimen3 minus \fontdimen4|.
+% This can be overwritten by setting \cs{spaceskip} (space between
+% words, if nonzero) and \cs{xspaceskip} (space at the end of
+% sentences, if nonzero).
+%
+% We do the setting with the help of \package{everysel}\,\cite{everysel},
+% which allows us to define code which is (hopefully) executed after
+% every fontchange in a \LaTeX{} document.\footnote{^^A
+% It \emph{is} executed after every \cs{selectfont}, so if you stay
+% within NFSS and don't declare your fonts with commands like
+% \cs{newfont} and then switch to them, it will work.}
+%
+% \begin{macro}{\if@raggedtwoe@spaceskip}
+% \cs{if@raggedtwoe@spaceskip} signals the use of commands defined by
+% \package{ragged2e} to the command inserted into \cs{selectfont}.
+% It is set to true by these commands and restored to false by \TeX{}
+% when the scope of them ends.
+% \begin{macrocode}
+\newif\if@raggedtwoe@spaceskip
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@raggedtwoe@everyselectfont}
+% \cs{@raggedtwoe@everyselectfont} is our code inserted into
+% \cs{selectfont}.
+% \changes{v2.00}{2003/01/26}{Completely redesigned and removed
+% \cs{RaggedSpaceskip} and
+% \cs{RaggedXSpaceskip}}
+% \changes{v2.01}{2003/02/20}{Removed the setting of \cs{xspaceskip}}
+% \begin{macrocode}
+\newcommand{\@raggedtwoe@everyselectfont}{%
+ \if@raggedtwoe@spaceskip
+% \end{macrocode}
+% If no command defined by \package{ragged2e} is in use, we do
+% nothing.
+% But if it is, we look at \cs{fontdimen3} to see if the current
+% font is monospaced or not.
+% \begin{macrocode}
+ \ifdim\fontdimen\thr@@\font=\z@\relax
+% \end{macrocode}
+% If it is, we set \cs{spaceskip} to |0pt| so the interword space
+% will be the one specified by the font designer -- which is rigid
+% anyway for monospaced fonts.
+% \begin{macrocode}
+ \spaceskip\z@
+ \else
+% \end{macrocode}
+% For proportional fonts we make the interword space rigid by setting
+% \cs{spaceskip} to \cs{fontdimen2}.
+% \begin{macrocode}
+ \spaceskip\fontdimen\tw@\font
+ \fi
+% \end{macrocode}
+% We have to reset the interword space if we are not active.
+% \changes{v2.04}{2003/03/16}{Reset \cs{spaceskip} when we are not
+% active}
+% \begin{macrocode}
+ \else
+ \spaceskip\z@
+ \fi
+ }
+\EverySelectfont{\@raggedtwoe@everyselectfont}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% ^^A -----------------------------
+%
+% \subsection{The commands}
+% ^^A
+% \begin{macro}{\@raggedtwoe@savedcr}
+% We save the definition of \cs{\textbackslash} in
+% \cs{@raggedtwoe@savedcr}.
+% \begin{macrocode}
+\let\@raggedtwoe@savedcr\\
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@raggedtwoe@saved@gnewline}
+% \changes{v2.00}{2003/01/04}{New macro}
+% We save the definition of \cs{@gnewline} in
+% \cs{@raggedtwoe@saved@gnewline}.
+% \begin{macrocode}
+\let\@raggedtwoe@saved@gnewline\@gnewline
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@raggedtwoe@gnewline}
+% The following definition of a \cs{@gnewline} used by the ragged
+% commands was suggested by Markus Kohm:
+% \changes{v2.00}{2003/01/04}{New macro}
+% \changes{v2.02}{2003/02/24}{Bugfix: \cs{@nolerr}
+% \ensuremath{\rightarrow} \cs{@nolnerr}}%
+% \changes{v2.1}{2009/05/17}{Bugfix: handle math}
+% \begin{macrocode}
+\newcommand*{\@raggedtwoe@gnewline}[1]{%
+ \ifvmode
+ \@nolnerr
+ \else
+ \unskip
+ \ifmmode
+% \end{macrocode}
+% In formulas we use the original code of \cs{@gnewline}.
+% \begin{macrocode}
+ \reserved@e {\reserved@f #1}\nobreak \hfil \break
+ \else
+ \reserved@e {\reserved@f #1}{\parskip\z@\par}%
+ \fi
+ \fi
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Centering}
+% \cs{Centering} first lets \cs{\textbackslash} = \cs{@centercr},
+% but only if |\\| has its original meaning, otherwise \cs{Center}
+% would not work inside environments like \env{tabular} etc., in
+% which \cs{\textbackslash} has a different meaning.
+% It also sets \cs{@gnewline} to \cs{@raggedtwoe@gnewline}.
+% Then, the \LaTeX{} and \TeX-parameters are set.\newline
+% \cs{@rightskip} is \LaTeX's version of \cs{rightskip}.
+% \begin{Quote}
+% ``Every environment, like the list environments, that set
+% \cs{rightskip} to its 'normal' value set it to \cs{@rightskip}''
+% \cite{ltmiscen}
+% \end{Quote}
+% Finally we signal the code inserted into \cs{selectfont} that
+% we are active and call that code directly.
+% \changes{v2.00}{2003/01/04}{Call \cs{@raggedtwoe@everyselectfont}
+% and switch \cs{@gnewline}}
+% \begin{macrocode}
+\newcommand{\Centering}{%
+ \ifx\\\@raggedtwoe@savedcr
+ \let\\\@centercr
+ \fi
+ \let\@gnewline\@raggedtwoe@gnewline
+ \leftskip\CenteringLeftskip
+ \@rightskip\CenteringRightskip
+ \rightskip\@rightskip
+ \parfillskip\CenteringParfillskip
+ \parindent\CenteringParindent
+ \@raggedtwoe@spaceskiptrue
+ \@raggedtwoe@everyselectfont
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RaggedLeft}
+% \cs{RaggedLeft} is like \cs{Centering}; it only uses other
+% parameters.
+% \changes{v2.00}{2003/01/04}{Call \cs{@raggedtwoe@everyselectfont}
+% and switch \cs{@gnewline}}
+% \begin{macrocode}
+\newcommand{\RaggedLeft}{%
+ \ifx\\\@raggedtwoe@savedcr
+ \let\\\@centercr
+ \fi
+ \let\@gnewline\@raggedtwoe@gnewline
+ \leftskip\RaggedLeftLeftskip
+ \@rightskip\RaggedLeftRightskip
+ \rightskip\@rightskip
+ \parfillskip\RaggedLeftParfillskip
+ \parindent\RaggedLeftParindent
+ \@raggedtwoe@spaceskiptrue
+ \@raggedtwoe@everyselectfont
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\RaggedRight}
+% \cs{RaggedRight} is like \cs{Centering}; it only uses other
+% parameters.
+% \changes{v2.00}{2003/01/04}{Call \cs{@raggedtwoe@everyselectfont}
+% and switch \cs{@gnewline}}
+% \begin{macrocode}
+\newcommand{\RaggedRight}{%
+ \ifx\\\@raggedtwoe@savedcr
+ \let\\\@centercr
+ \fi
+ \let\@gnewline\@raggedtwoe@gnewline
+ \leftskip\RaggedRightLeftskip
+ \@rightskip\RaggedRightRightskip
+ \rightskip\@rightskip
+ \parfillskip\RaggedRightParfillskip
+ \parindent\RaggedRightParindent
+ \@raggedtwoe@spaceskiptrue
+ \@raggedtwoe@everyselectfont
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\justifying}
+% \cs{justifying} switches back to the defaults used by \LaTeX{} for
+% typesetting justyfied text.
+% \changes{v2.00}{2003/01/04}{New macro}
+% \begin{macrocode}
+\newcommand{\justifying}{%
+ \let\\\@raggedtwoe@savedcr
+ \let\@gnewline\@raggedtwoe@saved@gnewline
+ \leftskip\z@
+ \@rightskip\z@
+ \rightskip\@rightskip
+ \parfillskip\JustifyingParfillskip
+ \parindent\JustifyingParindent
+ \@raggedtwoe@spaceskipfalse
+ \@raggedtwoe@everyselectfont
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% ^^A -----------------------------
+%
+% \subsection{The environments}
+% ^^A
+% \begin{environment}{Center}
+% \begin{environment}{FlushLeft}
+% \begin{environment}{FlushRight}
+% The environments \env{Center}, \env{FlushLeft}, and \cs{FlushRight}
+% are implemented like their counterparts in \LaTeX: Start a
+% \env{trivlist} and switch on the right command.
+% \changes{v2.02}{2003/02/24}{Use \cs{trivlist} \ldots{}
+% \cs{endtrivlist} instead of
+% \cs{begin\{trivlist\}} \ldots{}
+% \cs{end\{trivlist\}}}
+% \begin{macrocode}
+\newenvironment{Center}{%
+ \trivlist
+ \Centering\item\relax
+ }{%
+ \endtrivlist
+ }
+\newenvironment{FlushLeft}{%
+ \trivlist
+ \RaggedRight\item\relax
+ }{%
+ \endtrivlist
+ }
+\newenvironment{FlushRight}{%
+ \trivlist
+ \RaggedLeft\item\relax
+ }{%
+ \endtrivlist
+ }
+% \end{macrocode}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \begin{environment}{justify}
+% \env{justify} is similar to the other environments: Start a
+% \env{trivlist} and use \cs{justifying}.
+% \changes{v2.00}{2003/01/04}{New environment}
+% \changes{v2.02}{2003/02/24}{Use \cs{trivlist} \ldots{}
+% \cs{endtrivlist} instead of
+% \cs{begin\{trivlist\}} \ldots{}
+% \cs{end\{trivlist\}}}
+% \begin{macrocode}
+\newenvironment{justify}{%
+ \trivlist
+ \justifying\item\relax
+ }{%
+ \endtrivlist
+ }
+% \end{macrocode}
+% \end{environment}
+%
+%
+% ^^A -----------------------------
+%
+% \subsection{Overloading the \LaTeX-commands}
+% ^^A
+% If the option \option{newcommands} is used, we save the original
+% \LaTeX-commands and environments for ragged text and overload them.
+% \changes{v2.04}{2003/03/02}{Save more commands}
+% \changes{v2.1}{2003/10/08}{bugfix: \cs{Flushleft} instead of
+% \cs{FlushLeft} (found by Berend Hasselman)}
+% \begin{macrocode}
+\if@raggedtwoe@originalcommands
+\else
+ \let\LaTeXcentering\centering
+ \let\LaTeXraggedleft\raggedleft
+ \let\LaTeXraggedright\raggedright
+ \let\centering\Centering
+ \let\raggedleft\RaggedLeft
+ \let\raggedright\RaggedRight
+ \let\LaTeXcenter\center
+ \let\endLaTeXcenter\endcenter
+ \let\LaTeXflushleft\flushleft
+ \let\endLaTeXflushleft\endflushleft
+ \let\LaTeXflushright\flushright
+ \let\endLaTeXflushright\endflushright
+ \let\center\Center
+ \let\endcenter\endCenter
+ \let\flushleft\FlushLeft
+ \let\endflushleft\endFlushLeft
+ \let\flushright\FlushRight
+ \let\endflushright\endFlushRight
+\fi
+% \end{macrocode}
+%
+% ^^A -----------------------------
+%
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+% \Finale
+% ^^A vim:tw=70:ts=2