summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/program/plink.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/program/plink.tex')
-rw-r--r--macros/latex/contrib/program/plink.tex58
1 files changed, 58 insertions, 0 deletions
diff --git a/macros/latex/contrib/program/plink.tex b/macros/latex/contrib/program/plink.tex
new file mode 100644
index 0000000000..1144493ff3
--- /dev/null
+++ b/macros/latex/contrib/program/plink.tex
@@ -0,0 +1,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}