File: tlc3exa.cls

package info (click to toggle)
texlive-lang 2022.20230122-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,447,264 kB
  • sloc: perl: 61,377; xml: 53,781; makefile: 4,525; sh: 4,338; ansic: 2,892; python: 2,861; ruby: 1,031; lisp: 750; awk: 649; java: 159; sed: 142; csh: 25
file content (180 lines) | stat: -rw-r--r-- 5,011 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
%%
%% The LaTeX Companion, 3rd ed
%%
%% Example ``article'' class for use with the Companion examples.
%%
%% Copyright (C) 2017-2022 Frank Mittelbach
%%
%% It may be distributed and/or modified under the conditions
%% of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%%
%% See https://www.latex-project.org/lppl.txt for details.
%%
%

\LoadClass[twoside]{article}

\ifx\Umathcode\@undefined

  \RequirePackage[T1]{fontenc}

  \RequirePackage{tgtermes}
  \RequirePackage[matchuppercase]{tgheros}

  \renewcommand{\ttdefault}{lmtt}

\else % typesetting with LuaLaTex ...

\fi

\let\StartShownPreambleCommands\relax
\let\StopShownPreambleCommands\relax


\let\ps@origplain\ps@plain
\let\ps@plain\ps@empty % this class doesn't produces page numbers
                       % since this would make examples too big
                       % but if necessary there is origplain



% fmi: bug fix for kernel + bigfoot
\newinsert\foobarX
\newinsert\foobarY
\newinsert\foobarZ

% Improve \LaTeX and \TeX logo when used with slanted fonts

\DeclareRobustCommand\TeX{T%
  \ifdim\fontdimen1\font>\z@ \kern-.04em\fi     % new
  \kern-.1667em\lower.5ex\hbox{E}%
  \ifdim\fontdimen1\font>\z@ \kern.07em\fi      % new
  \kern-.125emX\@}

\DeclareRobustCommand{\LaTeX}{L%
  \ifdim\fontdimen1\font>\z@ \kern.1em\fi       % new
  \kern-.36em%
        {\sbox\z@ T%
         \vbox to\ht\z@{\hbox{\check@mathfonts
                              \fontsize\sf@size\z@
                              \math@fontsfalse\selectfont
                              A}%
                        \vss}%
        }%
        \kern-.15em%
        \TeX}


% Book version restricts to two colors. This is set up in the
% code below after \endinput.
%
\endinput

% As the book is printed in two colors only (black and blue) we need
% to ensure that other colors are replaced by gray if necessary:

%shadings defined in the preamble muss use cmyk:
\PassOptionsToPackage{cmyk}{xcolor}

\AddToHook{package/xcolor/after}{%
   \def\XC@col@rlet[#1]#2[#3]#4%
 {\begingroup
  \edef\@@cls{#1}\XC@edef\@@nam{#2}\XC@sdef\@@mod{#3}\XC@edef\@@clr{#4}%
  \XC@info\@@clr\@@tmp\XC@@tstfalse
  \ifnum\@@tmp<2 \ifx\@@mod\@empty %instead of =\@ne
    \ifx\@@cls\@empty
      \XC@@tsttrue
    \else
      \edef\@@tmp
       {\expandafter\expandafter\expandafter\@secondoffive
         \csname\@backslashchar color@\@@clr\endcsname}%
      \ifx\@@cls\@@tmp\XC@@tsttrue\fi
    \fi
  \fi\fi
  \ifXC@@tst
    \XC@logdef\@@nam\XC@c@l@rlet\@@nam\@@clr
  \else
    \extractcolorspec\@@clr\@@clr
    \ifx\@@mod\@empty\else
      \expandafter\convertcolorspec\@@clr\@@mod\@@clr
      \edef\@@clr{{\@@mod}{\@@clr}}\fi
    \edef\@@tmp{\noexpand\XC@definecolor[\@@cls]{\@@nam}\@@clr}%
  \fi
  \expandafter\endgroup\@@tmp\xglobal@stop}%
}

\ExplSyntaxOn
%if the color is not a spot color, color space shouldn't set it.
%this is a simple test looking if the specification starts with a /:
\AddToHook{package/colorspace/after}{%
\cs_set:cpn {pgfsys@color@&spot@fill} #1{%
  \spc@getir{\string\color@pgffillcolor}%
  \tl_if_head_eq_charcode:fNT {\spc@ir}/
  {
    \pgfsysprotocol@literal{\spc@ir\space cs}%
    \pgfsysprotocol@literal{#1~sc}
  }}
\cs_set:cpn {pgfsys@color@&spot@stroke} #1{%
  \spc@getir{\string\color@pgfstrokecolor}%
  \tl_if_head_eq_charcode:fNT {\spc@ir}/
   {
     \pgfsysprotocol@literal{\spc@ir\space CS}%
     \pgfsysprotocol@literal{#1~SC}
   }}}

%for the deviceN we need to declare a few pgf commands
% they don't harm if not used
\def\pgfsys@color@bluexblack@fill#1#2{
 \spc@getir{\string\color@pgffillcolor}
  \tl_if_head_eq_charcode:fNT {\spc@ir}/
   {
     \pgfsysprotocol@literal{\spc@ir\space cs}%
     \pgfsysprotocol@literal{#1~#2~scn}
   }}

\def\pgfsys@color@bluexblack@stroke#1#2{
 \spc@getir{\string\color@pgfstrokecolor}
  \tl_if_head_eq_charcode:fNT {\spc@ir}/
   {
     \pgfsysprotocol@literal{\spc@ir\space CS}%
     \pgfsysprotocol@literal{#1~#2~SCN}
   }}

\def\pgfsys@color@bluexblack#1#2{\pgfsys@color@bluexblack@stroke{#1}{#2}%
  \pgfsys@color@bluexblack@fill{#1}{#2}}
\ExplSyntaxOff


\AddToHook{begindocument/before}{
\ifx\color\@undefined
\else
  \def\pgfutil@colorlet#1#2{\colorlet{#1}{#2}}
  %in case it hasn't been loaded
  \usepackage{xcolor}

  %we need natural model when setting up the spot colors
  \selectcolormodel{natural}
  \usepackage{colorspace}
  \definespotcolor{blue}{PANTONE 3005 U}{1,0.56,0,0}      % what we call ``blue'' in this book
  \definecolorspace{bluexblack}{mixed}{blue,black}
  \definecolor{spotblack}{bluexblack}{0,1}
  \definecolor{spotblue}{bluexblack}{1,0}

  %
  \definecolor{red}{gray}{.7}
  \definecolor{green}{gray}{.8}
  \definecolor{yellow}{gray}{.9}
  %
  \definecolor{orange}{gray}{.75}      % for todo notes
  %for shadings defined later
  \selectcolormodel{cmyk}
  %don't convert colors anymore!
  \convertcolorsUfalse
  \convertcolorsDfalse
\fi
}

\AtBeginDocument{\IfPackageLoadedTF{crop}{\CROP@defmarkcolor{blue}}{}}

\endinput