summaryrefslogtreecommitdiff
path: root/web/matlabweb/mweb.tex
blob: 2ec7053e08f2c18c87ed174a94625149b1f9d0ea (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
\input webkernel.tex
\def\commentbegin{\%}
\def\commentend{\relax}
\let\openbraces=\lbrace     % don't use \{ here; it leads to a tailspin if 
\let\closebraces=\rbrace    % this file is used more than once
\def\{{\ifmmode\openbraces\else$\openbraces$\fi}
\def\}{\ifmmode\closebraces\else$\closebraces$\fi}
\def\s{\ }% space
\font\tentex=cmtex10 % TeX extended character set (used in strings)
\ifx\CCM\undefined
  \ifx\section\undefined
    \def\CCM#1{\leavevmode\hbox{\tentex  % MATLAB controlled comments for TeX
      \let\\=\BS % backslash in a string
      \let\'=\RQ % right quote in a string
      \let\`=\LQ % left quote in a string
      \let\{=\LB % left brace in a string
      \let\}=\RB % right brace in a string
      \let\~=\TL % tilde in a string
      %\let\ =\SP % space in a string
      \let\_=\UL % underline in a string
      \let\&=\AM % ampersand in a string
      #1}}
  \else
    \def\CCM#1{\leavevmode\hbox{\tt  % MATLAB controlled comments for LaTeX
      %\chardef\ =`\  %            % <-- two spaces !
      %\def\ { }%
      \chardef\&=`\&
      \chardef\\=`\\
      \chardef\^=`\^
      \chardef\_=`\_
      \chardef\{=`\{
      \chardef\}=`\}
      \chardef\~=`\~
      \def\`{`}%
    #1}}
  \fi
\fi
% quotes for formatted strings:
\newcount\FQcount \FQcount=0% keeps track of nesting level
\def\FQL{{% formatted string quote left
  \loop
     \mathopen{\WebLG}%
     \advance\FQcount by -1%local
  \ifnum\FQcount>0
     \kern \WebGkern
  \repeat}\kern \WebAkern
  \global\advance\FQcount by 1%
  }
\def\FQR{{% formatted string quote right
  \kern \WebAkern% kern before
  \global\advance\FQcount by -1%
  \loop\mathclose{\WebRG}%
     \advance\FQcount by -1%local
  \ifnum\FQcount>0
     \kern \WebGkern
  \repeat}}
% alternative:
%  \font\WebGfnt=dcr1000
%  \def\WebLG{\hbox{\WebGfnt\char14}}  % left guillemet (french quote)
%  \def\WebRG{\hbox{\WebGfnt\char15}}  % right guillemet
%  \def\WebGkern{-.2em\relax}          % kern between guillemets
%  \def\WebAkern{-.05em\relax}         % kern after
% default:
\ifx\WebLG\undefined
  \def\WebLG{\hbox{`}}  % left quote
  \def\WebRG{\hbox{'}}  % right quote
  \def\WebGkern{-.1em\relax}          % kern between quotes
  \def\WebAkern{0em\relax}
\fi