summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-10-09 22:09:13 +0000
committerKarl Berry <karl@freefriends.org>2017-10-09 22:09:13 +0000
commitf02113af46d7e1a235b9b6b7b10860d82709bdfc (patch)
treeded22f01bc91758976b428ec46e4df73874aefb2 /Master
parentf97fd80a18a2ecabd07094c24e5b70cfac0fa3f9 (diff)
eqnnumwarn (9oct17)
git-svn-id: svn://tug.org/texlive/trunk@45511 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/eqnnumwarn/README.md15
-rw-r--r--Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.pdfbin0 -> 90659 bytes
-rw-r--r--Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.tex117
-rw-r--r--Master/texmf-dist/tex/latex/eqnnumwarn/eqnnumwarn.sty182
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check3
-rw-r--r--Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/eqnnumwarn.tlpsrc0
7 files changed, 317 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/eqnnumwarn/README.md b/Master/texmf-dist/doc/latex/eqnnumwarn/README.md
new file mode 100644
index 00000000000..2514fbc46e2
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/eqnnumwarn/README.md
@@ -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@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
diff --git a/Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.pdf b/Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.pdf
new file mode 100644
index 00000000000..2db0136e814
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.tex b/Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.tex
new file mode 100644
index 00000000000..10795004cf7
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/eqnnumwarn/eqnnumwarn.tex
@@ -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@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@math.berkeley.edu}{\texttt{jgleason@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@math.berkeley.edu}{\texttt{jgleason@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
diff --git a/Master/texmf-dist/tex/latex/eqnnumwarn/eqnnumwarn.sty b/Master/texmf-dist/tex/latex/eqnnumwarn/eqnnumwarn.sty
new file mode 100644
index 00000000000..e88098daf2c
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/eqnnumwarn/eqnnumwarn.sty
@@ -0,0 +1,182 @@
+% Copyright (c) 2017 by Jonathan Gleason <jgleason@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@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@endtikzcd\endtikzcd
+\RenewEnviron{tikzcd}[1][]{%
+ \xpatchcmd*{\BODY}{&}{\&}{}{}% For compatibility with tikz. (Also see \tikzcdset{ampersand replacement=\&} above.)
+ \old@tikzcd[#1]%
+ \BODY%
+ \old@endtikzcd%
+}
+
+\NewDocumentCommand\intomargin{}{\def\enw@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@noeqnnumwarm{1}}% Use this command if you want to suppress the warning for a particular equation. Should place *before* environment.
+
+\newbox\temp@box
+\newdimen\stest
+\newdimen\smin
+\newdimen\smax
+\def\enw@find#1#2#3{% Used for \enw@getstretch and \enw@getshrink below. (From https://tex.stackexchange.com/questions/191140/measure-total-glue-in-a-box)
+ \let\old@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@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@box
+ \hskip 0pt #3-\stest
+ }%
+ \ifnum \badness > 100 % (shrink/stretch in \temp@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@hfuzz%
+ \hbadness=\old@hbadness%
+}
+\def\enw@getstretch#1{% Returns the amount of stretchable glue in the \smin register.
+ \setbox\temp@box\hbox{#1}%
+ \enw@find{stretch}{}{plus}%
+}
+\def\enw@getshrink#1{% Returns the amount of shrinkable glue in the \smin register.
+ \setbox\temp@box\hbox{#1}%
+ \enw@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@widthofequation}
+\newlength{\enw@widthofnumber}
+\newlength{\enw@shrinkability}
+\newlength{\enw@tagsep}
+\def\enw@initializelengthsdisplaced{%
+ \setlength{\enw@tagsep}{\mintagsep}% See the definition of \calc@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@fleqn\else\setlength{\enw@tagsep}{2\enw@tagsep}\fi% Thus, we have to multiply \enw@tagsep by 2 in this case.
+ \enw@getshrink{\ensuremath{\BODY}}% Stores shrink in \smin.
+ \setlength{\enw@shrinkability}{\smin}%
+ \setlength{\enw@widthofequation}{\widthof{\ensuremath{\displaystyle\BODY}}}%
+ \setlength{\enw@widthofnumber}{\widthof{\normalfont\normalcolor \tagform@\theequation}}% See definition of \@eqnum in amsmath.sty.
+}
+
+\newlength{\enw@tagdisplaced}
+\def\enw@settagdisplaced{%
+ \enw@initializelengthsdisplaced%
+ \setlength{\enw@tagdisplaced}{%
+ \enw@widthofequation -\enw@shrinkability +\enw@widthofnumber +\enw@tagsep -\displaywidth}% Should be displaced if this is greater than 0.
+ \ifdimcomp{\enw@tagdisplaced}{<}{0pt}{%
+ \setlength{\enw@tagdisplaced}{0pt}}{}%
+ \ifx\print@eqnum\@empty% Don't actually issue the warning if an equation number was not to be displayed.
+ \def\enw@tagdisplaced{0}%
+ \fi%
+}
+
+\let\old@equation\equation
+\let\old@endequation\endequation
+\RenewEnviron{equation}{%
+ \old@equation% Start equation environment.
+ \gdef\enw@isequation{1}% Used as a flag so we know if other commands need to be redefined accordingly.
+ %
+ \ifdef{\enw@noeqnnumwarm}{}{\def\enw@noeqnnumwarm{0}}%
+ \if1\enw@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@label\label%
+ \renewcommand{\label}[1]{}%
+ \let\old@footnote\footnote% Similarly for footnotes.
+ \renewcommand{\footnote}[1]{}%
+ % Actually test if the equation number has been displaced, and if so, give a warning.
+ \enw@settagdisplaced%
+ % Restore \footnote and \label commands.
+ \let\footnote\old@footnote%
+ \let\label\old@label%
+ \ifdef{\enw@intomargin}{%
+ \iftagsleft@%
+ \setlength{\enw@tagdisplaced}{\enw@tagdisplaced+1sp}%
+ \appto{\BODY}{\hspace*{-\enw@tagdisplaced}}% This allows the equation to shift to the right before displacing the equation number.
+ \else%
+ \setlength{\enw@tagdisplaced}{\enw@tagdisplaced+1sp}%
+ \preto{\BODY}{\hspace*{-\enw@tagdisplaced}}%
+ %\preto{\BODY}{\hspace{0pt minus \temp@smin}}% This allows the equation to shift to the left before displacing the equation number.
+ \fi%
+ }{}%
+ \BODY% Display actual equation.
+ \ifdef{\enw@intomargin}{\setlength{\enw@tagdisplaced}{0pt}}{}% So don't throw warning.
+ \global\undef{\enw@intomargin}%
+ \ifdimcomp{\enw@tagdisplaced}{>}{0pt}{%
+ \PackageWarning{eqnnumwarn}{Equation number (\theequation ) has been displaced}}{}%
+ \fi%
+ \global\undef\enw@noeqnnumwarm%
+ %
+ \global\undef\enw@isequation%
+ \old@endequation% Close equation environment.
+}
+
+% Credit goes to David Carlisle for these ideas.
+\pretocmd{\place@tag@gather}{%`
+ \ifshifttag@%
+ \ifdef{\enw@noeqnnumwarm}{}{\def\enw@noeqnnumwarm{0}}%
+ \if1\enw@noeqnnumwarm%
+ \else%
+ \PackageWarning{eqnnumwarn}{Equation number (\theequation ) has been displaced}%
+ \fi%
+ \fi%
+}{}{}
+
+\apptocmd{\place@tag}{%`
+ \if1\shift@tag\row@%
+ \ifdef{\enw@noeqnnumwarm}{}{\def\enw@noeqnnumwarm{0}}%
+ \if1\enw@noeqnnumwarm%
+ \else%
+ \PackageWarning{eqnnumwarn}{Equation number (\theequation ) has been displaced}%
+ \fi%
+ \fi%
+}{}{}
+
+\AfterEndEnvironment{multline}{%
+ \ifshifttag@%
+ \ifdef{\enw@noeqnnumwarm}{}{\def\enw@noeqnnumwarm{0}}%
+ \if1\enw@noeqnnumwarm%
+ \else%
+ \PackageWarning{eqnnumwarn}{Equation number (\theequation ) has been displaced}%
+ \fi%
+ \fi%
+}
+
+\endinput \ No newline at end of file
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index b63cd84b8c6..c9dc4f7519a 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -240,7 +240,8 @@ my @TLP_working = qw(
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
diff --git a/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc b/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc
index a2750246675..60758c3f7cc 100644
--- a/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc
@@ -65,6 +65,7 @@ depend emf
depend endiagram
depend engtlc
depend eqnarray
+depend eqnnumwarn
depend extarrows
depend extpfeil
depend faktor
diff --git a/Master/tlpkg/tlpsrc/eqnnumwarn.tlpsrc b/Master/tlpkg/tlpsrc/eqnnumwarn.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/eqnnumwarn.tlpsrc