From 4ac93fe2033005baa7a6d353ca484e573c6dbc73 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 28 May 2020 16:33:16 +0000 Subject: *cwebmac.tex updates from andreas git-svn-id: svn://tug.org/texlive/trunk@55313 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/plain/cweb/cwebbin/Xcwebmac.tex | 8 +-- .../texmf-dist/tex/plain/cweb/cwebbin/dcwebmac.tex | 5 +- .../texmf-dist/tex/plain/cweb/cwebbin/fcwebmac.tex | 6 +- .../texmf-dist/tex/plain/cweb/cwebbin/icwebmac.tex | 3 +- .../tex/plain/cweb/cwebbin/pdfwebtocfront.tex | 79 ++++++++++++++++++++++ 5 files changed, 88 insertions(+), 13 deletions(-) create mode 100644 Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex diff --git a/Master/texmf-dist/tex/plain/cweb/cwebbin/Xcwebmac.tex b/Master/texmf-dist/tex/plain/cweb/cwebbin/Xcwebmac.tex index 056bf230010..c2a8b4115ad 100644 --- a/Master/texmf-dist/tex/plain/cweb/cwebbin/Xcwebmac.tex +++ b/Master/texmf-dist/tex/plain/cweb/cwebbin/Xcwebmac.tex @@ -25,11 +25,11 @@ % Version 3.64 [p20] --- Andreas Scherer, March 2002 % Version 3.64 [p21] --- Andreas Scherer, Octobre 2005 % Version 3.64 [2018] --- Andreas Scherer, Octobre 2018 +% Version 3.64 [2020] --- Andreas Scherer, May 2020 -\ifx\undefined\documentclass\input cwebmac.tex -\else\endinput\fi % LaTeX will use other macros +\ifx\undefined\botofcontents\input cwebmac.tex\fi -\xdef\fmtversion{\fmtversion[2018]} +\xdef\fmtversion{\fmtversion[2020]} \def\Cpp{\CPLUSPLUS/} % for backward compatibility @@ -38,4 +38,4 @@ \def\C#1{\5\5\quad$\triangleright\,${\cmntfont#1}$\,\triangleleft$} \def\SHC#1{\5\5\quad$\diamond\,${\cmntfont#1}} -%\let\K=\leftarrow % "honest" alternative to standard assignment operator +\let\K=\leftarrow % "honest" alternative to standard assignment operator diff --git a/Master/texmf-dist/tex/plain/cweb/cwebbin/dcwebmac.tex b/Master/texmf-dist/tex/plain/cweb/cwebbin/dcwebmac.tex index 564e7a9c84d..d74e5bff025 100644 --- a/Master/texmf-dist/tex/plain/cweb/cwebbin/dcwebmac.tex +++ b/Master/texmf-dist/tex/plain/cweb/cwebbin/dcwebmac.tex @@ -28,10 +28,9 @@ % Version 3.64 [p21] --- Andreas Scherer, Octobre 2005 % Version 3.64 [p22] --- Andreas Scherer, March 2016 -\ifx\undefined\documentclass\input Xcwebmac.tex -\else\endinput\fi % LaTeX will use other macros +\ifx\undefined\botofcontents\input cwebmac.tex\fi -\input dcwebstrings.tex +\input dcwebstrings.tex % German translations for some tags and strings \def\.#1{\leavevmode\hbox{\tentex % typewriter type for strings \ifx\Cstringchars\undefined\else\Cstringchars\fi % special string characters diff --git a/Master/texmf-dist/tex/plain/cweb/cwebbin/fcwebmac.tex b/Master/texmf-dist/tex/plain/cweb/cwebbin/fcwebmac.tex index 3e0892eb091..dde54141b16 100644 --- a/Master/texmf-dist/tex/plain/cweb/cwebbin/fcwebmac.tex +++ b/Master/texmf-dist/tex/plain/cweb/cwebbin/fcwebmac.tex @@ -30,8 +30,7 @@ % french translations --- Denis Roegel, 18 September 1994 -\ifx\undefined\documentclass\input Xcwebmac.tex -\else\endinput\fi % LaTeX will use other macros +\ifx\undefined\botofcontents\input cwebmac.tex\fi \def\.#1{\leavevmode\hbox{\tentex % typewriter type for strings \ifx\Cstringchars\undefined\else\Cstringchars\fi % special string characters @@ -50,8 +49,7 @@ \def\ATH{{\acrofalse\X\kern-.5em:D\'efinitions du pr\'eprocesseur\X}} \def\A{\note{Voir aussi la section}} % xref for doubly defined section name -\def\As{\note{Voir aussi les sections}} % xref for multiply defined - % section name +\def\As{\note{Voir aussi les sections}} % xref for multiply defined section name \def\ET{ et~} % conjunction between two section numbers \def\ETs{ et~} % conjunction between the last two of several section numbers diff --git a/Master/texmf-dist/tex/plain/cweb/cwebbin/icwebmac.tex b/Master/texmf-dist/tex/plain/cweb/cwebbin/icwebmac.tex index 7d605c9fe42..6fcafb9e6d7 100644 --- a/Master/texmf-dist/tex/plain/cweb/cwebbin/icwebmac.tex +++ b/Master/texmf-dist/tex/plain/cweb/cwebbin/icwebmac.tex @@ -28,8 +28,7 @@ % Version 3.64 [p21] --- Andreas Scherer, Octobre 2005 % Version 3.64 [p22] --- Andreas Scherer, March 2016 -\ifx\undefined\documentclass\input Xcwebmac.tex -\else\endinput\fi % LaTeX will use other macros +\ifx\undefined\botofcontents\input cwebmac.tex\fi \def\.#1{\leavevmode\hbox{\tentex % typewriter type for strings \ifx\Cstringchars\undefined\else\Cstringchars\fi % special string characters diff --git a/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex b/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex new file mode 100644 index 00000000000..49e5f5b288a --- /dev/null +++ b/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex @@ -0,0 +1,79 @@ +% pdfwebtofront.tex +% Code from knuth.drv in https://github.com/oberdiek/latex-tds +% 2020/05/21 v1.0 by Andreas Scherer. +% +% This file is part of project https://github.com/ascherer/cwebbin +% and may be distributed under the MIT License or the LaTeX Project +% Public License. +% +% Move table-of-contents page to the front in PDF output. +% Works with pdftex and xetex in connection with either 'webmac.tex' +% for Pascal/WEB programs or 'cwebmac.tex' for C/CWEB programs. +% +\ifx\detokenize\undefined\endinput\fi +\def\contentsfile{\jobname.toc} % file that gets table of contents info +\def\readcontents{\input \contentsfile} +\newread\testread +\openin\testread=\contentsfile\relax +\ifeof\testread % First run +\else % Second run + % Redefine '\con' to be invoked before the first '\N' (starred section). + \let\ORGcon\con + \def\con{% + \def\:{\par\hangindent 2em} % Fix for 'bibtex.web'. + % reduce size of PDF pages for more screen space + \pdfpagewidth=\pagewidth \advance\pdfpagewidth by 2cm + \pdfpageheight=\pageheight \advance\pdfpageheight by 3cm + \ifpdftex \pdfhorigin=1cm \pdfvorigin=1cm + \else \advance\pdfpageheight by 1cm \global\pageshift=-1.54cm + \global\hoffset=-1.54cm \global\voffset=-1.54cm \fi + \begingroup + \let\end\relax + \ORGcon + % let's start with section '1', the 'Introduction'. + \ifx\undefined\grouptitle \mark{1} % WEB + \else \mark{{{\tensy x}1}0{Introduction}}\fi % CWEB + \eject % set '\botmark' on TOC, hence '\topmark' on next page. + \endgroup + \let\con\end + }% + % Redefine '\N’ to invoke redefined '\con' before switching back + % to original '\N'. + \expandafter\let\csname ORGN\expandafter\endcsname + \csname N\endcsname + \expandafter\outer\expandafter\def\csname N\endcsname{% + \con + \expandafter\let\csname N\expandafter\endcsname + \csname ORGN\endcsname + \csname N\endcsname + }% + % Special variant of the above for 'mf.web' and 'tex.web'. They put + % their tables-of-contents on a sparce 'page 2' and start on page '3'. + \begingroup + \def\num{0}% + \edef\x{\jobname}% + \edef\y{\detokenize{tex}}% + \ifx\x\y \def\num{1}\else + \edef\y{\detokenize{mf}}% + \ifx\x\y \def\num{1}\else + \edef\y{\detokenize{pdftex}}% + \ifx\x\y \def\num{1}\else + \edef\y{\detokenize{xetex}}% + \ifx\x\y \def\num{1}\fi\fi\fi\fi + \expandafter\endgroup\ifnum\num=1 % + \def\contentspagenumber{2}% + \let\ORGpageno\pageno + \def\pageno{% + \let\pageno\ORGpageno + \expandafter\let\csname ORGN\expandafter\endcsname + \csname N\endcsname + \expandafter\outer\expandafter\def\csname N\endcsname{% + \con + \expandafter\let\csname N\expandafter\endcsname + \csname ORGN\endcsname + \csname N\endcsname + }% + \pageno + }% + \fi +\fi -- cgit v1.2.3