@c This file contains texinfo.tex modifications needed to print the 
@c Cygnus manuals. See end of file for further AdaCore-specific modifications.
@c Add "@input texiplus" as second line to your *.texi file to use this.

@c The actual page size is 7.5x9in, cut to this size after printing
@c on A4 (default) or US Letter (when \forletterpaper is defined) paper.

@c Use the following command lines to generate PDF for printing:
@c pdftex '\let\forprinting=1\input document.texi'
@c   (A4 paper)
@c pdftex '\let\forprinting=1\let\forletterpaper=1 \input document.texi'
@c   (letter paper)

@tex
%% Cygnus revisions to texinfo.tex, TeX macros to handle texinfo files
%   Copyright (C) 1991 Free Software Foundation, Inc.

%This texiplus.tex file is free software; you can redistribute it and/or
%modify it under the terms of the GNU General Public License as
%published by the Free Software Foundation; either version 1, or (at
%??? GPL notice has been truncated

{\let\fsfvn=\texinfoversion
\xdef\texinfoversion{\fsfvn\ (Cygnus+WRS)}}
\message{Loading Cygnus texinfo revisions [\texinfoversion]:}

% Print the version number if in a .fmt file.
\everyjob{\message{[Cygnus Texinfo \texinfoversion]}}

\globaldefs=1 % Escape the bounds of @tex/@end tex surrounding us

\newif\ifdraft\drafttrue % Extra markings; turn off with @finalout

% There are only two small changes to standard \title from texinfo 
% (1) to include DRAFT marking on title page unless @finalout
% (2) to include a title-sized \tt font
% However, since \title is local to \titlepage, we have to redefine
% *that* whole damned thing.  
%%%%%%%%%%This is sensitive to conflict w/FSF changes!****************
\envdef\titlepage{\begingroup \parindent=0pt \textfonts
   \let\subtitlerm=\tenrm
% I deinstalled the following change because \cmr12 is undefined.
% This change was not in the ChangeLog anyway.  --rms.
%   \let\subtitlerm=\cmr12
   \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
   %
   \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
   %
   % Leave some space at the very top of the page.
   \vglue\titlepagetopglue
   %
   % Now you can print the title using @title.
   \def\title{\parsearg\titlezzz}%
%changes from FSF only in following line:
   \def\titlezzz##1{{\let\tentt=\titlett
                    \leftline{\titlefont{##1\ifdraft\hfill DRAFT\fi }}}
%end real changes from FSF version
		    % print a rule at the page bottom also.
		    \finishedtitlepagefalse
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The ``width \hsize'' below should be unnecessary, since the rule is
% supposed to default to the smallest enclosing box...but *something*
% in texiplus breaks that default, so we force it to hsize.
		    \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   % No rule at page bottom unless we print one at the top with @title.
   \finishedtitlepagetrue
   %
   % Now you can put text using @subtitle.
   \def\subtitle{\parsearg\subtitlezzz}%
   \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
   %
   % @author should come last, but may come many times.
   \def\author{\parsearg\authorzzz}%
   \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
      {\authorfont \leftline{##1}}}%
   %  
   % Most title ``pages'' are actually two pages long, with space
   % at the top of the second.  We don't want the ragged left on the second.
   \let\oldpage = \page
   \def\page{%
      \iffinishedtitlepage\else
	 \finishtitlepage
      \fi
      \oldpage
      \let\page = \oldpage
      \hbox{}}%
%   \def\page{\oldpage \hbox{}}
}
\def\finishtitlepage{%
% same comment re ``width \hsize'' as on last hrule...
   \vskip4pt \hrule width \hsize height 2pt
   \vskip\titlepagebottomglue
   \finishedtitlepagetrue
}
%%%%%%%%%%end sensitive to conflict w/FSF changes!********************

% Cygnus uses different default page headings and footers
\def\leadline{\ \leaders\hrule height 2.5pt depth -2pt\hfil\ }
\def\manvers{}% Empty default version in case manual doesn't supply
% This is for _explicitly_ turning headers off.  Note that we're more
% literal-minded than the FSF: we don't turn off _footers_!  This
% means that, unlike with the FSF macros, our ``@headings off'' do not
% return to the default Texinfo heading-state of the document.
% Reconsider if this gives trouble...
\def\HEADINGSoff{
\global\evenheadline={\hfil}
\global\evenfootline={\line{\let\,\leadline\manvers}}
\global\oddheadline={\hfil}
\global\oddfootline={\line {\let\,\leadline\manvers}}}
% SINGLEPAGE:
\def\HEADINGSsingle{
\global\pageno=1\HEADINGSsinglex}
\def\HEADINGSsinglex{
\global\evenfootline={%
\leadline\manvers}
\global\oddfootline={%
\leadline\manvers}
\global\evenheadline={\ftfnt\thischapter\leadline
		\ifdraft DRAFT\leadline\fi
		\bf\folio}
\global\oddheadline={\ftfnt\thischapter\leadline
		\ifdraft DRAFT\leadline\fi
		\bf\folio}
}
%
% DOUBLEPAGE:
% use hrule leaders to delimit headings, footings from
%               body; timestamp footer; pagenos outside *bottom* to
%               permit moving chaptername to outside *top* (for easier
%               skimming).  1990 dec 31, pesch@cygnus.com
\def\HEADINGSdouble{
\global\pageno=1\HEADINGSdoublex}
\def\HEADINGSdoublex{
\global\evenfootline={%
{\bf\folio}\ftfnt\leadline\ifdraft DRAFT\quad\fi
\ftfnt\manvers\kern 0pt
}
\ifx\specialOddFootline\undefined
\global\oddfootline={%
\leadline{\bf\folio}%
}
\else
\global\oddfootline=\specialOddFootline
\fi
\global\evenheadline={\ftfnt\thistitle\leadline\ifdraft DRAFT\fi}
\global\oddheadline={\rm\leadline\thischapter}
}

% CHANGE to @finalout ---also use it to remove DRAFT markings from
% title, footers
%% For a final copy, take out the rectangles
%% that mark overfull boxes (in case you have decided
%% that the text looks ok even though it passes the margin).
\def\finalout{\overfullrule=0pt
%% Also take out ``DRAFT'' markings
	\global\draftfalse
			}

%Font overrides; we use PostScript when possible.
\font\textrm=pncr scaled \magstephalf
\font\texttt=pcrr
\font\textbf=pncb scaled \magstephalf 
\font\textit=pncri scaled \magstephalf
\font\textsl=pcrro
\font\textsf=pncr at 9.5pt
% FIXME: figure out, test dvips smallcaps kluge
%\font\textsc=Times-SmallCaps scaled \magstephalf
\font\ftfnt=phvr at 8pt % Cygnus Support footer-font

\font\defbf=pncb scaled \magstep1 %was 1314

\font\ninett=pcrr at 9pt
\let\indtt=\ninett
\font\indrm=pncr at 9pt
\font\indit=pncri at 9pt
\font\indsl=pcrro at 9pt
\let\indsf=\indrm
\let\indbf=\indrm
\let\indsc=\indrm

\font\chaprm=pncb at 17pt
\font\chapit=pncbi at 17pt
\font\chapsl=pcrbo at 16pt
\font\chaptt=pcrb at 16pt
\font\chapsf=pncr at 16pt
\let\chapbf=\chaprm
% \chapfonts mod from FSF vn is to include baselineskip, for the few
% cases where a title chapter overflows its line.
\def\chapfonts{\baselineskip=19pt%
  \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl 
  \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
  \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
  \resetmathfonts}


\font\secrm=pncb at 14pt
\font\secit=pncbi at 14pt
\font\secsl=pcrbo at 13pt
\font\sectt=pcrb at 13pt
\font\secsf=pncr at 13pt
\font\secbf=pncb at 14pt

\font\ssecrm=pncr at 13pt
\font\ssecit=pncri at 13pt
\font\ssecsl=pcrro at 12pt
\font\ssectt=pcrr at 12pt
\font\ssecsf=pncr at 12pt
\font\ssecbf=pncb at 13pt

\font\titlerm=pncb at 21pt
\font\titlett=pcrr at 20pt
\font\authorrm=pncr scaled \magstep2

\font\truesecrm=pncr at 12pt

% Fonts for short table of contents
\font\shortcontrm=pncr at 12pt 
\font\shortcontbf=pncb at 12pt 
\font\shortcontsl=pncri at 12pt

% \smartitalic{ARG} outputs arg in italics, followed by an italic correction
% unless the following character is such as not to need one.
\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
\def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx}
% \smartitalic is used for @emph; FSF keeps trying to make it match
% @var.
%
% \smartslant{ARG} outputs arg in a slanted font, followed by an
% italic correction unless the following character is such as not to need one.
\def\smartslantx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
\def\smartslant#1{{\sl #1}\futurelet\next\smartslantx}

\let\i=\smartitalic
\let\var=\smartslant
\let\dfn=\smartitalic
\let\emph=\smartitalic
\let\cite=\smartitalic

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \widen: let examples (or whatever) fall into margins.  Symmetric.  Cancel
% ``@widen{N}'' with ``@widen{-N}''.
\newdimen\extra\extra=0pt % for ``widen''
\global\def\widen#1{\advance\extra by #1%
\advance\leftskip by -#1\advance\rightskip by -#1}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ONLY INTENDED CHANGES from FSF smallbook: tolerance and page centering
% Use @smallbook to reset parameters for 7x9.5 format  (or else 7x9.25)
\def\smallbook{

% These values for secheadingskip and subsecheadingskip are
% experiments.  RJC 7 Aug 1992
\global\secheadingskip = 17pt plus 6pt minus 3pt
\global\subsecheadingskip = 14pt plus 6pt minus 3pt

\global\lispnarrowing = 0.3in
\setleading{12pt}
\advance\topskip by -1cm
\global\parskip 3pt plus 1pt
\global\hsize = 5in
%\advance\normaloffset by .75in % half of difference from 6.5in default hsize
\advance\normaloffset by 1in % half of difference from 6.5in default
			     % hsize, plus .25 in to get wider gutter
			     % for WRS pagesize
\global\vsize=7.5in
\advance\voffset by .7in % half of difference from 8.9in default vsize
\global\tolerance=1400
\global\hfuzz=1pt
\global\contentsrightmargin=0pt

\global\pagewidth=\hsize
\global\pageheight=\vsize

}
\textfonts

\globaldefs=0 % this is NOT redundant; the \endgroup done by@end tex
	      % would restore the value, but before doing that would
	      % screw up if globaldefs=1 were allowed to remain here.
@end tex

@rm
@c @smallbook
@c some manuals (notably as) contain stuff that only looks good in
@c smallbook; this switch controls its appearance, by local convention
@set SMALL

@c At WRS, texinfo-format books are most often collected in a
@c compilation, which prints the GPL and copyright statement placed to
@c apply to the work as a whole.  The following conditional can be used
@c to suppress such material when printing the individual books;
@c because the default for variables is unset, people who reformat the
@c separate books on their own will still get the required sections
@c (such as GPL) and copyright/license info by default.
@set COMPILATION

@c AdaCore specific stuff starts here
@tex
%
% \adacorebook
% Page layout for AdaCore manuals: 7.5in x 9in printed on A4 or letter paper
%
\newdimen\ACpaperheight
\newdimen\ACpaperwidth
%
\gdef\adacorebook{{\globaldefs=1
  \parskip = 2pt plus 1pt
  \textleading = 12pt
%
\ifx\forletterpaper\undefined
  % Default: A4
  \ACpaperheight=297mm
  \ACpaperwidth=210mm
\else
  % Alternate: Letter
  \ACpaperheight=11in
  \ACpaperwidth=8.5in
\fi

% Parameters in order: 1) pageheight; 2) pagewidth; 3) voffset;
% 4) normaloffset; 5) binding offset; 6) topskip; 7) physical page height; 8)
% physical page width.

  \internalpagesizes{7in}{5.5in}%
                    {-1in}{-1in}%
                    {\bindingoffset}%
                    {1.5\baselineskip}%
                    {\ACpaperheight}{\ACpaperwidth}%
  %
  % voffset has been initialized to cancel out the standard 1in offset.
  % Provision for top margin and magic constant from makeheadline (22.5pt)
  % yielding final value:
  %    voffset = topmargin + 22.5pt - 1in
  % (here we use 2\baselineskip as the top margin).
  %
  \advance\voffset by 2\baselineskip
  \advance\voffset by 22.5pt
  %
  %
  % normaloffset has been initialized to cancel out the standard 1in offset.
  % Adjust it for proper even/odd overlap, yielding final value:
  %    normaloffset = (paperwidth - pagewidth) / 2 - 1in
  %
  \advance\normaloffset by 0.5\ACpaperwidth
  \advance\normaloffset by -0.5\pagewidth
  %
  \lispnarrowing = 0.3in
  \tolerance = 700
  \hfuzz = 1pt
  \contentsrightmargin = 0pt
  \defbodyindent = .5cm
}}
%% Add some room between page text and footer
\gdef\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}\vskip 5mm}

%% Provision for printing manuals: set PDF link color to black
\ifx\forprinting\undefined
 \message{Generating PDF/DVI for display}
 \relax
\else
 \message{Generating PDF for printing (links are in black)}
 \global\let\linkcolor=\Black
\fi
@end tex
@adacorebook

@c Suppress black markers in overfull hboxes
@finalout
