texlive[45511] Master: eqnnumwarn (9oct17)

commits+karl at tug.org commits+karl at tug.org
Tue Oct 10 00:09:13 CEST 2017


Revision: 45511
          http://tug.org/svn/texlive?view=revision&revision=45511
Author:   karl
Date:     2017-10-10 00:09:13 +0200 (Tue, 10 Oct 2017)
Log Message:
-----------
eqnnumwarn (9oct17)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/eqnnumwarn/
    trunk/Master/texmf-dist/doc/latex/eqnnumwarn/README.md
    trunk/Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.pdf
    trunk/Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.tex
    trunk/Master/texmf-dist/tex/latex/eqnnumwarn/
    trunk/Master/texmf-dist/tex/latex/eqnnumwarn/eqnnumwarn.sty
    trunk/Master/tlpkg/tlpsrc/eqnnumwarn.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/eqnnumwarn/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/eqnnumwarn/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/eqnnumwarn/README.md	2017-10-09 22:09:13 UTC (rev 45511)
@@ -0,0 +1,15 @@
+The `eqnnumwarn` package 
+------------------------
+
+Sometimes an equation is too long that an equation number will be typeset below the equation itself, but yet not long enough to yield an "overfull `\hbox`" warning.  The `eqnnumwarn' package modifies the standard `amsmath` numbered equation environments to throw a warning whenever this occurs.
+
+___
+
+##### Licenscing
+Copyright (c) 2017 by Jonathan Gleason <jgleason at math.berkeley.edu>
+
+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 `maintained'.
+
+This work consists of the file `eqnnumwarn.sty`, `eqnnumwarn.tex`, and `eqnnumwarn.pdf`.
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/doc/latex/eqnnumwarn/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.pdf	2017-10-09 22:08:07 UTC (rev 45510)
+++ trunk/Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.pdf	2017-10-09 22:09:13 UTC (rev 45511)

