The EverySel package

Similar documents
The EverySel package

The everyshi package

The count1to package

The totpages package

The stdclsdv package

The BibTopicPrefix-package

altfont: Using alternative fonts

The ragged2e-package

The mhsetup package. 1 The new internal syntax. 2 Handling optional arguments. Morten Høgholm 2007/12/03

Martin Scharrer Version v /09/19

Version v2.01, 2000/06/29

The L A TEX3 Programming Language A syntax proposal for TEX macro programming

The hypbmsec package

The textcase package

The mathstyle package

mylatexformat Use mylatexformat to make a format based on the preamble of any LaTeX file 2011/02/12 version 3.4

The isodateo package

The onlyamsmath package

The tensor package for L A TEX2e

The ushort package. Martin Väth 2013/11/26

The filecontents package

L A TEX Support For T-26 Divine Font

pgfopts LaTeX package options with pgfkeys

multidef: quick definition of multiple similar L A TEX macros

1 The Czech Language. 1.1 Usage. 1.2 Compatibility

The showkeys package

M. R. C. van Dongen. ucc. LaTEX and Friends. Commands and Environments. Marc van Dongen

The alphalph package

The selinput package

mnotes annotate documents with margin comments

The currency package

The lstautogobble Package

The cybercic package

The nbaseprt package

The svn-prov package

The showkeys package

Package mathcmd. F. Bosisio 1997/12/20

FiNK the L A TEX2ε File Name Keeper

The pagenote package

The xargs package. Manuel Pégourié-Gonnard v1.1 (2008/03/22) 1 Introduction 1. 2 Usage 1

The currency package

Production of solution sheets in L A TEX 2ε

European Computer Modern font with oldstyle digits

Producing proceedings articles with L A TEX2ε

The mcaption package

Jonathan Zachhuber Michael Fü erer Version v., / /

The multicap L A TEX2ε package

The ifplatform package

The cjwoutl Package. Contents. Introduction. Colin J. Wynne 1996/04/26. 1 Making an Outline Outline Labels Cross References...

volumes.sty: Support for Printing of only parts of a LaTeX document, with complete indices etc.

fnlineno.sty Numbering Footnote Lines

Omit passages optionally under L A TEX. Uwe Lück 2005/04/28

The trace package. Frank Mittelbach 2014/10/28

PDCFSEL, a font-selection scheme for TEX

The newunicodechar package

Section name references in L A TEX

Manuscript A Package Emulating Typewriter Typesetting

The keyval package. David Carlisle 2014/10/28

Peter Wilson Catholic University of America Now at 1999/02/13

The moderntimeline package

The lips LaTeX package Chicago Manual text ellipses (Frankenstein s lips)

qstest, a L A TEX package for unit tests

The bigintcalc package

1 The Slovak language

Package backrefx. (Enhancements for backref)

The fltpoint package

The selinput package

This package allows you to add version control information as a gray watermark on each page of your document.

The eqlist package. Martin Väth 2002/08/15. Abstract

qstest.sty QuinScape Unit Test Package version

The optparams package

Implementation of Forest, a pgf/tik Z-based package for drawing linguistic trees

The KOMA- Script package tocstyle

glossaries-extra.sty v1.38: documented code

The showlabels package

The calc package Infix notation arithmetic in L A TEX

The shortlst Package

The protecteddef package

The thepdfnumber package

Preparing FP7 Proposals in L A TEX with eurpoposal.cls

The hanging package. Contents. 1 Introduction

4.1 Handling the font tables Fonts for math Special considerations Preliminary macros. 6 Macros for setting up the tables

The tabularx package

New Multibibliography Package

The tabularx package

The jvlisting package

The bnumexpr package

The abstract package

The listingsutf8 package

The multibib Package

Fancy paragraph designs with the fancypar package

The pdfcrypt package

The mathstyle package. Morten Høgholm 2008/08/13 v0.86

Fancy Cross-referencing

Language Information in Structured Documents: A Model for Mark-up and Rendering

Purely expandable boolean expressions and switch (ε-t E X). 2010/04/15 v3.14

