summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/carlisle/dotlessj.sty
blob: c91512fb5516ffca79ed4b56676b1737ea572b08 (plain)
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

% dotlessj package
%%%%%%%%%%%%%%%%%
% dotless j (\j) for them that wants one.

% Copyright 1997 1998 David Carlisle
%
% This file may be distributed under the terms of the LPPL.
% See 00readme.txt for details.
%
% David Carlisle david@dcarlisle.demon.co.uk

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{dotlessj}[1998/12/09 v0.03 dotless j package (DPC)]

% 1997/09/10 v0.01  posted to c.t.t
% 1997/09/11 v0.02  added \jmath support
% 1998/12/09 v0.03  added \v\j for  Christoph Eyrich

\RequirePackage{color}

% use a coloured rule rather than clipping as it is more portable
% eg the Y&Y dviwindo previewer, and the OzTeX previewer support
% colour package (and dviwindo can print on colour to non PS devices
% such as ink jet printers).
% Disadvantages of using colour are:
% a) it shows up if the background is not white.
% b) You have to arrange that the accent is printed after the colour.
%    (Easy to arrange for text accents with LaTeX's 
%    \DeclareTextCompositeCommand, but a bit more dangerous for math
%    accents.)
\def\j@internal{%
  \setbox\tw@\hbox{\copy\z@
  \kern-.8\wd\z@
  {\color{white}%
   \vrule \@height1.1\ht\z@ \@depth -1.1\ht4 \@width \wd\z@}%
   \kern-.2\wd\z@}%
   \ht\tw@\ht4 }

%

% The \jmath definition, set up to be passed to \mathpalette
\def\jmath@#1#2{%
  {\m@th\sbox\z@{$#1j$}\sbox4{$#1\imath$}%
   \j@internal
    \box\tw@}}%

% The \jmathaccent definition, set up to be passed to \mathpalette
\def\jmath@x#1#2{%
  {\m@th\sbox\z@{$#1j$}\sbox4{$#1\imath$}%
   \j@internal
     \copy\tw@\kern-\wd\tw@#2{\kern\wd\tw@}}}%

\DeclareRobustCommand\jmathaccent[1]{{\mathpalette\jmath@x{#1}}}


\DeclareRobustCommand\jaccent[1]{%
     {\leavevmode\sbox\z@{j}%
     \hb@xt@\wd\z@{\hss\clap\j\clap{#1{}}\hss}}}%

% centered version of \rlap \llap.
\def\clap#1{\hb@xt@\z@{\hss#1\hss}}%


% If \jmath is passed to a math accent, need to intercept it and
% instead pass the accent to \jmathaccent.

\let\j@mathaccent\mathaccent

\def\mathaccent{\afterassignment\j@mathacc@\count@}

\def\j@mathacc@#1#2{%
  \ifx\jmath#2%
    \jmathaccent{\j@mathaccent\count@}%
  \else
%     #1 should be \relax, but put it back, just in case.
    \j@mathaccent\count@#1{#2}%
  \fi}
 

% delay everything as  \j and friends get defined by encoding files
% read in by, eg fontenc package.

\AtBeginDocument{%
%
\DeclareRobustCommand\j{%
  {\sbox\z@{j}\sbox4{\i}%
   \j@internal
   \leavevmode\box\tw@}}%
%
\DeclareRobustCommand\jmath{{\mathpalette\jmath@\relax}}%
%
% Could do this for all known encodings, but just do it
% for the default encoding at begin document, to avoid wasting
% too much space.
\DeclareTextCompositeCommand\'{\encodingdefault}{\j}{\jaccent\'}%
\DeclareTextCompositeCommand\`{\encodingdefault}{\j}{\jaccent\`}%
\DeclareTextCompositeCommand\"{\encodingdefault}{\j}{\jaccent\"}%
\DeclareTextCompositeCommand\^{\encodingdefault}{\j}{\jaccent\^}%
\DeclareTextCompositeCommand\~{\encodingdefault}{\j}{\jaccent\~}%
\DeclareTextCompositeCommand\.{\encodingdefault}{\j}{j}%
\DeclareTextCompositeCommand\={\encodingdefault}{\j}{\jaccent\=}%
\DeclareTextCompositeCommand\v{\encodingdefault}{\j}{\jaccent\v}}