blob: 1144493ff3de0756f40a1a4a479ee262a07eca8d (
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
|
\documentclass{article}
\usepackage{program}
\catcode`\!=\active % Make ! active
\let!=| % Set it to be the same as |
\let|=\origbar % Restore | to the old value
\catcode`\!=12 % These two lines make ! active
\mathcode`\!="8000 % only in maths mode.
\makeatletter
\def\@svariable{%
\catcode`\!\active
\lccode`\~`\!%
\lowercase{\def~{\endgroup% if we were not in mmode, do italic corr:
\ifwasinmmode\let\next=\/% was \relax
\else\let\next=\variablefontend\fi
\next
\egroup}%
\let\@dovar~}%
\leavevmode\null}
\makeatother
\begin{document}
This document illustrates how to use the exclamation mark (!), or any other character, instead of vertical bar
as the variable name delimiter. This may useful of you are typesetting programs which use a lot of vertical bars.
\[ \left|\frac{\partial \varphi (X)}{\partial g}\right|
= \max_{i\in R(X)} \nabla f_i(X) g^T
\]
Testing!
\[ !foo_bar! = x + y \]
\[ !foo!_{!bar!} = x + y \]
Note that the $!bar!$ subscript is not at a smaller size. If you want a small
subscript, write:
\[ !foo!_{\scriptvar!bar!} = x + y \]
\begin{program}
!choose ! choose X_0 ;
X := X_0 ;
\DO \textnormal{determine } |R(X)|
\textnormal{determine } |G(X)|
\textnormal{determine } |!foo_bar!(X)|
\textnormal{determine } |Z*|
\IF |Z*|=0 \THEN \EXIT \FI
\textnormal{determine direction of steepest descent } g=-|Z*|/{\parallel |Z*|\parallel}
\textnormal{determine }\alpha>0,\textnormal{ for which }\varphi(X+\alpha g)\textnormal{ is minimum}
X := X + \alpha g
\OD
\end{program}
\end{document}
|