summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/eqnnumwarn/eqnnumwarn.tex
blob: 10795004cf74b79487504785840509966a19ffb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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}