diff options
author | Karl Berry <karl@freefriends.org> | 2010-12-23 23:34:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-12-23 23:34:46 +0000 |
commit | 1b316273c7c37f4c051ace6bc04cd8bfe55809e7 (patch) | |
tree | d9fafce49d3a04b754b47e879518e82bad7c3081 | |
parent | 17c64171472e3210951167496fe1a0a3d82f79ab (diff) |
sphack is back (23dec10)
git-svn-id: svn://tug.org/texlive/trunk@20842 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/sphack/sphack-doc.pdf | bin | 0 -> 241052 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/sphack/sphack-doc.tex | 115 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/sphack/sphack.sty | 114 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 2 | ||||
-rwxr-xr-x | Master/tlpkg/libexec/ctan2tds | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/sphack.tlpsrc | 0 |
7 files changed, 231 insertions, 2 deletions
diff --git a/Master/texmf-dist/doc/latex/sphack/sphack-doc.pdf b/Master/texmf-dist/doc/latex/sphack/sphack-doc.pdf Binary files differnew file mode 100644 index 00000000000..bbd9c827041 --- /dev/null +++ b/Master/texmf-dist/doc/latex/sphack/sphack-doc.pdf diff --git a/Master/texmf-dist/doc/latex/sphack/sphack-doc.tex b/Master/texmf-dist/doc/latex/sphack/sphack-doc.tex new file mode 100644 index 00000000000..3c685d5c407 --- /dev/null +++ b/Master/texmf-dist/doc/latex/sphack/sphack-doc.tex @@ -0,0 +1,115 @@ +\documentclass[pagesize=auto]{scrartcl} + +\usepackage{fixltx2e} +\usepackage{etex} +\usepackage{lmodern} +\usepackage[T1]{fontenc} +\usepackage{textcomp} +\usepackage{microtype} +\usepackage{hyperref} + +\newcommand*{\mail}[1]{\href{mailto:#1}{\texttt{#1}}} +\newcommand*{\pkg}[1]{\textsf{#1}} +\newcommand*{\cs}[1]{\texttt{\textbackslash#1}} +\makeatletter +\newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}} +\makeatother + +\addtokomafont{title}{\rmfamily} + +\title{The \pkg{sphack} package\thanks{This manual corresponds to \pkg{sphack.sty}~v1.0, dated~22 May 1998.}} +\author{Oliver Pretzel\thanks{\mail{o.pretzel@ic.ac.uk}}} +\date{22 May 1998} + + +\begin{document} + +\maketitle + +\noindent +Standard \LaTeX\ uses the macros \cmd{\@bsphack}, \cmd{\@esphack}, and \cmd{\@Esphack}, for +inserts into the text that should be invisible. So, for instance a space +before and after a \cmd{\label} command should not result in two spaces in the +output. + +\LaTeX\ deals with this as follows +% +\begin{itemize} +\item in maths mode do nothing, +\item in horizontal mode restore the space factor, +\item if the last thing on the list was a space + add \cmd{\ignorespaces} (and (\cmd{\global})\cmd{\ignore\-true} at the end of an environment), +\item in vertical mode do nothing. +\end{itemize} + +Doing nothing in maths mode is (nearly) harmless because maths mode does its +own spacing (and anyway hidden commands will usually appear only at the start +or end of maths). + +Doing nothing in vertical mode is not harmless. Many invisible commands such +as \cmd{\index} may insert delayed write commands into \TeX's output (so that page +numbers are correctly calculated). These commands can cause vertical space to +accumulate, and may cause a page break; \cmd{\index} is a particular problem in +\LaTeX2.09 since it inserts a delayed write if an index is actually being built +(\cmd{\makeindex} in preamble) but does nothing otherwise. That can change the page +breaks in a document. + +It is not possible to solve this problem completely in \LaTeX\ because \TeX\ does +not remove things from the main vertical list once they have been +contributed. So \LaTeXe\ makes \cmd{\index} insert something into the vertical +list whether the index is being written or not. That has the virtue of +consistancy, but is far from ideal. For instance, an \cmd{\index} immediately after +an \cmd{\item} can cause the page to break between the item label and content. + +\pagebreak[2] + +The code in the \pkg{sphack} package remedies this fault and other common anomalies so that commands +are nearly always invisible in vertical mode as well. It works as follows: +% +\begin{itemize} +\item Rename \LaTeX's dimension \cmd{\@savsk} to \cmd{\@savdim} set a new skip \cmd{\@savsk} + (because we need a true skip and a dimension in vertical mode) + +\item \cmd{\@bsphack} (at start of invisible command) + \begin{itemize} + \item in hmode (non-math) + \begin{enumerate} + \item store spacefactor in \cmd{\@savsf} + \item store lastskip in \cmd{\@savsk} (used to test whether space already present) + \end{enumerate} + + \item in vmode + \begin{enumerate} + \item store lastpenalty in \cmd{\@savsf} + \item store lastskip in \cmd{\@savsk} (used for movement) + \item store previous depth in \cmd{\@savdim} + \item skip back \cmd{\lastskip} + \end{enumerate} + \end{itemize} + +\item \cmd{\@esphack} (at end of invisible command) + \begin{itemize} + \item in hmode (non-math) + \begin{enumerate} + \item set spacefactor = \cmd{\@savsf} + \item if \cmd{\@savsk} > \cmd{\z@} \cmd{\ignorespaces} + \end{enumerate} + + \item in vmode + \begin{enumerate} + \item if in a label, or just after section heading, or if \cmd{\@nobreak}\\ + insert infinite penalty, (to prevent a page break)\\ + else insert penalty \cmd{\@savsf}\\ + endif + \item set previous depth = \cmd{\@savdim} + \item skip \cmd{\@savsk} + \end{enumerate} + \end{itemize} +\end{itemize} +% +Just as in standard \LaTeX, \cmd{\@Esphack} is \cmd{\@esphack} + (\cmd{\global})\cmd{\@ignoretrue}. + +It is not necessary to change any of the label or index macros to fit with +this code. + +\end{document} diff --git a/Master/texmf-dist/tex/latex/sphack/sphack.sty b/Master/texmf-dist/tex/latex/sphack/sphack.sty new file mode 100644 index 00000000000..3761a432cf5 --- /dev/null +++ b/Master/texmf-dist/tex/latex/sphack/sphack.sty @@ -0,0 +1,114 @@ +% SPHACK.STY +% Oliver Pretzel (o.pretzel@ic.ac.uk) +% Created 22 May 1998, Version 1.0 22May 1998 +% Modified space hacks for LateX (209 and 2e) +% (to prevent \label, \index and similar commands +% affecting spacing in vertical mode). +% +% +% DOCUMENTATION at end of file +% +% ALL RIGHTS RESERVED +% +% This file may be distributed freely. +% It may be modified for local use (an email copy of the +% modified file would be appreciated). +% Modified versions may only be distributed if +% 1. The name is changed +% 2. A statement acknowledging the modification heads the file. +% +% DO NOT USE \neq in this file +\chardef\neq\the\catcode`\@ +\makeatletter\@makeother\" +% + +\typeout{`sphack.sty <1.0>} +%************************* + +\ifx\@savdim\undefined\let\@savdim\@savsk\newskip\@savsk\fi +\def\@bsphack{\relax\ifmmode\else\@savsk\lastskip\@savsf\ifhmode\spacefactor + \else\lastpenalty\@savdim\prevdepth\removelastskip\fi\fi} +\def\@esphack{\relax\ifmmode\else\ifvmode\penalty\if@nobreak\@M\else + \if@inlabel\@M\else\if@noskipsec\@M\else\@savsf\fi\fi\fi + \prevdepth\@savdim\vskip\@savsk\else + \spacefactor\@savsf\ifdim\@savsk>\z@\ignorespaces\fi\fi\fi} +\ifx\LateXe\undefined +\def\@Esphack{\@esphack\ifhmode\ifdim\@savsk>\z@ + \global\@ignoretrue\ignorespaces\fi\fi} +\else +\def\@Esphack{\@esphack\ifhmode\ifdim\@savsk>\z@ + \@ignoretrue\ignorespaces\fi\fi} +\fi + +% This line must be last line of code +\catcode`\@\neq\let\neq\ne\endinput + +******************* + DOCUMENTATION +******************* +Standard LaTeX uses the macros \@bsphack, \@esphack, and \@Esphack, for +inserts into the text that should be invisible. So, for instance a space +before and after a \label command should not result in two spaces in the +output. + +LaTeX deals with this as follows + in maths mode do nothing, + in horizontal mode restore the space factor, + if the last thing on the list was a space + add \ignorespaces (and (\global)\ignoretrue at the end of an environment), + in vertical mode do nothing. + +Doing nothing in maths mode is (nearly) harmless because maths mode does its +own spacing (and anyway hidden commands will usually appear only at the start +or end of maths). + +Doing nothing in vertical mode is not harmless. Many invisible commands such +as \index may insert delayed write commands into TeX's output (so that page +numbers are correctly calculated). These commands can cause vertical space to +accumulate, and may cause a page break; \index is a particular problem in +LaTeX209 since it inserts a delayed write if an index is actually being built +(\makeindex in preamble) but does nothing otherwise. That can change the page +breaks in a document. + +It is not possible to solve this problem completely in LaTeX because TeX does +not remove things from the main vertical list once they have been +contributed. So LaTeX2e makes \index insert something into the vertical +list whether the index is being written or not. That has the virtue of +consistancy, but is far from ideal. For instance, an \index immediately after +an \item can cause the page to break between the item label and content. + +The code above remedies this fault and other common anomalies so that commands +are nearly always invisible in vertical mode as well. It works as follows: + +Rename LaTeX's dimension \@savsk to \@savdim set a new skip \@savsk + (because we need a true skip and a dimension in vertical mode) + +\@bsphack (at start of invisible command) +in hmode (non-math) + store spacefactor in \@savsf + store lastskip in \@savsk (used to test whether space already present) +in vmode + store lastpenalty in \@savsf + store lastskip in \@savsk (used for movement) + store previous depth in \@savdim + skip back \lastskip + +\@esphack (at end of invisible command) +in hmode (non-math) + set spacefactor = \@savsf + if \@savsk > \z@ \ignorespaces +in vmode + if in a label, or just after section heading, or if \@nobreak + insert infinite penalty, (to prevent a page break) + else insert penalty \@savsf + endif + set previous depth = \@savdim + skip \@savsk + +Just as in standard LateX, \@Esphack is \@esphack + (\global)\@ignoretrue. + +It is not necessary to change any of the label or index macros to fit with +this code. + +End of sphack.sty +******************* diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 086cfb806d8..8fe68c39cf2 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -299,7 +299,7 @@ my @TLP_working = qw( slantsc slashbox slideshow smalltableof smartref snapshot songbook sort-by-letters soton soul soyombo spanish spanish-mx sparklines spie - splines splitbib splitindex spot spotcolor spreadtab spverbatim + sphack splines splitbib splitindex spot spotcolor spreadtab spverbatim srcltx stack stage standalone starfont statistik statex statex2 staves stdclsdv stdpage steinmetz stellenbosch stex stix stringstrings struktex diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index f1f3544bfe9..708deb7fadd 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -680,7 +680,6 @@ $Master = "$mydir/../.."; 'smflatex', "die 'skipping, nosource'", 'softmaker-freefonts', "die 'skipping, requires nonfree fonts'", 'songs', "die 'skipping, requires binary'", - 'sphack', "die 'skipping, nonfree license'", 'springer', "die 'skipping, licenses not checked'", 'sprite', "die 'skipping, noinfo license'", 'ssqquote', "die 'skipping, nonfree license'", diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc index f244c2fa9b7..816e336e362 100644 --- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc @@ -582,6 +582,7 @@ depend smartref depend snapshot depend soul depend sparklines +depend sphack depend spreadtab depend spverbatim depend splitindex diff --git a/Master/tlpkg/tlpsrc/sphack.tlpsrc b/Master/tlpkg/tlpsrc/sphack.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/sphack.tlpsrc |