v2.1, dated 2014/03/04.

The export package. Jean-Pierre F. Drucbert 2000/10/16

The pdflscape package

The extdash package. Alexander I. Rozhenko 2018/06/24

Transcription:

The EverySel package Martin Schröder Crüsemannallee 3 D-28213 Bremen Martin.Schroeder@ACM.org PGP-Key: 2048 bit / KeyID 292814E5 7E86 6EC8 97FA 2995 82C3 FEA5 2719 090E 1999/06/08 Abstract This packages provides hooks into the NFSS-command \selectfont called \EverySelectfont and \AtNextSelectfont analogous to \AtBeginDocument. Contents 1 Introduction 1 2 Usage 1 3 Options 2 4 Required packages 2 5 The implementation 2 5.1 Allocations.... 2 5.2 The user-visible commands..... 2 5.3 Inserting the hooks 2 6 Acknowledgements 4 1 Introduction This package provides the hooks \EverySelectfont and \AtNextSelectfont whose arguments are executed just after L A TEX has loaded a new font using \selectfont (which means that it will be executed after every font loaded via NFSS). An example application would be a package for setting ragged text which needs to distiguinsh between monospaced and proportional fonts. Such a package exists: ragged2e[2]. 2 Usage \EverySelectfont \EverySelectfont{ code } declares code that is saved internally and executed just after each \selectfont. The version number of this file is v1.03, last revised 1999/06/08. The name EverySel is a tribute to the 8 + 3 file-naming convention of certain operating systems and their file systems ; strictly speaking it should be Every- Selectfont. 1

