%% \iffalse meta-comment %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Copyright (C) Martin Schröder, 1996–2019 % Marei Peischl (peiTeX) , 2021–2023 % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3c % 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.3c or later is part of all distributions of LaTeX % version 2005/12/01 or later. % % This work has the LPPL maintenance status `maintained'. % % The Current Maintainer of this work is % Marei Peischl . % % % This work consists of the files % README.md % ragged2e.dtx % ragged2e.ins % and the derived file % ragged2e.sty. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \fi % \iffalse \NeedsTeXFormat{LaTeX2e}[2021/06/01] %\ProvidesPackage{ragged2e} % [2023/06/22 v3.6 ragged2e Package] % %<*driver> \documentclass[a4paper]{ltxdoc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{microtype} \usepackage{url} \usepackage{array} \usepackage{tabularx} \makeatletter \IfFileExists{gitHeadInfo.gin}{ \newcommand*{\GI@githeadinfo@file}{gitHeadInfo.gin} }{} \makeatother \usepackage{gitinfo2} \usepackage{geometry} \usepackage{booktabs} \usepackage[document]{ragged2e} \usepackage{hyperref} \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} % % \fi % \CheckSum{532} % %% \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 \~} %% % \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öder\\\url{https://gitlab.com/TeXhackse/ragged2e}\thanks{maintained by Marei Peischl}} % \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} % % \changes{v2.2}{2019/07/28}{Change maintenance status of package} % \changes{v3.0}{2021/02/05}{Change maintenance status} % \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: % \changes{v3.1}{2021/12/15}{Use the updated definition of \cs{raggedright}} % \begin{macrocode} %<*latex> \DeclareRobustCommand \raggedright{% \let\\\@centercr \@rightskip\@flushglue \rightskip\@rightskip \finalhyphendemerits=\z@ \leftskip\z@skip \parindent\z@} % \end{macrocode} % Initially, \cs{@flushglue} is defined as % \begin{macrocode} \@flushglue = 0pt plus 1fil % % \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} % % \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}} % \changes{v3.0}{2021/02/05}{document everysel is obsolete} % This package requires the following packages: % \begin{description} % \item[\normalfont\package{everysel}\,\cite{everysel}](only if format older than 2021/01/05) % It has been used to distinguish between monospaced and proportional % fonts as long as the LaTeX kernel did not provide the functionality with lthooks \cite{lthooks-doc}. % Formats newer than 2021/01/05 do no longer depend on everysel. % \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äß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. % Maurice Hansen reported and helped testing the fix for the bug adding % an additional parskip fixed in version 3.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ö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{https://mirror.ctan.org/macros/latex/contrib/footmisc/}. % % \bibitem{raggedr} % James Kilfiger. % \newblock \url{https://ctan.org/tex-archive/obsolete/macros/latex/contrib/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{lthooks-doc} % Frank Mittelbach. % \newblock The \package{lthooks} package. % \newblock \url{http://mirrors.ctan.org/macros/latex/base/lthooks-doc.pdf} % % \bibitem{cmfonts} % Frank Mittelbach and Rainer Schöpf. % \newblock The file {\texttt{cmfonts.fdd}} for use with {\LaTeXe}. % \newblock Part of the {\LaTeX}-distribution. % % \bibitem{everysel} % Martin Schröder. % \newblock The obsolete \package{everysel}-package. % \newblock \url{http://mirrors.ctan.org/macros/latex/contrib/everysel/everysel.pdf}. % \newblock \LaTeXe{} package. % % \bibitem{raggedri} % Martin Schröder. % \newblock The \package{raggedri} document option. % \newblock Was in \url{http://mirrors.ctan.org/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 % \changes{v3.00}{2021/02/05}{Remove the \package{everysel} package if kernel hooks are available} % We need the \package{everysel} package for older kernels. % \changes{v2.00}{2003/01/18}{Load the \package{footmisc} package}% % \begin{macrocode} \providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} \IfFormatAtLeastTF{2021/01/05}{}{\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}} % \changes{v3.5}{2023/04/04}{Add mechanism to deactivate \cs{\@raggedtwoe@everyselectfont}} % \begin{macrocode} \newcommand{\@raggedtwoe@everyselectfont@active}{% \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 } % \end{macrocode} % If our kernel is new enough we use the kernel hook directly instead of the everysel macro. % \changes{v3.00}{2021/02/05}{Use kernel hook if available} % \changes{v3.3}{2023/02/22}{Apply hook only when a ragged2e command is active.} % \begin{macrocode} \newif\if@raggedtwoe@localhook \IfFormatAtLeastTF{2021/01/05} {\@raggedtwoe@localhooktrue} {\EverySelectfont{\@raggedtwoe@everyselectfont}} % \end{macrocode} % The hook is added globally but will be inactive when none of the ragged2e comands is used. % \changes{v3.5}{2023/04/04}{Globally add inactive hook} % \begin{macrocode} \let\@raggedtwoe@everyselectfont\relax \if@raggedtwoe@localhook \AddToHook{selectfont}[ragged2e]{\@raggedtwoe@everyselectfont}% \fi % \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@centercrNoindent} % \changes{v3.2}{2022/11/13}{New macro} % With the bugfix in version 3.2 we also take care of the indent which % might be set when ragged2e's newline definition or \cs{@centercr} are % triggered. This can be easily archieved using the ltpara hooks. % This is not a final solution for this because on the long run one % has to replace the paragraph break within \cs{@centercr} to match % the content structure for tagging. % \begin{macrocode} \def\@raggedtwoe@centercrNoindent{% \AddToHookNext{para/begin}{% \ifx\@raggedtwoe@everyselectfont\relax\else \OmitIndent \fi }% \@centercr% } % \end{macrocode} % \changes{v3.6}{2023/06/00}{Only omit indent if inside a group where a ragged2e command is active} % \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 adjusted the original code of \cs{g@newline} to a negative fill to match the alignment of text. % Outside those we use \cs{@centercr} to remove the added parskip. % \changes{v3.2}{2022/11/13}{Fix bug adding parskip with newline} % \begin{macrocode} \reserved@e {\reserved@f #1}\nobreak \hskip\z@ \break \else \reserved@e {\reserved@f #1}% \@raggedtwoe@centercrNoindent \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{v3.5}{2023/04/04}{Bugfix: Only activate the global hook} % \changes{v3.4}{2023/02/25}{Bugfix: remove spurious space} % \changes{v3.3}{2023/02/22}{Apply hook only when a ragged2e command is active} % \changes{v3.1}{2021/12/15}{Robustify the user macros (Thanks to Markus Kohm for the hint)} % \changes{v2.00}{2003/01/04}{Call \cs{@raggedtwoe@everyselectfont} % and switch \cs{@gnewline}} % \begin{macrocode} \DeclareRobustCommand{\Centering}{% \if@raggedtwoe@localhook \let\@raggedtwoe@everyselectfont\@raggedtwoe@everyselectfont@active% \fi \ifx\\\@raggedtwoe@savedcr \let\\\@raggedtwoe@centercrNoindent \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{v3.5}{2023/04/04}{Bugfix: Only activate the global hook} % \changes{v3.4}{2023/02/25}{Bugfix: remove spurious space} % \changes{v3.3}{2023/02/22}{Apply hook only when a ragged2e command is active} % \changes{v3.1}{2021/12/15}{Robustify the user macros (Thanks to Markus Kohm for the hint)} % \changes{v2.00}{2003/01/04}{Call \cs{@raggedtwoe@everyselectfont} % and switch \cs{@gnewline}} % \begin{macrocode} \DeclareRobustCommand{\RaggedLeft}{% \if@raggedtwoe@localhook \let\@raggedtwoe@everyselectfont\@raggedtwoe@everyselectfont@active% \fi \ifx\\\@raggedtwoe@savedcr \let\\\@raggedtwoe@centercrNoindent \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{v3.5}{2023/04/04}{Bugfix: Only activate the global hook} % \changes{v3.4}{2023/02/25}{Bugfix: remove spurious space} % \changes{v3.3}{2023/02/22}{Apply hook only when a ragged2e command is active} % \changes{v3.1}{2021/12/15}{Robustify the user macros (Thanks to Markus Kohm for the hint)} % \changes{v2.00}{2003/01/04}{Call \cs{@raggedtwoe@everyselectfont} % and switch \cs{@gnewline}} % \begin{macrocode} \DeclareRobustCommand{\RaggedRight}{% \if@raggedtwoe@localhook \let\@raggedtwoe@everyselectfont\@raggedtwoe@everyselectfont@active% \fi \ifx\\\@raggedtwoe@savedcr \let\\\@raggedtwoe@centercrNoindent \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{v3.5}{2023/04/04}{Bugfix: Only activate the global hook} % \changes{v3.4}{2023/02/25}{Bugfix: remove spurious space} % \changes{v3.3}{2023/02/22}{Apply hook only when a ragged2e command is active} % \changes{v3.1}{2021/12/15}{Robustify the user macros (Thanks to Markus Kohm for the hint)} % \changes{v2.00}{2003/01/04}{New macro} % \begin{macrocode} \DeclareRobustCommand{\justifying}{% \if@raggedtwoe@localhook \let\@raggedtwoe@everyselectfont\@raggedtwoe@everyselectfont@active% \fi \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} % % \end{macrocode} % \Finale % ^^A