Property changes on: trunk/Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.tex	2017-10-09 22:09:13 UTC (rev 45511)
@@ -0,0 +1,117 @@
+\documentclass{ltxdockit}
+
+\usepackage[utf8]{luainputenc}
+\usepackage[american]{babel}
+\usepackage[tracking=true]{microtype}
+\usepackage{eqnnumwarn}
+\usepackage{shortvrb}
+\MakeShortVerb{\|}
+
+\newcommand{\blni}{\vspace*{\baselineskip}\noindent}
+
+\newcommand*{\version}{1.0}
+\renewcommand*{\date}{2017/10/09}
+
+\titlepage{%
+  title={The \sty{eqnnumwarn} Package},
+  subtitle={},
+  author={Jonathan Gleason},
+  email={jgleason at math.berkeley.edu},
+  revision={v\version},
+  date={\date}}
+
+\hypersetup{%
+  pdftitle={The eqnnumwarn Package},
+  pdfauthor={Jonathan Gleason},
+  pdfkeywords={tex, latex, class, package}}
+
+\begin{document}
+
+\printtitlepage
+
+\section{About}
+
+Sometimes an equation is too long that an equation number will be typeset below the equation itself, but yet not long enough to yield an ``overfull |\hbox|'' warning.  The \sty{eqnnumwarn} package modifies the standard |amsmath| numbered equation environments to throw a warning whenever this occurs.
+
+\section{Usage}
+
+The package may be used simply by placing |\usepackage{eqnnumwarm}| somewhere in the preamble.
+
+\subsection{User Commands}
+
+The package includes two commands, \cmd{intomargin} and \cmd{noeqnnumwarn}, to modify the default behavior.
+
+\begin{ltxsyntax}
+	
+\item[\cmd{intomargin}\hspace{1em}] When the equation is just slightly too large, it can be acceptable to move the equation into the margin just as much as needed to prevent the displacement of the equation number.  To do this, place the command \cmd{intomargin} immediately before the equation environment.  This currently only works with the |equation| environment.
+
+\item[\cmd{noeqnnumwarn}\hspace{1em}] If for whatever reason you wish to prevent a particular equation from generating a warning, place \cmd{noeqnnumwarn} immediately before the equation environment.
+
+\end{ltxsyntax}
+
+\section{Demonstration}
+
+The following equation doesn't displace the equation number, and so of course doesn't throw a warning.
+\newlength{\rulelength}
+\setlength{\rulelength}{165pt}
+\begin{equation}
+	\raisebox{.5ex}{\rule{\rulelength}{.5pt}}\, \text{No Warning}\, \raisebox{.5ex}{\rule{\rulelength}{.5pt}}
+\end{equation}
+
+\blni
+On the other hand, the following equation does displace the equation number, and so does throw a warning.
+\setlength{\rulelength}{177pt}
+\makeatletter
+\begin{equation}\label{eqn2}
+\raisebox{.5ex}{\rule{\rulelength}{.5pt}}\, \text{Warning}\, \raisebox{.5ex}{\rule{\rulelength}{.5pt}}
+\end{equation}
+
+\blni
+The following equation is identical to the previous except that it was immediately preceded by \cmd{intomargin}, which results in no displaced equation number (and hence no warning). 
+\setlength{\rulelength}{177pt}
+\intomargin
+\begin{equation}
+\raisebox{.5ex}{\rule{\rulelength}{.5pt}}\, \text{Warning}\, \raisebox{.5ex}{\rule{\rulelength}{.5pt}}
+\end{equation}
+
+\blni
+The following is again identical to \eqref{eqn2}, except that it was preceded by \cmd{noeqnnumwarn}:  the equation number is displaced, but yet no warning is thrown.
+\setlength{\rulelength}{177pt}
+\makeatletter
+\begin{equation}
+\raisebox{.5ex}{\rule{\rulelength}{.5pt}}\, \text{Warning}\, \raisebox{.5ex}{\rule{\rulelength}{.5pt}}
+\end{equation}
+
+\section{Miscellaneous}
+
+\subsection{Acknowledgments}
+
+The development of this package actually started with a question of mine on tex.stackexchange (\url{https://tex.stackexchange.com/questions/384222/}).  I have incorporated some code by David Carlisle from his answer there.
+
+I also made use of code taken from another question on tex.stackexchange (\url{https://tex.stackexchange.com/questions/191140/}), which determines the stretchability/shrinkability of a given |\hbox|.
+
+This documentation was created using a template and class due to Philipp Lehman.
+
+\subsection{Reporting issues}
+
+The current version should still very much be considered in ``beta'', and as such I expect there are bugs to be found.  If do find any problems, or otherwise have any comments, suggestions, etc., please e-mail me at \href{mailto:jgleason at math.berkeley.edu}{\texttt{jgleason at math.berkeley.edu}}.
+
+\subsection{Revision History}
+
+\begin{changelog}
+
+\begin{release}{\version}{\date}
+
+\item Initial public release
+
+\end{release}
+
+\end{changelog}
+
+\subsection{Licensing}
+
+Copyright \textcopyright\ 2017 by Jonathan Gleason <\href{mailto:jgleason at math.berkeley.edu}{\texttt{jgleason at math.berkeley.edu}}>
+
+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 \url{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.
+
+\end{document}
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/eqnnumwarn/eqnnumwarn.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/eqnnumwarn/eqnnumwarn.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/eqnnumwarn/eqnnumwarn.sty	2017-10-09 22:09:13 UTC (rev 45511)
@@ -0,0 +1,182 @@
+% Copyright (c) 2017 by Jonathan Gleason <jgleason at math.berkeley.edu>
+%
+% 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 `maintained'.
+%
+% This work consists of the file eqnnumwarn.sty.
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{eqnnumwarn}[2017/10/09 v1.0 Warnings for displaced equation numbers]
+
+\RequirePackage{etoolbox}
+\RequirePackage{xparse}
+\RequirePackage{calc}
+\RequirePackage{environ}
+\RequirePackage{mathtools}
+\RequirePackage{tikz}
+\usetikzlibrary{cd}
+\tikzcdset{ampersand replacement=\&} % This makes it so that "\&", not "&", is treated as the column separator in tikzcd environments.  (We do this so that it these environments can be passed as arguments (via "\BODY") to our redefinition of the equation environment.)  (See https://tex.stackexchange.com/questions/15093/.)
+\let\old at tikzcd\tikzcd % So that we don't have to manually write "\&", we update the "tikzcd" environment so that it automatically replaces the "&"s with "\&"s.
+\let\old at endtikzcd\endtikzcd
+\RenewEnviron{tikzcd}[1][]{%
+	\xpatchcmd*{\BODY}{&}{\&}{}{}% For compatibility with tikz.  (Also see \tikzcdset{ampersand replacement=\&} above.)
+	\old at tikzcd[#1]%
+	\BODY%
+	\old at endtikzcd%
+}
+
+\NewDocumentCommand\intomargin{}{\def\enw at intomargin{1}}% Use this command if you would like to possibly shift the equation into the margin in order to avoid displacing the equation number.  Should place *before* environment.
+\NewDocumentCommand\noeqnnumwarn{}{\def\enw at noeqnnumwarm{1}}% Use this command if you want to suppress the warning for a particular equation.  Should place *before* environment.
+
+\newbox\temp at box
+\newdimen\stest
+\newdimen\smin
+\newdimen\smax
+\def\enw at find#1#2#3{% Used for \enw at getstretch and \enw at getshrink below.  (From https://tex.stackexchange.com/questions/191140/measure-total-glue-in-a-box)
+	\let\old at hbadness\hbadness% Need to temporarily redefine \hbadness and \hfuzz so don't get a ridiculously number of warnings as we test for stretchability/shrinkability.
+	\hbadness=1000000%
+	\let\old at hfuzz\hfuzz%
+	\hfuzz=\maxdimen%
+	\smin = -\maxdimen
+	\smax = \maxdimen
+	\loop
+	\stest = \smin
+	\advance \stest by \smax
+	\divide \stest by 2 % now \stest=(\smin+\smax)/2 truncated to 0
+	\ifdim \stest = \smax
+	\advance \stest by -1sp % ensure that \smin<=\stest<\smax.
+	\fi
+	\setbox 0 = \hbox spread #2 1sp {%
+		\unhcopy\temp at box
+		\hskip 0pt #3-\stest
+	}%
+	\ifnum \badness > 100 % (shrink/stretch in \temp at box) <= \stest
+	\smax = \stest
+	\else
+	\smin = \stest
+	\advance \smin by 1sp
+	% since ">\stest" implies ">=\stest+1sp"
+	\fi
+	% In both cases, the interval [\smin,\smax] becomes smaller.
+	\ifdim\smin<\smax
+	\repeat
+	\ifdim\smin>\smax\BOOM\fi% cannot happen, I think
+	\hfuzz=\old at hfuzz%
+	\hbadness=\old at hbadness%
+}
+\def\enw at getstretch#1{% Returns the amount of stretchable glue in the \smin register.
+	\setbox\temp at box\hbox{#1}%
+	\enw at find{stretch}{}{plus}%
+}
+\def\enw at getshrink#1{% Returns the amount of shrinkable glue in the \smin register.
+	\setbox\temp at box\hbox{#1}%
+	\enw at find{shrink}{-}{minus}%	
+}
+
+\ifdef{\mathindent}{}{\newlength{\mathindent}}% In case \mathindent hasn't been defined, define it. (Will be used in redefinition of equation environment.)
+% Modifies "equation" environment to test if equation number has been displaced.
+\newlength{\enw at widthofequation}
+\newlength{\enw at widthofnumber}
+\newlength{\enw at shrinkability}
+\newlength{\enw at tagsep}
+\def\enw at initializelengthsdisplaced{%
+	\setlength{\enw at tagsep}{\mintagsep}% See the definition of \calc at shift@gather in amsmath.sty.  Note the line "\multiply\dimen@\tw@" (previously \dimen@ is defined to be \mintagsep), which is only done if fleqn is *not* activated.
+	\if at fleqn\else\setlength{\enw at tagsep}{2\enw at tagsep}\fi% Thus, we have to multiply \enw at tagsep by 2 in this case.
+	\enw at getshrink{\ensuremath{\BODY}}% Stores shrink in \smin.
+	\setlength{\enw at shrinkability}{\smin}%
+	\setlength{\enw at widthofequation}{\widthof{\ensuremath{\displaystyle\BODY}}}%
+	\setlength{\enw at widthofnumber}{\widthof{\normalfont\normalcolor \tagform@\theequation}}% See definition of \@eqnum in amsmath.sty.
+}
+
+\newlength{\enw at tagdisplaced}
+\def\enw at settagdisplaced{%
+	\enw at initializelengthsdisplaced%
+	\setlength{\enw at tagdisplaced}{%
+		\enw at widthofequation -\enw at shrinkability +\enw at widthofnumber +\enw at tagsep -\displaywidth}% Should be displaced if this is greater than 0.
+	\ifdimcomp{\enw at tagdisplaced}{<}{0pt}{%
+		\setlength{\enw at tagdisplaced}{0pt}}{}%
+	\ifx\print at eqnum\@empty% Don't actually issue the warning if an equation number was not to be displayed.
+	\def\enw at tagdisplaced{0}%
+	\fi%
+}
+
+\let\old at equation\equation
+\let\old at endequation\endequation
+\RenewEnviron{equation}{%
+	\old at equation% Start equation environment.
+	\gdef\enw at isequation{1}% Used as a flag so we know if other commands need to be redefined accordingly.
+	%
+	\ifdef{\enw at noeqnnumwarm}{}{\def\enw at noeqnnumwarm{0}}%
+	\if1\enw at noeqnnumwarm%
+	\BODY%
+	\else%
+	% Don't want to "label" twice, so we disable labeling here (will be "label"ed below when defining \@tempequationlength, and need the label to appear there because we want it to be measured when it comes to the legnth).
+	\let\old at label\label%
+	\renewcommand{\label}[1]{}%
+	\let\old at footnote\footnote% Similarly for footnotes.
+	\renewcommand{\footnote}[1]{}%
+	% Actually test if the equation number has been displaced, and if so, give a warning.
+	\enw at settagdisplaced%
+	% Restore \footnote and \label commands.
+	\let\footnote\old at footnote%
+	\let\label\old at label%
+	\ifdef{\enw at intomargin}{%
+		\iftagsleft@%
+		\setlength{\enw at tagdisplaced}{\enw at tagdisplaced+1sp}%
+		\appto{\BODY}{\hspace*{-\enw at tagdisplaced}}% This allows the equation to shift to the right before displacing the equation number.
+		\else%
+		\setlength{\enw at tagdisplaced}{\enw at tagdisplaced+1sp}%
+		\preto{\BODY}{\hspace*{-\enw at tagdisplaced}}%
+		%\preto{\BODY}{\hspace{0pt minus \temp at smin}}% This allows the equation to shift to the left before displacing the equation number.
+		\fi%
+	}{}%
+	\BODY% Display actual equation.
+	\ifdef{\enw at intomargin}{\setlength{\enw at tagdisplaced}{0pt}}{}% So don't throw warning.
+	\global\undef{\enw at intomargin}%
+	\ifdimcomp{\enw at tagdisplaced}{>}{0pt}{%
+		\PackageWarning{eqnnumwarn}{Equation number (\theequation ) has been displaced}}{}%
+	\fi%
+	\global\undef\enw at noeqnnumwarm%
+	%
+	\global\undef\enw at isequation%
+	\old at endequation% Close equation environment.
+}
+
+% Credit goes to David Carlisle for these ideas.
+\pretocmd{\place at tag@gather}{%`
+	\ifshifttag@%
+	\ifdef{\enw at noeqnnumwarm}{}{\def\enw at noeqnnumwarm{0}}%
+	\if1\enw at noeqnnumwarm%
+	\else%
+	\PackageWarning{eqnnumwarn}{Equation number (\theequation ) has been displaced}%
+	\fi%
+	\fi%
+}{}{}
+
+\apptocmd{\place at tag}{%`
+	\if1\shift at tag\row@%
+	\ifdef{\enw at noeqnnumwarm}{}{\def\enw at noeqnnumwarm{0}}%
+	\if1\enw at noeqnnumwarm%
+	\else%
+	\PackageWarning{eqnnumwarn}{Equation number (\theequation ) has been displaced}%
+	\fi%
+	\fi%
+}{}{}
+
+\AfterEndEnvironment{multline}{%
+	\ifshifttag@%
+	\ifdef{\enw at noeqnnumwarm}{}{\def\enw at noeqnnumwarm{0}}%
+	\if1\enw at noeqnnumwarm%
+	\else%
+	\PackageWarning{eqnnumwarn}{Equation number (\theequation ) has been displaced}%
+	\fi%
+	\fi%
+}
+
+\endinput
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/tex/latex/eqnnumwarn/eqnnumwarn.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2017-10-09 22:08:07 UTC (rev 45510)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2017-10-09 22:09:13 UTC (rev 45511)
@@ -240,7 +240,8 @@
     epigrafica epigram epigraph epiolmec eplain
     epsdice epsf epsf-dvipdfmx epsincl epslatex-fr
     epspdf epspdfconversion epstopdf
-    eqell eqlist eqnalign eqname eqnarray eqparbox errata esami es-tex-faq
+    eqell eqlist eqnalign eqname eqnarray eqnnumwarn eqparbox
+    errata esami es-tex-faq
     erdc erewhon esdiff esint esint-type1 esk eskd eskdx
     eso-pic esrelation esstix estcpmm esvect
     etaremune etdipa etex-pkg etextools ethiop ethiop-t1

Modified: trunk/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc	2017-10-09 22:08:07 UTC (rev 45510)
+++ trunk/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc	2017-10-09 22:09:13 UTC (rev 45511)
@@ -65,6 +65,7 @@
 depend endiagram
 depend engtlc
 depend eqnarray
+depend eqnnumwarn
 depend extarrows
 depend extpfeil
 depend faktor

Added: trunk/Master/tlpkg/tlpsrc/eqnnumwarn.tlpsrc
===================================================================


More information about the tex-live-commits mailing list