• No results found

The gobble Package

N/A
N/A
Protected

Academic year: 2021

Share "The gobble Package"

Copied!
9
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

The

gobble

Package

Martin Scharrer

martin@scharrer-scharrer.de

CTAN:

http://www.ctan.org/pkg/gobble

VC:

https://bitbucket.org/martin_scharrer/gobble

Version v0.2 – 2019/01/04

Abstract

ThegobbleLATEX package provides more macros to discard (gobble) macro

arguments. These macros are by default only for package and class writers, but are exported to the user level by thegobble-userpackage. The macros are also available as generic packages for other TEX formats.

1 Macros

1.1 Macros for Package/Class Writers

The following macros are provided by the genericgobble.texand the LATEX package

gobble. Some are already provided by the LATEX kernel. \@gobble

\@gobbletwo \@gobblethree \@gobblefour

Gobbles one, two, three or four mandatory arguments.

\@gobbleopt \@gobbletwoopt \@gobbleallopt

Gobbles one, two or all found optional arguments if present.

\@gobbletwoopttwo

(2)

\@firstofone

Reads one argument and expands to it, i.e. removes the braces around it.

\@firstoftwo

Reads two arguments and expands to the first one while discarding the second one.

\@secondoftwo

Reads two arguments and expands to the second one while discarding the first one.

\@firstofthree \@secondofthree \@thirdofthree

These macros read three arguments and expand to the first, second or third one, respectively, while discarding the other.

\@gobbletofi{〈code〉}〈discarded code〉\fi \@gobbletoelse{〈code〉}〈discarded code〉\else \@gobbletoor{〈code〉}〈discarded code〉\or

These macros read one argument and then gobble everything to the next\fi,\else

or\or, respectively. Afterwards they expand to the first argument. This allows to

break out of an\if.. or\ifcasebranch, which is sometimes required if code

should be executed after the conditional.

1.2 User Level Macros

The following macros are provided by the genericgobble-user.texand the LATEX

packagegobble-user. These also load thegobble.texfile or packagegobble

package, respectively.

They macros are identical to the corresponding versions with the leading ‘@’, but

can be used freely in a user document.

(3)
(4)

2 Implementation

1 % <! C O P Y R I G H T > 2 \ N e e d s T e X F o r m a t { L a T e X 2 e } [ 1 9 9 9 / 1 2 / 0 1 ] 3 \ P r o v i d e s P a c k a g e { g o b b l e }[% 4 % <! DATE > 5 % <! VERSION > 6 % <* DRIVER > 7 2 0 9 9 / 0 1 / 0 1 d e v e l o p 8 % </ DRIVER > 9 P r o v i d e s m o r e g o b b l e m a c r o s ] 10 \ i n p u t { g o b b l e } 11 % <! C O P Y R I G H T > 12 \ N e e d s T e X F o r m a t { L a T e X 2 e } [ 1 9 9 9 / 1 2 / 0 1 ] 13 \ P r o v i d e s P a c k a g e { gobble - u s e r }[% 14 % <! DATE > 15 % <! VERSION > 16 % <* DRIVER > 17 2 0 9 9 / 0 1 / 0 1 d e v e l o p 18 % </ DRIVER > 19 P r o v i d e s u s e r l e v e l m a c r o s ] 20 \ R e q u i r e P a c k a g e { g o b b l e } 21 \ i n p u t { gobble - u s e r } 22 \ e x p a n d a f t e r \ ifx \ c s n a m e g o b b l e . tex l o a d e d \ e n d c s n a m e \. r e l a x 23 \ e x p a n d a f t e r \ def \ c s n a m e g o b b l e . tex l o a d e d \. e n d c s n a m e {1}% 24 \ e l s e 25 \ e x p a n d a f t e r \ e n d i n p u t 26 \ fi \gobbletex@catcode 27 \ e x p a n d a f t e r \ e d e f \ c s n a m e g o b b l e t e x @ c a t c o d e \ e n d c s n a m e {. %

28 \ catcode ‘\ n o e x p a n d \ @ =\ the \ catcode ‘\ @% 29 }%

(5)
(6)
(7)

\@secondoftwo 71 \ l o n g \ def \ @ f i r s t o f t w o # 1 # 2 { # 1 }% 72 \ l o n g \ def \ @ s e c o n d o f t w o # 1 # 2 { # 2 }% \@firstofthree \@secondofthree \@thirdofthree 73 \ l o n g \ def \ @ f i r s t o f t h r e e # 1 # 2 # 3 { # 1 }% 74 \ l o n g \ def \ @ s e c o n d o f t h r e e # 1 # 2 # 3 { # 2 }% 75 \ l o n g \ def \ @ t h i r d o f t h r e e # 1 # 2 # 3 { # 3 }% \@gobbletofi \@gobbletoelse \@gobbletoor 76 \ l o n g \ def \ @ g o b b l e t o f i # 1 # 2 \ fi {\ fi #1}% 77 \ l o n g \ def \ @ g o b b l e t o e l s e # 1 # 2 \ e l s e {\ e l s e #1}% 78 \ l o n g \ def \ @ g o b b l e t o o r # 1 # 2 \ or {\ or #1}% 79 \ g o b b l e t e x @ c a t c o d e

80 \ e x p a n d a f t e r \ ifx \ c s n a m e gobble - u s e r . tex l o a d e d \. e n d c s n a m e \ r e l a x

81 \ e x p a n d a f t e r \ def \ c s n a m e gobble - u s e r . tex l o a d e d \. e n d c s n a m e {1}%

82 \ e l s e

83 \ e x p a n d a f t e r \ e n d i n p u t 84 \ fi

(8)

\gobbletex@catcode

86 \ e x p a n d a f t e r \ e d e f \ c s n a m e g o b b l e t e x @ c a t c o d e \ e n d c s n a m e {.

%

(9)

Referenties

GERELATEERDE DOCUMENTEN

Its features include simplicity of use, compatibility with L A TEX, large sans serif font as default, extra macros to start foils with bold headings and special mechanisms to

includetests {&#34;*&#34;} Test names to include when checking excludetests {} Test names to exclude when checking checkdeps {} List of dependencies for running checks typesetdeps

Figure 16: Layout of an enumerate list Table 7: Commands for setting trial list parameters Command Parameter. \tryitemindent sets the \itemindent value \trylabelwidth sets

The ling-macros package is designed to allow easier use of formal symbols used in formal linguistics, especially in formal linguistics.. The set arose from the macros that I have

Some important parameters, such as the number of steps, the length of step or the function from the right-hand side of the equations are stored in MetaPost variables and to keep

By using this command, digits in math mode inside \mathtt will appear in Persian form and if you do not use this command at all, you will get default TEX font for digits in math

The target is to provide easy access to fonts with a matching Mathematics font available in TeX distri- butions plus a few commercial if available.. The package will include more

Repeat the previous step for all MinionPro and MyriadPro fonts from the installation of the free Adobe Acrobat Reader.. Repeat the above for the MS-Garamond fonts (Gara.ttf,