From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Mon, 2 Sep 2019 13:46:59 +0900
Subject: Initial commit

---
 macros/latex/contrib/frankenstein/lips.sty | 555 +++++++++++++++++++++++++++++
 1 file changed, 555 insertions(+)
 create mode 100644 macros/latex/contrib/frankenstein/lips.sty

(limited to 'macros/latex/contrib/frankenstein/lips.sty')

diff --git a/macros/latex/contrib/frankenstein/lips.sty b/macros/latex/contrib/frankenstein/lips.sty
new file mode 100644
index 0000000000..35b60029ef
--- /dev/null
+++ b/macros/latex/contrib/frankenstein/lips.sty
@@ -0,0 +1,555 @@
+%^^A* legal notices
+% \iffalse
+%
+%   This program is part of the Frankenstein bundle for LaTeX.  
+%
+%   Copyright 1995-2001 Matt Swift <swift@alum.mit.edu>.
+%
+%   This file contains both the code and documentation for the
+%   lips LaTeX package.  It will work ONLY if it is placed in a
+%   proper directory.  Files called README, INSTALL, lips.tex
+%   and lips.ins should have also been distributed to you
+%   with this file.  See them for more information on how to typeset
+%   the documentation with LaTeX and how to generate a version of this
+%   file that will work faster than this one.
+%
+%   This program is free software; you may redistribute it and/or
+%   modify it under the conditions of the LaTeX Project Public
+%   License, either version 1.2 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.2 or later is
+%   part of all distributions of LaTeX version 1999/12/01 or later.
+%
+%   This program is distributed in the hope that it will be useful,
+%   but without any warranty; without even the implied warranty of
+%   merchantability or fitness for a particular purpose.  See the
+%   LaTeX Project Public License for more details.
+%
+% \fi  
+%
+%^^A* checks
+%
+%^^A NOTE:  The character table, with two %'s, will get written to all files.
+%% \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         \~}
+%
+% \CheckSum{207}
+%
+% \begin{abstract}
+%   The \cs\lips command generates text ellipses that are closer to what
+%   \manual suggests than what \cs\dots produces.  It does the right thing in
+%   most circumstances, and so is easy to use.
+% \end{abstract}
+% \tableofcontents
+%
+% \part{Discussion}
+%
+% \section{Text Ellipses}
+%
+% \DescribeMacro{\lips}
+% The macro \cs\lips should be used for all text ellipses, that is, ellipses
+% not part of a mathematical expression.
+%
+% \manual does not acknowledge different spacings after different marks of
+% punctuation, distinguish interword from intersentence space, or give rules
+% about where to break a line near an ellipsis.  Given a context where such
+% spaces do vary and rules for linebreaks can be given, I arrived at the
+% following rules for handling them around ellipses.
+% \begin{enumerate}
+% \item Pre-, post-, and intra-ellipsis space is normal intra-word space, which
+%       should be 3-to-em.  In \LaTeX{} there is also some glue (it's a 
+%       ``rubber space'').
+% \item When non-period punctuation $p$ follows \cs\lips, $p$ is followed by
+%       the space that normally follows $p$.
+% \item A period following \cs\lips is treated as if the period preceded
+%       \cs\lips.  Conceptually, an ellipsis never precedes a period, so
+%       conceptually there is only one case; but it is convenient to be able to
+%       type either \code{\lips.} or \code{.\lips}.
+% \item Lines are a tiny bit breakable before ellipses and a tiny bit
+%       breakable after ellipses that are not followed by punctuation.
+% \end{enumerate}
+%
+% In figure~\ref{fig:usage} are examples of correct usage and in
+% figure~\ref{fig:comp} is a comparison of \cs\lips to \cs\dots.  You can
+% substitute any of the characters \code$!"()*+,-/:;=?@[]'`|<>~{}$ for the
+% exclamation point in the examples.  There can be additional contiguous spaces
+% after \cs\lips, just like after any command name.  There can also be
+% contiguous spaces before \cs\lips.
+%
+% \begin{figure}
+% \DeleteShortVerb{\|}
+% \begin{center}
+% \begin{tabular}{lc}
+% \bfseries source & \bfseries \hspace*{4em} result
+% \end{tabular}\par\nobreak
+% \par\nobreak
+% \begin{tabular}{|lp{1in}|}
+% \hline
+% \verb*|Hello\lips. And|   & Hello\lips. And   \\\hline
+% \verb*|Hello \lips. And|  & Hello \lips. And   \\\hline
+% \verb*|Hello.\lips And|   & Hello.\lips And   \\\hline
+% \verb*|Hello. \lips And|  & Hello. \lips And   \\\hline
+% \verb*|one,\lips, three|  & one,\lips, three \\\hline
+% \verb*|one, \lips, three| & one, \lips, three \\\hline
+% \verb*|Hello\lips and|    & Hello\lips and    \\\hline
+% \verb*|Hello \lips and|   & Hello \lips and    \\\hline
+% \verb*|Hello!\lips And|   & Hello!\lips And   \\\hline
+% \verb*|Hello! \lips And|  & Hello! \lips And   \\\hline
+% \end{tabular}
+% \end{center}
+% \caption{\label{fig:usage}Examples of correct usage of \cs\lips.}
+% \MakeShortVerb{\|}
+% \end{figure}
+%
+% \begin{figure}
+% \begin{center}
+% \begin{tabular}{lc}
+% \bfseries source & \bfseries \hspace*{4em} result
+% \end{tabular}\par
+% \par
+% \DeleteShortVerb{\|}
+% \begin{tabular}{|lp{1in}|}
+% \hline
+% \verb*|Hello\dots. And|   & Hello\dots. And   \\
+% \verb*|Hello\lips. And|   & Hello\lips. And   \\\hline
+% \verb*|Hello \dots. And|  & Hello \dots. And   \\
+% \verb*|Hello \lips. And|  & Hello \lips. And   \\\hline
+% \verb*|Hello.\dots And|   & Hello.\dots And   \\
+% \verb*|Hello.\lips And|   & Hello.\lips And   \\\hline
+% \verb*|Hello. \dots And|  & Hello. \dots And   \\
+% \verb*|Hello. \lips And|  & Hello. \lips And   \\\hline
+% \verb*|one,\dots, three|  & one,\dots, three  \\
+% \verb*|one,\lips, three|  & one,\lips, three \\\hline
+% \verb*|one, \dots, three| & one, \dots, three \\
+% \verb*|one, \lips, three| & one, \lips, three \\\hline
+% \verb*|Hello\dots and|    & Hello\dots and    \\
+% \verb*|Hello\lips and|    & Hello\lips and    \\\hline
+% \verb*|Hello \dots and|   & Hello \dots and    \\
+% \verb*|Hello \lips and|   & Hello \lips and    \\\hline
+% \verb*|Hello!\dots And|   & Hello!\dots And   \\
+% \verb*|Hello!\lips And|   & Hello!\lips And   \\\hline
+% \verb*|Hello! \dots And|  & Hello! \dots And   \\
+% \verb*|Hello! \lips And|  & Hello! \lips And   \\\hline
+% \end{tabular}
+% \end{center}
+% \caption{\label{fig:comp}Comparison of \cs\lips with \cs\dots.}
+% \MakeShortVerb{\|}
+% \end{figure}
+% 
+% \section{Line breaking considerations}
+%
+% \DescribeMacro\LPNobreakList
+%   When \cs\lips is followed by certain punctuation (\code|,:;?!)']}/| by
+%   default), we never want to break a line after the ellipsis and before that
+%   punctuation.  For the other punctuation, such as open parenthesis and open
+%   quote, we want normally breakable space following the ellipsis.
+%   \cs\LPNobreakList is a list of those characters before which \cs\lips
+%   should \emph{never} break a line.  To force unbreakable space following
+%   \cs\lips, follow \cs\lips with a tie (|~|).
+%
+% \section{Limitations}
+%
+% \cs\lips does the right thing after \cname{par}, but after \cs\indent or
+% \cs\noindent there is an extra preceding space (see the final section on
+% testing for an example).  Suggestions on how to handle this problem are
+% welcome.
+%
+% \StopEventually{}
+%
+% \part{Implementation}
+%
+% \section{Version control}
+%
+%  \begin{macro}{\fileinfo}
+%  \begin{macro}{\DoXUsepackagE}
+%  \begin{macro}{\HaveECitationS}
+%  \begin{macro}{\fileversion}
+%  \begin{macro}{\filedate}
+%  \begin{macro}{\docdate}
+%  \begin{macro}{\PPOptArg}
+% These definitions must be the first ones in the file.
+%    \begin{macrocode}
+\def\fileinfo{Chicago Manual text ellipses (Frankenstein's lips)}
+\def\DoXPackageS {}
+\def\initelyHavECitationS {}
+\def\fileversion{v2.1}
+\def\filedate{2001/08/31}
+\def\docdate{2001/08/31}
+\edef\PPOptArg {%
+  \filedate\space \fileversion\space \fileinfo
+}
+%    \end{macrocode}
+%  \end{macro}
+%  \end{macro}
+%  \end{macro}
+%  \end{macro}
+%  \end{macro}
+%  \end{macro}
+%  \end{macro}
+%
+% If we're loading this file from a \cs\ProcessDTXFile command (see the
+% \package{compsci} package), then \cs\JusTLoaDInformatioN will be defined;
+% othewise we assume it is not (that's why the FunkY NamE).
+% 
+% If we're loading from \cs\ProcessDTXFile, we want to load the packages listed
+% in \cs\DoXPackageS (needed to typeset the documentation for this file) and
+% then bail out.  Otherwise, we're using this file in a normal way as a
+% package, so do nothing.  \cs\DoXPackageS, if there are any, are declared in
+% the \ext{dtx} file, and, if you're reading the typeset documentation of this
+% package, would appear just above.  (It's OK to call \cs\usepackage with an
+% empty argument or \cs\relax, by the way.)
+%    \begin{macrocode}
+\makeatletter% A special comment to help create bst files.  Don't change!
+\@ifundefined{JusTLoaDInformatioN} {%
+  }{% ELSE (we know the compsci package is already loaded, too)
+  \UndefineCS\JusTLoaDInformatioN
+  \SaveDoXVarS
+  \eExpand\csname DoXPackageS\endcsname\In {%use \csname in case it's undefined
+    \usepackage{#1}%
+  }%
+  \RestoreDoXVarS
+  \makeatother
+  \endinput
+}% A special comment to help create bst files.  Don't change!
+%    \end{macrocode}
+%
+% Now we check for \LaTeX2e and declare the LaTeX package.
+%    \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{lips}[\PPOptArg]
+%    \end{macrocode}^^A special comment to help create bst files.  Don't change!
+%
+% ^^A NOTE: We have to compensate for the above backslashes, which are not
+% ^^A       actually in the .dtx file the author works on, by adding to the
+% ^^A       CheckSum.
+%%
+% \AddToCheckSum{17}^^A `dtx-update-checksum' automatically handles this.
+% \AddToCheckSum{7}^^A The half a macrocode env. at the top is missed, however...
+% \AddToCheckSum{10}^^A ... and so are the 5 \defs from the .dtx file 
+%                   ^^A     that precede it.
+% \IfCitations {%
+%   \AddToCheckSum{2}^^A When \initelyHavECitationS is defined in
+% }                  ^^A the .dtx file, we need 2 more in the CheckSum.
+%
+%
+% \section{The macro}
+%
+% \begin{macro}{\Lips}
+% \begin{macro}{\BracketedLips}
+% \begin{macro}{\lips}
+% \begin{macro}{\olips}
+%   If we're in math mode, raise an error.  If we're in vertical mode, leave it
+%   and do an ellipsis not breakable at the end.  If we're in horizontal mode,
+%   call \cname{lp@lips@hmode}.
+%
+%   Normally I would use \cs\NewRobustCommand, but this seems not enough reason
+%   to require the \package{moredefs} package.  We reserve the name \cs\lips by
+%   hand.  In the future, this package may require \package{moredefs}.
+%    \begin{macrocode}
+\newcommand*\Lips {}
+\let\Lips\relax
+\DeclareRobustCommand\Lips {%
+  \ifmmode
+    \def\sc@t@a {%
+      \PackageError{lips}
+        {Don't use \protect\lips \space in math mode; use \protect\dots.}\@ehc
+    }%
+  \else
+    \ifvmode
+      \def\sc@t@a {%
+        \leavevmode
+        .\nobreak\ .\nobreak\ .\nobreak\ %
+      }%
+    \else
+      \let\sc@t@a\lp@lips@hmode
+    \fi
+  \fi
+  \sc@t@a
+}
+\newcommand*\BracketedLips {}
+\let\BracketedLips\relax
+\DeclareRobustCommand\BracketedLips {%
+  \ifmmode
+    \def\sc@t@a {%
+      \PackageError{lips}
+        {Don't use \protect\lips \space in math mode; use \protect\dots.}\@ehc
+    }%
+  \else
+    \ifvmode
+      \def\sc@t@a {%
+        \leavevmode
+        [.\nobreak\ .\nobreak\ .]\nobreak\ %
+      }%
+    \else
+      \let\sc@t@a\lp@blips@hmode
+    \fi
+  \fi
+  \sc@t@a
+}
+%    \end{macrocode}
+% \todo{need the relax to avoid mistaking as optarg in some
+% contexts?}  In MLA style, that is, with the \option{mla} option, \cs\lips
+% gives you brackets, meaning you To get no brackets, use \cs\olips for
+% ``original lips,'' that is, ellipses in the original document.  \todo{Better
+% dox here.  Are options case sensitive?  If so, make MLA=mla.}
+%    \begin{macrocode}
+\newlet\lips\Lips
+\newlet\olips\lips
+\DeclareOption{mla} {%
+  \let\lips\BracketedLips
+}
+\ProcessOptions
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@lips@hmode}
+% \begin{macro}{\lp@blips@hmode}
+% \begin{macro}{\GobbleIgnoreSpaces}
+%   The horizontal mode case.  Then we remove the last skip on the horizontal
+%   list.  If the next character is a period, we want to act as if the period
+%   preceded \cs\lips, so we plonk down a period, a minimally-breakable space,
+%   then an ellipsis ending with normally-breakable space.  This keeps the
+%   ellipsis on the same line as the sentence it follows if at all possible,
+%   but allows it to spill onto the next line if there's no other way to avoid
+%   an overfull line.  Then we want to gobble up the period that's about to
+%   come, and ignore any spaces after it, since we've already inserted proper
+%   space.
+%
+%   If the next character is not a period, we output a minimally-breakable
+%   space and an ellipsis.  To decide whether to follow it with unbreakable or
+%   normally-breakable space, we need to know more about the next character
+%   than just that it is not a period, so we \cs\let it to scratch |a| and call
+%   \cname{lp@lips@check@punct}.
+%
+% \todo{document different logic with bracketed lips; how the heck to handle
+% greater inter-sentence space?}
+%    \begin{macrocode}
+\newcommand\lp@lips@hmode {%
+  \unskip
+  \@ifnextchar . {%
+      .\penalty9999\ .\nobreak\ .\nobreak\ .\ %
+      \GobbleIgnoreSpaces
+    }{% ELSE
+    \penalty9999\ .\nobreak\ .\nobreak\ .%
+    \futurelet\sc@t@a\lp@lips@check@punct
+  }%
+}
+% hmm, have to keep the check for period i guess because i don't want it in
+% nobreaklist?  because the break/nobreak is different?  because it's more efficient?
+\newcommand\lp@blips@hmode {%
+  \unskip
+  \@ifnextchar . {%
+      \penalty9999\ [.\nobreak\ .\nobreak\ .]%
+    }{% ELSE
+    \penalty9999\ [.\nobreak\ .\nobreak\ .]%
+    \futurelet\sc@t@a\lp@lips@check@punct
+  }%
+}
+\newcommand\GobbleIgnoreSpaces [1] {%
+  \ignorespaces
+}
+%    \end{macrocode}
+%  \end{macro}
+%  \end{macro}
+%  \end{macro}
+%
+% \begin{macro}{\LPNobreakList}
+% \begin{macro}{\lp@<punctuation>}
+%   We'd like to use \code{\ifcat.\sc@t@a} for this, but that won't work when
+%   we get a command sequence in scratch |a|.  Bummer.
+%   Do I really need to define all this punctuation now?  It protects against
+%   something becoming an active char or otherwise changing catcodes after the
+%   \package{lips} package is loaded.
+%    \begin{macrocode}
+\newcommand*\lp@bang {}
+\newcommand*\lp@rparen {}
+\newcommand*\lp@comma {}
+\newcommand*\lp@slash {}
+\newcommand*\lp@colon {}
+\newcommand*\lp@semic {}
+\newcommand*\lp@q {}
+\newcommand*\lp@rbrack {}
+\newcommand*\lp@rquote {}
+\newcommand*\lp@tilde {}
+
+\let\lp@bang=!
+\let\lp@rparen=)
+\let\lp@comma=,
+\let\lp@slash=/
+\let\lp@colon=:
+\let\lp@semic=;
+\let\lp@q=?
+\let\lp@rbrack=]
+\let\lp@rquote='
+\let\lp@tilde=~
+
+% \egroup
+
+%    \end{macrocode}
+% I'm making an attempt to put these in order of expected frequency.  A
+% doublequote could be at the beginning or end of a quotation, so half the time
+% you'll have to correct by adding |{}|, so let's leave it out
+% so there's one less to check.
+%    \begin{macrocode}
+\newcommand \LPNobreakList {%
+  \lp@comma \lp@colon  \lp@semic
+  \lp@q \lp@bang 
+  \lp@rparen \lp@rquote \lp@rbrack \egroup
+  \lp@slash
+}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@lips@check@punct}
+%   Add nonbreakable space if scratch |a| is in \cs\LPNobreakList; add
+%   normally-breakable space otherwise.  Add no space at all if scratch |a| is
+%   a tie---the tie will add nonbreakable space. We use just the guts of
+%   \cname{@tfor} for efficiency.
+%    \begin{macrocode}
+\newcommand\lp@lips@check@punct {%
+  \ifx\sc@t@a\lp@tilde
+  \else
+    \@tempswatrue
+    \let\@fortmp\PunctList
+    \expandafter\@tforloop\LPNobreakList\@nil\@nil\@@\reserved@a {%
+      \ifx\sc@t@a\reserved@a
+	\@tempswafalse
+	\@break@tfor
+      \fi
+     }%
+    \if@tempswa
+      \ %
+    \else
+      \nobreak\ %
+    \fi
+  \fi
+}
+%    \end{macrocode}
+% \end{macro}
+%
+% You might want to compare the \LaTeX{} version (as of 95/12/01).
+% \cname{fontdimen3} is the interword stretchability, not interword space.
+% \begin{codeexample}
+% \DeclareTextCommandDefault{\textellipsis}{%
+%   .\kern\fontdimen3\font
+%   .\kern\fontdimen3\font
+%   .\kern\fontdimen3\font
+% }
+% \def\mathellipsis{\mathinner{\ldotp\ldotp\ldotp}}
+% \DeclareRobustCommand{\dots}{%
+%   \ifmmode\mathellipsis\else\textellipsis\fi
+% }
+% \let\ldots\dots
+% \end{codeexample}
+%
+% \part{Testing}
+%
+% \section{Ante-\cs\lips}
+%
+% This is some testing.  We need some text here as the first paragraph after
+% the \cs\section.
+%
+% : \lips.
+%
+% : \lips text.
+%
+% : \lips)
+%
+% ; \lips.
+%
+% ; \lips text.
+%
+% ; \lips)
+%
+% ! \lips.
+%
+% ! \lips text.
+%
+% ! \lips)
+%
+% t \lips.
+%
+% t \lips text.
+%
+% t \lips)
+%
+% T \lips.
+%
+% T \lips text.
+%
+% T \lips)
+%
+% , \lips.
+%
+% , \lips text.
+%
+% , \lips)
+%
+%  \par \lips and (|\par \lips and|)
+%  \par and (|\par and|)
+%
+%  \par\indent \lips (|\par\indent \lips and|)
+%  \par\indent and (|\par\indent and|)
+%
+%  \par\noindent \lips and (|\par\noindent \lips and|)
+%  \par\noindent and (|\par\noindent and|)
+%
+%  \par And.\lips \par (|And.\lips \par|)
+%  \par And. \par (|And. \par|)
+%
+% \section{Post-\cs\lips}
+%
+%  \cs\lips before a tie: One two three.\lips~tiedtolips (I doubt you'd want to
+%  do this.)
+%
+%  \cs\lips before ), e.g., punctuation transparent to spacefactors:
+%
+%  (One two three.\lips)\ This follows the ) with interword space, to compare.
+%
+%  (One two three.\lips) This should follow the ) with intersentence space.
+%
+%  (One two three.\lips\@) This should follow the ) with intersentence space.
+%
+% \cs\lips before shortverb: \lips |shortverb verbatim stuff|
+%
+% \cs\lips before \cs\textsf: \lips \textsf{sansserif}
+%
+% \begin{center}
+% \cs\lips before |\\|: \lips \\
+% second line of a \env{center} environment
+% \end{center}
+%
+% \cs\lips before \cs\#: \lips \#
+%
+% \cs\lips before |<|: \lips <
+%
+% \cs\lips before an abbrev: \lips \Frankenstein
+%
+% \cs\lips before \cs\cite: \lips \cite{chicago:14}
+%
+% \cs\lips before |$|: \lips $f=ma$            ^^A$
+%
+%^^A \cs\lips in math mode (error!): $\lips^2$
+%
+% \begin{tabular}{ll}
+% \cs\lips before |&|: \lips & second column of a \env{tabular}
+% \end{tabular}
+%
+% \Finale
-- 
cgit v1.2.3