3 OPTIONS 2 \AtNextSelectfont Warning: The code is saved globally; there is currently no way to remove it. \AtNextSelectfont{ code } declares code that is saved internally and executed just after and only the next \selectfont. Repeated use of the commands is permitted: the code in their argument is stored (and executed) in the order of their declarations. The argument of \AtNextSelectfont is executed after the argument of \EverySelectfont. 3 Options The package has no options. 4 Required packages The package requires no further packages. 5 The implementation \@EverySelectfont@EveryHook \@EverySelectfont@AtNextHook \EverySelectfont \AtNextSelectfont 1 package 5.1 Allocations First we allocate the hooks Thecodetobeexecutedjustafterthenormal\selectfont. 2 \newcommand{\@everyselectfont@everyhook}{} Thecodetobeexecutedjustafterthenormal\selectfont and \@EverySelectfont@EveryHook. 3 \newcommand{\@everyselectfont@atnexthook}{} 5.2 The user-visible commands These commands are modeled after \AtBeginDocument. 4 \newcommand*{\everyselectfont}[1] 5 {\g@addto@macro\@everyselectfont@everyhook{#1}} 6 \newcommand*{\atnextselectfont}[1] 7 {\g@addto@macro\@everyselectfont@atnexthook{#1}} 5.3 Inserting the hooks The hooks are placed inside \selectfont. Unfortunately for us there are two versions of \selectfont in normal L A TEX: One is defined in the kernel and the other by the package tracefnt[1]. So we have to check for two versions.

5 THE IMPLEMENTATION 3 \@EverySelectfont@Init We do this in the macro \@EverySelectfont@Init, which is executed just after \begin{document} (with the aid of \AtBeginDocument), when we know for sure which version of \selectfont we have to overload. 8 \newcommand*{\@everyselectfont@init}{% We have to distinguish two cases: tracefnt and no tracefnt. 9 \@ifpackageloaded{tracefnt}{% And we have a problem: \selectfont is defined using \DeclareRobustCommand, which really defines \selectfont.so instead of simply using \CheckCommand we also have to use \expandafter and \csname...\endcsname. 10 \expandafter\checkcommand\csname selectfont \endcsname{% 11 \ifx\f@linespread\baselinestretch \else 12 \set@fontsize\baselinestretch\f@size\f@baselineskip \fi 13 \xdef\font@name{% 14 \csname\curr@fontshape/\f@size\endcsname}% 15 \pickup@font 16 \font@name 17 \ifnum \tracingfonts>\tw@ 18 \@font@info{switching to \font@name}\fi 19 \size@update 20 \enc@update 21 }% 22 }{% Now the case without tracefnt. 23 \expandafter\checkcommand\csname selectfont \endcsname{% 24 \ifx\f@linespread\baselinestretch \else 25 \set@fontsize\baselinestretch\f@size\f@baselineskip \fi 26 \xdef\font@name{% 27 \csname\curr@fontshape/\f@size\endcsname}% 28 \pickup@font 29 \font@name 30 \size@update 31 \enc@update 32 }% 33 }% After the checks we can be sure we have the correct version of \selectfont, so we redefine it with our hooks. 34 \DeclareRobustCommand{\selectfont}% 35 {% 36 \ifx\f@linespread\baselinestretch \else 37 \set@fontsize\baselinestretch\f@size\f@baselineskip \fi 38 \xdef\font@name{% 39 \csname\curr@fontshape/\f@size\endcsname}% 40 \pickup@font 41 \font@name 42 \@EverySelectfont@EveryHook 43 \@EverySelectfont@AtNextHook We have to reset \@EverySelectfont@AtNextHook after each use. 44 \gdef\@everyselectfont@atnexthook{}%

6 ACKNOWLEDGEMENTS 4 45 \size@update 46 \enc@update 47 }% The additions of tracefnt to \selectfont can be implemented using \EverySelectfont. 48 \@ifpackageloaded{tracefnt}{% 49 \EverySelectfont{% 50 \ifnum \tracingfonts>\tw@ 51 \@font@info{switching to \font@name}\fi}% 52 }{}% Since \@EverySelectfont@Init should only be used once it is self-destructing. 53 \let\@everyselectfont@init\undefined 54 } Finally we insert \EverySelectfont@Init into \begin{document}. 55 \AtBeginDocument{\@EverySelectfont@Init} 56 /package 6 Acknowledgements David Carlisle provided the solution for my problems with \CheckCommand. References [1] Frank Mittelbach and Rainer Schöpf. The tracefnt package for use with the new font selection scheme. CTAN:tex-archive/macros/latex/base/ltfsstrc.dtx. L A TEX2ε package. [2] Martin Schröder. The ragged2e package. CTAN:tex-archive/ macros/latex/contrib/supported/ms/ragged2e.dtx. L A TEX2ε package. Index Numbers written in italic refer to the page where the corresponding entry is described, the ones underlined to the code line of the definition, the rest to the code lines where the entry is used. Symbols \@EverySelectfont@AtNextHook... 3, 7, 43, 44 \@EverySelectfont@EveryHook... 2,5,42 \@EverySelectfont@Init... 8 \@font@info... 18,51 \@ifpackageloaded... 9,48 A \AtBeginDocument... 55 \AtNextSelectfont... 2, 4 B \baselinestretch....... 11, 12, 24, 25, 36, 37

Change History 5 C \CheckCommand... 10,23 \csname... 10,14,23,27,39 \curr@fontshape... 14,27,39 D \DeclareRobustCommand... 34 E \else... 11,24,36 \enc@update... 20,31,46 \endcsname.. 10, 14, 23, 27, 39 \EverySelectfont... 1, 4,49 \expandafter... 10,23 F \f@baselineskip... 12,25,37 \f@linespread... 11,24,36 \f@size... 12, 14, 25, 27, 37, 39 \fi... 12,18,25,37,51 \font@name... 13, 16, 18, 26, 29, 38, 41, 51 G \g@addto@macro... 5,7 \gdef... 44 I \ifnum... 17,50 \ifx... 11,24,36 L \let... 53 N \newcommand... 2 4, 6, 8 P \pickup@font... 15,28,40 S \selectfont... 34 \set@fontsize... 12,25,37 \size@update... 19,30,45 T \tracingfonts... 17,50 \tw@... 17,50 U \undefined... 53 X \xdef... 13,26,38 Change History v1.00 General:New... 1 v1.01 General: Fixed use of \newline intitle.... 1 v1.02 General: Minor documentationenhancements... 1 v1.03 General: Moved to LPPL.. 1