From: Jan Nieuwenhuizen Date: Sun, 29 Feb 2004 19:58:28 +0000 (+0000) Subject: * stepmake/aclocal.m4: Store computed version in variable. X-Git-Tag: release/2.1.29~45 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5c006bd489c6bceb39973a1cd4e2260c9391766a;p=lilypond.git * stepmake/aclocal.m4: Store computed version in variable. * configure.in: Export MAKEINFO_VERSION. * config.make.in (MAKEINFO_VERSION): Add. * make/ly-rules.make: Add makeinfo <= 4.6 workaround. * Documentation/user/GNUmakefile: Only build info with images when building web. * GNUmakefile.in (install-WWW): Visit Documentation/user. * stepmake/stepmake/texinfo-targets.make: Move info and texinfo stuff from documentation-targets.make --- diff --git a/ChangeLog b/ChangeLog index bcae26fd0c..ce3311cf7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2004-02-29 Jan Nieuwenhuizen + + * stepmake/aclocal.m4: Store computed version in variable. + + * configure.in: Export MAKEINFO_VERSION. + + * config.make.in (MAKEINFO_VERSION): Add. + + * make/ly-rules.make: Add makeinfo <= 4.6 workaround. + + * Documentation/user/GNUmakefile: Only build info with images when + building web. + + * GNUmakefile.in (install-WWW): Visit Documentation/user. + + * stepmake/stepmake/texinfo-targets.make: Move info and texinfo + stuff from documentation-targets.make + 2004-02-29 Han-Wen Nienhuys * scripts/convert-ly.py (conv): diff --git a/Documentation/user/GNUmakefile b/Documentation/user/GNUmakefile index 048f066ed5..82ec806ff0 100644 --- a/Documentation/user/GNUmakefile +++ b/Documentation/user/GNUmakefile @@ -34,17 +34,33 @@ dvi: $(DVI_FILES) ps: $(PS_FILES) -# Cancel the default info generation rule. We want to generate info -# from `.nexi', making sure we don't run LilyPond for images, when -# generating info. This will produce info docs without images. For -# full info documentation including images, run make web. -$(outdir)/%.info: # $(outdir)/%.texi +info: $(INFO_FILES) + +# There are two modes for info: with and without images. +ifeq ($(out),www) + +# This builds all .info targets with images, in out-www. +# Viewawble with a recent Emacs, doing: M-x info out-www/lilypond.info + +#info: $(INFO_FILES) + # Cancel the special, non-image info generation rule that skips images: + $(outdir)/%.info: $(outdir)/%.nexi +local-install-info: info + (cd $(package_infodir) && ln -s $(local_package_docdir)/html/Documentation/user/out-www/*png .) +local-uninstall-WWW: + rm -f $(package_infodir)/*.png +else + # Cancel the default info generation rule that generates images: + $(outdir)/%.info: # $(outdir)/%.texi +endif + +# All web targets, except info image symlinks and info docs are +# installed in non-recursing target from TOPDIR +local-install-WWW: local-install-info +local-uninstall-WWW: local-uninstall-info default: -# Info is now built by default via texinfo-rules. -# We must build them by default, otherwise they get built during make install -info: $(INFO_FILES) local-help: extra-local-help @@ -101,23 +117,7 @@ deep-symlinks: endif -local-WWW: $(HTML_FILES) $(datafiles) $(PDF_FILES) $(PS_GZ_FILES) $(DEEP_HTML_FILES) info-with-images info-dir - -# This builds all .info targets with images, in out-www. -# Viewawble with a recent Emacs, doing: M-x info out-www/lilypond.info -# TODO: install .info into $(INFODIR)/lilypond/, -# adding symlinks for images (or devise image include dir for Info?). -info-with-images: $(INFO_FILES) - -cp -f $(INFO_INSTALL_FILES) $(builddir)/Documentation/user/$(outconfbase) - -local-install-info: -# URG, silly home-brewn web-install target works from TOPDIR using tarball. -# FIXME: doc pics get installed twice -# (cd $(package_infodir) && ln -s $(local_package_docdir)/html/*png .) - -(cd $(package_infodir) && ln -f $(builddir)/Documentation/user/$(outconfbase)-www/*png .) - -local-uninstall-info: - rm -f $(package_infodir)/*.png +local-WWW: $(HTML_FILES) $(datafiles) $(PDF_FILES) $(PS_GZ_FILES) $(DEEP_HTML_FILES) info info-dir local-WWW-clean: deep-WWW-clean diff --git a/GNUmakefile.in b/GNUmakefile.in index 717c190427..672f460fa5 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -40,9 +40,18 @@ doc: install-WWW: -$(INSTALL) -m 755 -d $(webdir) tar -C $(webdir)/ -xzf $(outdir)/web.tar.gz +# install-WWW does not recurse; fake it visiting Documentation/user manually + $(MAKE) -C Documentation/user local-install-WWW web-install: $(MAKE) out=www install-WWW + $(MAKE) out=www + +uninstall-WWW: + #TODO + +web-uninstall: + $(MAKE) out=www uninstall-WWW= local-install: $(INSTALL) -d $(local_lilypond_datadir) @@ -52,16 +61,13 @@ final-install: @echo " *** Before running, buildscripts/out/lilypond-{profile,login}" @echo " *** must be run. You're advised to source these scripts from your " @echo " *** login scripts. For more information, see Invoking LilyPond in the manual." - @echo + @echo web-ext = gz html midi pdf png txt ly footify = MAILADDRESS=bug-lilypond@gnu.org $(PYTHON) $(step-bindir)/add-html-footer.py --name $(PACKAGE_NAME) --version $(TOPLEVEL_VERSION) -bla: - cd $(builddir) && $(footify) `$(FIND) . -name '*.html' -print` - -local-WWW-post: +local-WWW-post: $(PYTHON) $(buildscript-dir)/mutopia-index.py -o $(builddir)/examples.html ./ cd $(builddir) && $(footify) `$(FIND) . -name '*.html' -print` cd $(builddir) && rm -f `find . -name \*.html~ -print` diff --git a/config.make.in b/config.make.in index b49c7ec768..40e1c42557 100644 --- a/config.make.in +++ b/config.make.in @@ -3,7 +3,6 @@ MISSING_OPTIONAL = @OPTIONAL@ MISSING_REQUIRED = @REQUIRED@ - # @configure_input@ package-depth = @package_depth@ @@ -68,6 +67,7 @@ LD = @LD@ CONFIGSUFFIX = @CONFIGSUFFIX@ MAKEINFO_PROGRAM = @MAKEINFO@ SPLITTING_MAKEINFO = @SPLITTING_MAKEINFO@ +MAKEINFO_VERSION = @MAKEINFO_VERSION@ ICFLAGS = @ICFLAGS@ ILDFLAGS = @ILDFLAGS@ TFM_PATH = @TFM_PATH@ diff --git a/configure.in b/configure.in index c86e919778..28e7d287f3 100644 --- a/configure.in +++ b/configure.in @@ -66,6 +66,7 @@ STEPMAKE_PROGS(MFTRACE, mftrace, OPTIONAL, 1.0.27) # new makeinfo for multi-page website docs STEPMAKE_PROGS(MAKEINFO, makeinfo, OPTIONAL, 4.6) +AC_SUBST(MAKEINFO_VERSION) if test "$optimise_b" = yes; then diff --git a/make/ly-rules.make b/make/ly-rules.make index 3849b142a7..adadab0942 100644 --- a/make/ly-rules.make +++ b/make/ly-rules.make @@ -10,43 +10,36 @@ $(outdir)/%.latex: %.doc # it is not, for --srcdir builds $(outdir)/%.texi: %.tely if [ -f $@ ]; then chmod a+w $@; fi - rm -f $$(grep -LF '\lilypondend' out/lily-*.tex) + rm -f $$(grep -LF '\lilypondend' out/lily-*.tex 2>/dev/null) $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND) $(LILYPOND_BOOK_INCLUDES)' --output=$(outdir) --format=$(LILYPOND_BOOK_FORMAT) --verbose $(LILYPOND_BOOK_FLAGS) $< chmod -w $@ $(outdir)/%.texi: $(outdir)/%.tely if [ -f $@ ]; then chmod a+w $@; fi - rm -f $$(grep -LF '\lilypondend' out/lily-*.tex) + rm -f $$(grep -LF '\lilypondend' out/lily-*.tex 2>/dev/null) $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND) $(LILYPOND_BOOK_INCLUDES)' --output=$(outdir) --format=$(LILYPOND_BOOK_FORMAT) --verbose $(LILYPOND_BOOK_FLAGS) $< # # DON'T REMOVE SOURCE FILES, otherwise the .TEXI ALWAYS OUT OF DATE. # rm -f $< chmod -w $@ -# nexi: no-lily texi -# for plain info doco: don't run lily +# nexi: n[o-lilypond t]exi +# for plain info doco: don't run lilypond $(outdir)/%.nexi: %.tely if [ -f $@ ]; then chmod a+w $@; fi rm -f $(outdir)/$*.texi $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --output=$(outdir) --format=$(LILYPOND_BOOK_FORMAT) --verbose $(LILYPOND_BOOK_FLAGS) --process='true' $< mv $(outdir)/$*.texinfo $@ 2>/dev/null || mv $(outdir)/$*.texi $@ +# makeinfo <= 4.6 image bug workaround + if [ $(MAKEINFO_VERSION) -le 4006000 ]; then \ + (cd $(outdir) && \ + ls -1 lily-*.ly | sed 's/.ly$$/.txt/' | xargs touch) || true; \ + fi chmod -w $@ -# nfo: info from non-lily texi $(outdir)/%.info: $(outdir)/%.nexi $(MAKEINFO) -I $(outdir) --output=$(outdir)/$(*F).info $< -# nfo: info from non-lily texi -#$(outdir)/%.nfo: $(outdir)/%.nexi -# $(MAKEINFO) --output=$(outdir)/$(*F).info $< - -# -# let's not do this: this interferes with the lilypond-book dependency mechanism. -# -##$(outdir)/%.tex: $(outdir)/%.ly -## $(LILYPOND) $(LILYPOND_BOOK_INCLUDES) -o $@ $< - -# # Timothy's booklet # $(outdir)/%-book.ps: $(outdir)/%.ps @@ -57,7 +50,6 @@ $(outdir)/%.pdf: $(outdir)/%.dvi dvips $(DVIPS_FLAGS) -o $@.pdfps -t $(DVIPS_PAPERSIZE) $< ps2pdf -sPAPERSIZE=$(DVIPS_PAPERSIZE) $@.pdfps $@ - $(outdir)/%.html.omf: %.tely $(call GENERATE_OMF,html) @@ -67,7 +59,6 @@ $(outdir)/%.pdf.omf: %.tely $(outdir)/%.ps.gz.omf: %.tely $(call GENERATE_OMF,ps.gz) - $(outdir)/%.html.omf: $(outdir)/%.texi $(call GENERATE_OMF,html) diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index 71a182aa6c..0d7659714c 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -570,7 +570,7 @@ class Lilypond_snippet (Snippet): verb = verbatim_texinfo (self.substring ('code')) str += (output[TEXINFO][VERBATIM] % vars ()) -# str += ('@ifinfo\n' + self.output_info () + '\n@end ifinfo\n') + str += ('@ifinfo\n' + self.output_info () + '\n@end ifinfo\n') str += ('@tex\n' + self.output_latex () + '\n@end tex\n') str += ('@html\n' + self.output_html () + '\n@end html\n') # need par after image diff --git a/stepmake/aclocal.m4 b/stepmake/aclocal.m4 index 876f4203bf..99f4cb7892 100644 --- a/stepmake/aclocal.m4 +++ b/stepmake/aclocal.m4 @@ -97,6 +97,9 @@ AC_DEFUN(STEPMAKE_CHECK_VERSION, [ if test "$num" -lt "$req"; then STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"]) fi + vervar="`echo $1 | tr '[a-z]' '[A-Z]'`_VERSION" + eval `echo $vervar=$num` +## AC_SUBST(`eval echo $vervar`) ]) # Check version of program ($1) diff --git a/stepmake/stepmake/documentation-targets.make b/stepmake/stepmake/documentation-targets.make index 4193e522b4..02765c7a02 100644 --- a/stepmake/stepmake/documentation-targets.make +++ b/stepmake/stepmake/documentation-targets.make @@ -1,30 +1,5 @@ - +# do we need this? default: -# UGH. -include $(stepdir)/www-targets.make - local-WWW: $(OUTHTML_FILES) -# why isn't this in texinfo-targets? -INFO_INSTALL_FILES = $(wildcard $(addsuffix *, $(INFO_FILES))) - -# should we call install-info? -INFOINSTALL=$(MAKE) INSTALLATION_OUT_DIR=$(DESTDIR)$(package_infodir) depth=$(depth) INSTALLATION_OUT_FILES="$(INFO_INSTALL_FILES)" -f $(stepdir)/install-out.sub.make - -local-install: install-info -local-uninstall: uninstall-info -local-install-info: -local-uninstall-info: -install-info: local-install-info -uninstall-info: local-uninstall-info - -install-info: $(INFO_FILES) - -$(INSTALL) -d $(DESTDIR)$(package_infodir) - $(INFOINSTALL) local-install - -install-info --info-dir=$(infodir) $(outdir)/$(package).info - -uninstall-info: - -install-info --info-dir=$(infodir) --remove $(outdir)/$(package).info - $(INFOINSTALL) local-uninstall - -rmdir $(infodir) diff --git a/stepmake/stepmake/texinfo-targets.make b/stepmake/stepmake/texinfo-targets.make index ecb816f38e..3212c9efa2 100644 --- a/stepmake/stepmake/texinfo-targets.make +++ b/stepmake/stepmake/texinfo-targets.make @@ -1,3 +1,4 @@ +.PHONY : texinfo-all-menus-update default: $(INFO_FILES) @@ -5,7 +6,26 @@ local-WWW: $(addprefix $(outdir)/,$(TEXI_FILES:.texi=.html)) local-doc: $(OUTTXT_FILES) -.PHONY : texinfo-all-menus-update +check-info: texinfo-all-menus-update + +## info stuff +local-install: install-info +local-uninstall: uninstall-info +local-install-info: +local-uninstall-info: +install-info: local-install-info +uninstall-info: local-uninstall-info + +install-info: $(INFO_FILES) + -$(INSTALL) -d $(DESTDIR)$(package_infodir) + $(INFOINSTALL) local-install + -install-info --info-dir=$(infodir) $(outdir)/$(package).info + +uninstall-info: + -install-info --info-dir=$(infodir) --remove $(outdir)/$(package).info + $(INFOINSTALL) local-uninstall + -rmdir $(infodir) + TEXINFO_ALL_MENUS_UPDATE_EL ='\ (let ((error nil)\ @@ -17,8 +37,6 @@ TEXINFO_ALL_MENUS_UPDATE_EL ='\ (save-buffer))))\ ' -check-info: texinfo-all-menus-update - # buffer-modified-p is ALWAYS true, even if there were no actual # changes, so we try setting origal (timestamp) back if there # were no changes. @@ -31,3 +49,5 @@ check-info: texinfo-all-menus-update texinfo-all-menus-update: -$(foreach i, $(TEXINFO_SOURCES), echo q | emacs --batch --no-site-file $(i) --eval $(TEXINFO_ALL_MENUS_UPDATE_EL); ) $(foreach i, $(sort $(TEXINFO_SOURCES)), if diff -u $(i)~ $(i); then mv $(i)~ $(i); fi && ) true + + diff --git a/stepmake/stepmake/texinfo-vars.make b/stepmake/stepmake/texinfo-vars.make index a496060b95..b71c8321b2 100644 --- a/stepmake/stepmake/texinfo-vars.make +++ b/stepmake/stepmake/texinfo-vars.make @@ -12,3 +12,8 @@ GENERATE_OMF = $(PYTHON) $(depth)/buildscripts/texi2omf.py --format $(1) --locat TEXINFO_PAPERSIZE_OPTION= $(if $(findstring $(PAPERSIZE),a4),,-t @afourpaper) MAKEINFO = LANG= $(MAKEINFO_PROGRAM) + +# info stuff +INFO_INSTALL_FILES = $(wildcard $(addsuffix *, $(INFO_FILES))) +INFOINSTALL=$(MAKE) INSTALLATION_OUT_DIR=$(DESTDIR)$(package_infodir) depth=$(depth) INSTALLATION_OUT_FILES="$(INFO_INSTALL_FILES)" -f $(stepdir)/install-out.sub.make + diff --git a/tex/texinfo.tex b/tex/texinfo.tex index 88a09ccb44..a5946dfd5a 100644 --- a/tex/texinfo.tex +++ b/tex/texinfo.tex @@ -2985,547 +2985,7 @@ width0pt\relax} \fi \definedummyword{ae}% \definedummyword{l}% \definedummyword{oe}% - \definedummyword{o}% - \definedummyword{ss}% - % - % Although these internal commands shouldn't show up, sometimes they do. - \definedummyword{bf}% - \definedummyword{gtr}% - \definedummyword{hat}% - \definedummyword{less}% - \definedummyword{sf}% - \definedummyword{sl}% - \definedummyword{tclose}% - \definedummyword{tt}% - % - % Texinfo font commands. - \definedummyword{b}% - \definedummyword{i}% - \definedummyword{r}% - \definedummyword{sc}% - \definedummyword{t}% - % - \definedummyword{TeX}% - \definedummyword{acronym}% - \definedummyword{cite}% - \definedummyword{code}% - \definedummyword{command}% - \definedummyword{dfn}% - \definedummyword{dots}% - \definedummyword{emph}% - \definedummyword{env}% - \definedummyword{file}% - \definedummyword{kbd}% - \definedummyword{key}% - \definedummyword{math}% - \definedummyword{option}% - \definedummyword{samp}% - \definedummyword{strong}% - \definedummyword{uref}% - \definedummyword{url}% - \definedummyword{var}% - \definedummyword{verb}% - \definedummyword{w}% - % - % Assorted special characters. - \definedummyword{bullet}% - \definedummyword{copyright}% - \definedummyword{registeredsymbol}% - \definedummyword{dots}% - \definedummyword{enddots}% - \definedummyword{equiv}% - \definedummyword{error}% - \definedummyword{expansion}% - \definedummyword{minus}% - \definedummyword{pounds}% - \definedummyword{point}% - \definedummyword{print}% - \definedummyword{result}% - % - % Handle some cases of @value -- where it does not contain any - % (non-fully-expandable) commands. - \makevalueexpandable - % - % Normal spaces, not active ones. - \unsepspaces - % - % No macro expansion. - \turnoffmacros -} - - -% \indexnofonts is used when outputting the strings to sort the index -% by, and when constructing control sequence names. It eliminates all -% control sequences and just writes whatever the best ASCII sort string -% would be for a given command (usually its argument). -% -\def\indexdummytex{TeX} -\def\indexdummydots{...} -% -\def\indexnofonts{% - \def\ { }% - \def\@{@}% - % how to handle braces? - \def\_{\normalunderscore}% - % - \let\,=\asis - \let\"=\asis - \let\`=\asis - \let\'=\asis - \let\^=\asis - \let\~=\asis - \let\==\asis - \let\u=\asis - \let\v=\asis - \let\H=\asis - \let\dotaccent=\asis - \let\ringaccent=\asis - \let\tieaccent=\asis - \let\ubaraccent=\asis - \let\udotaccent=\asis - \let\dotless=\asis - % - % Other non-English letters. - \def\AA{AA}% - \def\AE{AE}% - \def\L{L}% - \def\OE{OE}% - \def\O{O}% - \def\aa{aa}% - \def\ae{ae}% - \def\l{l}% - \def\oe{oe}% - \def\o{o}% - \def\ss{ss}% - \def\exclamdown{!}% - \def\questiondown{?}% - % - % Don't no-op \tt, since it isn't a user-level command - % and is used in the definitions of the active chars like <, >, |, etc. - % Likewise with the other plain tex font commands. - %\let\tt=\asis - % - % Texinfo font commands. - \let\b=\asis - \let\i=\asis - \let\r=\asis - \let\sc=\asis - \let\t=\asis - % - \let\TeX=\indexdummytex - \let\acronym=\asis - \let\cite=\asis - \let\code=\asis - \let\command=\asis - \let\dfn=\asis - \let\dots=\indexdummydots - \let\emph=\asis - \let\env=\asis - \let\file=\asis - \let\kbd=\asis - \let\key=\asis - \let\math=\asis - \let\option=\asis - \let\samp=\asis - \let\strong=\asis - \let\uref=\asis - \let\url=\asis - \let\var=\asis - \let\verb=\asis - \let\w=\asis -} - -\let\indexbackslash=0 %overridden during \printindex. -\let\SETmarginindex=\relax % put index entries in margin (undocumented)? - -% Most index entries go through here, but \dosubind is the general case. -% #1 is the index name, #2 is the entry text. -\def\doind#1#2{\dosubind{#1}{#2}{}} - -% Workhorse for all \fooindexes. -% #1 is name of index, #2 is stuff to put there, #3 is subentry -- -% empty if called from \doind, as we usually are (the main exception -% is with most defuns, which call us directly). -% -\def\dosubind#1#2#3{% - \iflinks - {% - % Store the main index entry text (including the third arg). - \toks0 = {#2}% - % If third arg is present, precede it with a space. - \def\thirdarg{#3}% - \ifx\thirdarg\empty \else - \toks0 = \expandafter{\the\toks0 \space #3}% - \fi - % - \edef\writeto{\csname#1indfile\endcsname}% - % - \ifvmode - \dosubindsanitize - \else - \dosubindwrite - \fi - }% - \fi -} - -% Write the entry in \toks0 to the index file: -% -\def\dosubindwrite{% - % Put the index entry in the margin if desired. - \ifx\SETmarginindex\relax\else - \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% - \fi - % - % Remember, we are within a group. - \indexdummies % Must do this here, since \bf, etc expand at this stage - \escapechar=`\\ - \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now - % so it will be output as is; and it will print as backslash. - % - % Process the index entry with all font commands turned off, to - % get the string to sort by. - {\indexnofonts - \edef\temp{\the\toks0}% need full expansion - \xdef\indexsorttmp{\temp}% - }% - % - % Set up the complete index entry, with both the sort key and - % the original text, including any font commands. We write - % three arguments to \entry to the .?? file (four in the - % subentry case), texindex reduces to two when writing the .??s - % sorted result. - \edef\temp{% - \write\writeto{% - \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% - }% - \temp -} - -% Take care of unwanted page breaks: -% -% If a skip is the last thing on the list now, preserve it -% by backing up by \lastskip, doing the \write, then inserting -% the skip again. Otherwise, the whatsit generated by the -% \write will make \lastskip zero. The result is that sequences -% like this: -% @end defun -% @tindex whatever -% @defun ... -% will have extra space inserted, because the \medbreak in the -% start of the @defun won't see the skip inserted by the @end of -% the previous defun. -% -% But don't do any of this if we're not in vertical mode. We -% don't want to do a \vskip and prematurely end a paragraph. -% -% Avoid page breaks due to these extra skips, too. -% -% But wait, there is a catch there: -% We'll have to check whether \lastskip is zero skip. \ifdim is not -% sufficient for this purpose, as it ignores stretch and shrink parts -% of the skip. The only way seems to be to check the textual -% representation of the skip. -% -% The following is almost like \def\zeroskipmacro{0.0pt} except that -% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). -% -\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} -% -% ..., ready, GO: -% -\def\dosubindsanitize{% - % \lastskip and \lastpenalty cannot both be nonzero simultaneously. - \skip0 = \lastskip - \edef\lastskipmacro{\the\lastskip}% - \count255 = \lastpenalty - % - % If \lastskip is nonzero, that means the last item was a - % skip. And since a skip is discardable, that means this - % -\skip0 glue we're inserting is preceded by a - % non-discardable item, therefore it is not a potential - % breakpoint, therefore no \nobreak needed. - \ifx\lastskipmacro\zeroskipmacro - \else - \vskip-\skip0 - \fi - % - \dosubindwrite - % - \ifx\lastskipmacro\zeroskipmacro - % if \lastskip was zero, perhaps the last item was a - % penalty, and perhaps it was >=10000, e.g., a \nobreak. - % In that case, we want to re-insert the penalty; since we - % just inserted a non-discardable item, any following glue - % (such as a \parskip) would be a breakpoint. For example: - % @deffn deffn-whatever - % @vindex index-whatever - % Description. - % would allow a break between the index-whatever whatsit - % and the "Description." paragraph. - \ifnum\count255>9999 \nobreak \fi - \else - % On the other hand, if we had a nonzero \lastskip, - % this make-up glue would be preceded by a non-discardable item - % (the whatsit from the \write), so we must insert a \nobreak. - \nobreak\vskip\skip0 - \fi -} - -% The index entry written in the file actually looks like -% \entry {sortstring}{page}{topic} -% or -% \entry {sortstring}{page}{topic}{subtopic} -% The texindex program reads in these files and writes files -% containing these kinds of lines: -% \initial {c} -% before the first topic whose initial is c -% \entry {topic}{pagelist} -% for a topic that is used without subtopics -% \primary {topic} -% for the beginning of a topic that is used with subtopics -% \secondary {subtopic}{pagelist} -% for each subtopic. - -% Define the user-accessible indexing commands -% @findex, @vindex, @kindex, @cindex. - -\def\findex {\fnindex} -\def\kindex {\kyindex} -\def\cindex {\cpindex} -\def\vindex {\vrindex} -\def\tindex {\tpindex} -\def\pindex {\pgindex} - -\def\cindexsub {\begingroup\obeylines\cindexsub} -{\obeylines % -\gdef\cindexsub "#1" #2^^M{\endgroup % -\dosubind{cp}{#2}{#1}}} - -% Define the macros used in formatting output of the sorted index material. -% @printindex causes a particular index (the ??s file) to get printed. -% It does not print any chapter heading (usually an @unnumbered). -% -\defparsearg\printindex{\begingroup - \dobreak \chapheadingskip{10000}% - % - \smallfonts \rm - \tolerance = 9500 - \everypar = {}% don't want the \kern\-parindent from indentation suppression. - % - % See if the index file exists and is nonempty. - % Change catcode of @ here so that if the index file contains - % \initial {@} - % as its first line, TeX doesn't complain about mismatched braces - % (because it thinks @} is a control sequence). - \catcode`\@ = 11 - \openin 1 \jobname.#1s - \ifeof 1 - % \enddoublecolumns gets confused if there is no text in the index, - % and it loses the chapter title and the aux file entries for the - % index. The easiest way to prevent this problem is to make sure - % there is some text. - \putwordIndexNonexistent - \else - % - % If the index file exists but is empty, then \openin leaves \ifeof - % false. We have to make TeX try to read something from the file, so - % it can discover if there is anything in it. - \read 1 to \temp - \ifeof 1 - \putwordIndexIsEmpty - \else - % Index files are almost Texinfo source, but we use \ as the escape - % character. It would be better to use @, but that's too big a change - % to make right now. - \def\indexbackslash{\rawbackslashxx}% - \catcode`\\ = 0 - \escapechar = `\\ - \begindoublecolumns - \input \jobname.#1s - \enddoublecolumns - \fi - \fi - \closein 1 -\endgroup} - -% These macros are used by the sorted index file itself. -% Change them to control the appearance of the index. - -\def\initial#1{{% - % Some minor font changes for the special characters. - \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt - % - % Remove any glue we may have, we'll be inserting our own. - \removelastskip - % - % We like breaks before the index initials, so insert a bonus. - \penalty -300 - % - % Typeset the initial. Making this add up to a whole number of - % baselineskips increases the chance of the dots lining up from column - % to column. It still won't often be perfect, because of the stretch - % we need before each entry, but it's better. - % - % No shrink because it confuses \balancecolumns. - \vskip 1.67\baselineskip plus .5\baselineskip - \leftline{\secbf #1}% - \vskip .33\baselineskip plus .1\baselineskip - % - % Do our best not to break after the initial. - \nobreak -}} - -% \entry typesets a paragraph consisting of the text (#1), dot leaders, and -% then page number (#2) flushed to the right margin. It is used for index -% and table of contents entries. The paragraph is indented by \leftskip. -% -% A straigtforward implementation would start like this: -% \def\entry#1#2{... -% But this frozes the catcodes in the argument, and can cause problems to -% @code, which set's active ``-''. This problem was fixed by a kludge--- -% ``-'' was active throughout whole index, but this isn't what we really -% want. -% The right solution is to prevent \entry from swallowing the whole text. -% --kasal, 21nov03 -\def\entry{% - \begingroup - % - % Start a new paragraph if necessary, so our assignments below can't - % affect previous text. - \par - % - % Do not fill out the last line with white space. - \parfillskip = 0in - % - % No extra space above this paragraph. - \parskip = 0in - % - % Do not prefer a separate line ending with a hyphen to fewer lines. - \finalhyphendemerits = 0 - % - % \hangindent is only relevant when the entry text and page number - % don't both fit on one line. In that case, bob suggests starting the - % dots pretty far over on the line. Unfortunately, a large - % indentation looks wrong when the entry text itself is broken across - % lines. So we use a small indentation and put up with long leaders. - % - % \hangafter is reset to 1 (which is the value we want) at the start - % of each paragraph, so we need not do anything with that. - \hangindent = 2em - % - % When the entry text needs to be broken, just fill out the first line - % with blank space. - \rightskip = 0pt plus1fil - % - % A bit of stretch before each entry for the benefit of balancing - % columns. - \vskip 0pt plus1pt - % - % Swallow the left brace of the text (first parameter): - \afterassignment\doentry - \let\temp = -} -\def\doentry{% - \bgroup % Instead of the swallowed brace. - \noindent - \aftergroup\finishentry - % And now comes the text of the entry. -} -\def\finishentry#1{% - % #1 is the page number. - % - % The following is kludged to not output a line of dots in the index if - % there are no page numbers. The next person who breaks this will be - % cursed by a Unix daemon. - \def\tempa{{\rm }}% - \def\tempb{#1}% - \edef\tempc{\tempa}% - \edef\tempd{\tempb}% - \ifx\tempc\tempd - \ % - \else - % - % If we must, put the page number on a line of its own, and fill out - % this line with blank space. (The \hfil is overwhelmed with the - % fill leaders glue in \indexdotfill if the page number does fit.) - \hfil\penalty50 - \null\nobreak\indexdotfill % Have leaders before the page number. - % - % The `\ ' here is removed by the implicit \unskip that TeX does as - % part of (the primitive) \par. Without it, a spurious underfull - % \hbox ensues. - \ifpdf - \pdfgettoks#1.\ \the\toksA - \else - \ #1% - \fi - \fi - \par - \endgroup -} - -% Like \dotfill except takes at least 1 em. -\def\indexdotfill{\cleaders - \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} - -\def\primary #1{\line{#1\hfil}} - -\newskip\secondaryindent \secondaryindent=0.5cm -\def\secondary#1#2{{% - \parfillskip=0in - \parskip=0in - \hangindent=1in - \hangafter=1 - \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill - \ifpdf - \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. - \else - #2 - \fi - \par -}} - -% Define two-column mode, which we use to typeset indexes. -% Adapted from the TeXbook, page 416, which is to say, -% the manmac.tex format used to print the TeXbook itself. -\catcode`\@=11 - -\newbox\partialpage -\newdimen\doublecolumnhsize - -\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns - % Grab any single-column material above us. - \output = {% - % - % Here is a possibility not foreseen in manmac: if we accumulate a - % whole lot of material, we might end up calling this \output - % routine twice in a row (see the doublecol-lose test, which is - % essentially a couple of indexes with @setchapternewpage off). In - % that case we just ship out what is in \partialpage with the normal - % output routine. Generally, \partialpage will be empty when this - % runs and this will be a no-op. See the indexspread.tex test case. - \ifvoid\partialpage \else - \onepageout{\pagecontents\partialpage}% - \fi - % - \global\setbox\partialpage = \vbox{% - % Unvbox the main output page. - \unvbox\PAGE - \kern-\topskip \kern\baselineskip - }% - }% - \eject % run that output routine to set \partialpage - % - % Use the double-column output routine for subsequent pages. - \output = {\doublecolumnout}% - % - % Change the page size parameters. We could do this once outside this - % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 - % format, but then we repeat the same computation. Repeating a couple - % of assignments once per index is clearly meaningless for the - % execution time, so we may as well do it in one place. % % First we halve the line length, less a little for the gutter between % the columns. We compute the gutter based on the line length, so it